網頁

Wednesday, September 1, 2010

[TroubleShooting] Can't connect to pgpool port 9999

When you setting Pgpool with PostgreSQL and had following error message

psql: 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.9999"?

Please check pgpool config.

$ vi /usr/local/etc/pgpool.conf

You can do some modify to fix it.

Change default setting

socket_dir = '/tmp'
pcp_socket_dir = '/tmp'
backend_socket_dir = '/tmp'

to

socket_dir = '/var/run/postgresql'
pcp_socket_dir = '/var/run/postgresql'
backend_socket_dir = '/var/run/postgresql'

Save then restart pgpool.

$ pgpool -n -d > /tmp/pgpool.log 2>&1 &
$ pgpool stop


Check Result

$ psql -p 9999

END.


BTW, You can use following command check pgpool listening socket.

$ netstat -lp | grep pgpool

result like this

tcp 0 0 *:9999 *:* LISTEN 21476/pgpool
tcp 0 0 *:9898 *:* LISTEN 21476/pgpool
unix 2 [ ACC ] STREAM LISTENING 55074 21476/pgpool /var/run/postgresql/.s.PGSQL.9999
unix 2 [ ACC ] STREAM LISTENING 55082 21476/pgpool /var/run/postgresql/.s.PGSQL.9898

No comments:

Post a Comment