I am unable to connect to postgres database through remote host using psycopg2 and getting the error like
Error:
File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection timed out
Is the server running on host "192.x.x.x" and accepting
TCP/IP connections on port 5432?
Note: I have made following changes
1.updated the pg_hba config file host all all 0.0.0.1/32 trust
2.updated the postgresql file listen_addresses = '*'
3.changed the firewall rule to allow connection from port 5432 What else I have to do to make it work?
sudo ss -lntp | grep 5432. Did you restart the service after settinglisten_address?0.0.0.1/32contains only one host (0.0.0.1); I doubt this is the address you want to allow but this can be fixed after the TCP connection is OK.listen_addresses = '*'line is not commented in the config file; are you sure you are restarting the service correctly? What's the output ofps aux | grep postgres? Use something like pastebin to paste it.