'Failed to build the PostgreSQL remote connection
I have tried the method mentioned on the other answers, but only to find they all failed. What I did to the configuration are below.
- Modified the "pg_hba.conf" file
# IPv4 local connections:
#host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
- Modified the "postgresql.conf" file
# - Connection Settings -
listen_addresses = '*'
- Restart the server
sudo service postgresql restart
But I still failed to build the remote connection.
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "xxx.xxx.xxx.xxx" and accepting
TCP/IP connections on port 5432?
The port 5432 was open by the following command:
xx@xx:~$ netstat -nlt|grep :5432
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN
tcp6 0 0 :::5432 :::* LISTEN
And I could ping the IP address where the PostgreSQL was.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
