I have followed everything I can find online about how to do this, and as far as I can tell everything is correct- but it's not working.
I have a Linux 12.04 server running Postgres 9.1.
I can SSH into the server and work with Postgres perfectly from there, connected via local connection.
When I tried to set up Postgres for remote access however I cannot get it to work.
I have made the following changes: (All listed files are in /etc/postgresql/9.1/main)
- In /environment, I've added
PGOPTIONS='-i'
- In /pg_hba.conf, I've added
host all all 0.0.0.0/0 md5
- In /postgresql.conf, I've changed
listen_addresses='*'
- I've checked the firewall, it was default config but opened postgres port just in case
- Netstat -a shows
tcp 0 0 localhost:5432 *:* LISTEN
- I've made sure my postgres user password and name is correct, and can connect locally with that user
- I've tried restarting (
services postgresql restart
) and start/stop.
And yet, still, I can't connect remotely at all. I get the following error:
$ psql -h [server address] -U [username] -d [database name] psql: could
not connect to server: Connection refused Is the server running on
host "[server address]" ([ip address]) and accepting TCP/IP
connections on port 5432?
Any ideas?
Answer
Are you SURE you restarted postgresql after this? The configuration is correct, but it's still bound only to localhost.
Comments
Post a Comment