I'm trying to deploy a Dash app onto Heroku that is connected to an external PostgreSQL database. I've tried to use the heroku-postgres addon but I don't quite understand how that works, and I think it also won't have enough space for the data I need. I currently have an external PostgreSQL database I'm using and I've gone through the steps to attach/detach/config:add the new DATABASE_URL.
Every time I deploy I run into this error (more of the error code in the image):
Error fetching data from PostgreSQL table could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I've set up my Config Vars such that the DATABASE_URL is postgres://user:password#host_ip:port/database_name
and in my code I'm connecting to the database via a .env file that looks like this:
# Development settings
user="user"
password="password"
host="ip"
database="postgres"
Also, I saw somewhere that this might be useful to check ps -ef | grep postgres and the output of that shows the correct database connection, but the output of pg_lsclusters shows nothing.
Please let me know if I can provide any more info. Thank you in advance!
Related
I have written a python script that uses the MySQL Connector for Python to read, write and update the database. Do I need to install MySQL server on the client machine (Windows) too to run the program or do I just need to make sure that the database is present in the path used by the script? I tried finding guidance on Google and here but couldn't find what I needed.
No you don't need to install MySQL Server on a client machine. By definition client machine means you don't have the DB/Server there. Where is this DB allocated? You show have an IP or a domain/subdomain address where the DB is actually hosted.
I created a connection to a remote, tunneled MySQL server over the PyCharm GUI in the "Database" menu.
I'm trying to use this connection in the code itself, without connecting manually again to the SQL server and tunelling over SSH in the code.
Is this possible? I couldn't find anything relevant on the internet yet.
Thanks!
I am doing this task the first time. I have found good documentation on how to download an existing postgres DB to local but none of the informations seem to work for me.
I need to download an existing postgres DB to local. I do this to check the entries and to have a backup because I need to work on the DB.
I have posgresql installed localy and I want to copy the heroku DB into my local DB which is named postgres. The local server has a username postgres and a password.
I have only one DB and one APP on heroku.
I tried 2 solutions.
PG:PULL
heroku pg:pull DATABASE_URL postgres
This gave me:
DL is deprecated, please use Fiddle
! The command "createdb" is written either false or
! could not be found
!
! Unable to create new local database. Ensure your local Postgres is working and try again.
So I tried with password ans username:
PGUSER=postgres PGPASSWORD=mypw heroku pg:pull DATABASE_URL postgres
This gave me:
The command "PGUSER" is written either false or could not be found
PG:BACKUPS
heroku pg:backups capture
This worked well:
Use Ctrl-C at any time to stop monitoring progress; the backup
will continue running. Use heroku pg:backups info to check progress.
Stop a running backup with heroku pg:backups cancel.
DATABASE ---backup---> b003
Backup completed
Then I used curl:
curl -o latest.dump `heroku pg:packups public-url`
Which gave me:
The command "curl" is written either false or could not be found
It seems nobody had such a problem, I dont know what I am missing. I red the whole heroku documentation and there is no such case.
EDIT
I connected to my DB via PgAdmin4 but also here I am getting the same type of error when trying to restore a DB dump file.
The PgAdmin4 log gives me:
The command "pg_restore.exe" is written either false or could not be found
I also tried to add postgresql to global path variable, but it does not seem to help:
;C:\Programme\PostgreSQL\9.6\bin\pg_restore.exe
and I tried:
;C:\Programme\PostgreSQL\9.6\bin
I've got an app engine running and I'm struggling to get the MySQL to connect when it has been deployed. It connects fine on my pc running the dev server, but as soon as I deploy I get this error:
OperationalError: (2004, "Can't create TCP/IP socket (-1)")
Could this be because it is not a cloud sql database ? I've fiddled with a few things like firewall rules and dns things but I honestly just don't know where to even start solving this issue. Some research indicated it might be a TCP/IP vs Unix socket issue which does also kind of make sense as I've got another connection to a cloud sql instance which works fine (using a unix socket). It is a python app, any help is appreciated
You need to enable billing for your project to use socket connections in appengine..
i'm following this tutorial: http://www.programmersbook.com/page/21/Django-Beginner-Tutorial-Part-I/
and I added the database details (running django.db.backends.postgresql_psycopg2) and i added the template dirs. But when i do
./manage.py syncdb
i get:
self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Any suggestions on how i can fix this please?
Before connecting to database you need to install database server, and configure it for any user to access.
If you want just follow tutorial use SQLite -it's most simple to configure.
Otherwise, install database server of your choose, create database, configure access, make sure that connection details are correct, and/or DB server is up and running.
Best way is try to connect to server via command line.