Discussion:
[Pgbouncer-general] psql: could not connect to server: No such file or directory
Greg Sabino Mullane
2015-11-14 00:24:15 UTC
Permalink
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.6432"?
I suspect your psql was compiled to look in /var/run/postgresql for
Postgres sockets, while pgbouncer is using /tmp. You can confirm
this by running this command:

psql -d csireg1 -p 6432 -h /tmp

If that works, a good solution is to simply have pgbouncer start putting
its sockets where psql (and everything else that uses libpq) expects to
find it. Add this to your pgbouncer.ini:

unix_socket_directory = /var/run/postgresql
--
Greg Sabino Mullane ***@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
Armand Pirvu (home)
2015-11-16 04:38:56 UTC
Permalink
Hi Greg

Thank you for the reply


I can confirm that

psql -d csireg1 -p 6432 -h /tmp


works ok


But I also looked and

/tmp
807592420 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42 .s.PGSQL.5432
807592415 -rw-------. 1 postgres postgres 51 Nov 15 21:42 .s.PGSQL.5432.lock
805313373 srwxrwxrwx. 1 pgbouncer pgbouncer 0 Nov 13 15:21 .s.PGSQL.6432


/var/run/postgresql
16815375 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42 .s.PGSQL.5432
16815373 -rw-------. 1 postgres postgres 66 Nov 15 21:42 .s.PGSQL.5432.lock




It is a “ Say what “ moment . I mean how can I see the same .s.PGSQL.5432 which is Postgresql in TWO different directories ?


I will restart tomorrow morning pgbouncer with the new setting for the sockets


Thanks
Armand
Post by Greg Sabino Mullane
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.6432"?
I suspect your psql was compiled to look in /var/run/postgresql for
Postgres sockets, while pgbouncer is using /tmp. You can confirm
psql -d csireg1 -p 6432 -h /tmp
If that works, a good solution is to simply have pgbouncer start putting
its sockets where psql (and everything else that uses libpq) expects to
unix_socket_directory = /var/run/postgresql
--
End Point Corporation
PGP Key: 0x14964AC8
Guillaume Lelarge
2015-11-16 07:15:13 UTC
Permalink
Post by Armand Pirvu (home)
Hi Greg
Thank you for the reply
I can confirm that
psql -d csireg1 -p 6432 -h /tmp
works ok
But I also looked and
/tmp
807592420 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42
.s.PGSQL.5432
Post by Armand Pirvu (home)
807592415 -rw-------. 1 postgres postgres 51 Nov 15 21:42
.s.PGSQL.5432.lock
Post by Armand Pirvu (home)
805313373 srwxrwxrwx. 1 pgbouncer pgbouncer 0 Nov 13 15:21
.s.PGSQL.6432
Post by Armand Pirvu (home)
/var/run/postgresql
16815375 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42 .s.PGSQL.5432
16815373 -rw-------. 1 postgres postgres 66 Nov 15 21:42
.s.PGSQL.5432.lock
Post by Armand Pirvu (home)
It is a “ Say what “ moment . I mean how can I see the same .s.PGSQL.5432
which is Postgresql in TWO different directories ?
Post by Armand Pirvu (home)
I will restart tomorrow morning pgbouncer with the new setting for the sockets
The directory GUC (unix_socket_directories IIRC) allows you to put more
than one directory in recent releases.
Post by Armand Pirvu (home)
Thanks
Armand
Post by Greg Sabino Mullane
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.6432"?
Post by Armand Pirvu (home)
Post by Greg Sabino Mullane
I suspect your psql was compiled to look in /var/run/postgresql for
Postgres sockets, while pgbouncer is using /tmp. You can confirm
psql -d csireg1 -p 6432 -h /tmp
If that works, a good solution is to simply have pgbouncer start putting
its sockets where psql (and everything else that uses libpq) expects to
unix_socket_directory = /var/run/postgresql
--
End Point Corporation
PGP Key: 0x14964AC8
_______________________________________________
Pgbouncer-general mailing list
http://lists.pgfoundry.org/mailman/listinfo/pgbouncer-general
Armand Pirvu (home)
2015-11-16 14:53:55 UTC
Permalink
Thanks for the explanation Guillaume


I did change the pgbouncer ini


[***@devdb2607 ~]$ sudo grep unix_ /etc/pgbouncer/pgbouncer.ini
unix_socket_directory = /var/run/postgresql
;unix_socket_dir = /tmp
;unix_socket_mode = 0777
;unix_socket_group =
[***@devdb2607 ~]$


And the issue is still there



[***@devdb2607 ~]$ psql -dcsireg1 -p 6432 -h localhost
psql (9.4.4)
Type "help" for help.
csireg1=> \q

[***@devdb2607 ~]$ psql -dcsireg1 -p 6432
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.6432"?



[***@devdb2607 ~]$ sudo ls -ali /var/run/postgresql/
total 4
14919 drwxr-xr-x. 2 postgres postgres 80 Nov 16 08:37 .
1226 drwxr-xr-x. 46 root root 1380 Nov 15 01:05 ..
20964229 srwxrwxrwx. 1 postgres postgres 0 Nov 16 08:37 .s.PGSQL.5432
20964227 -rw-------. 1 postgres postgres 66 Nov 16 08:37 .s.PGSQL.5432.lock

It appears that it ignores totally the unix_socket_directory ?????

Thanks
Armand
Post by Armand Pirvu (home)
Hi Greg
Thank you for the reply
I can confirm that
psql -d csireg1 -p 6432 -h /tmp
works ok
But I also looked and
/tmp
807592420 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42 .s.PGSQL.5432
807592415 -rw-------. 1 postgres postgres 51 Nov 15 21:42 .s.PGSQL.5432.lock
805313373 srwxrwxrwx. 1 pgbouncer pgbouncer 0 Nov 13 15:21 .s.PGSQL.6432
/var/run/postgresql
16815375 srwxrwxrwx. 1 postgres postgres 0 Nov 15 21:42 .s.PGSQL.5432
16815373 -rw-------. 1 postgres postgres 66 Nov 15 21:42 .s.PGSQL.5432.lock
It is a “ Say what “ moment . I mean how can I see the same .s.PGSQL.5432 which is Postgresql in TWO different directories ?
I will restart tomorrow morning pgbouncer with the new setting for the sockets
The directory GUC (unix_socket_directories IIRC) allows you to put more than one directory in recent releases.
Post by Armand Pirvu (home)
Thanks
Armand
Post by Greg Sabino Mullane
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.6432"?
I suspect your psql was compiled to look in /var/run/postgresql for
Postgres sockets, while pgbouncer is using /tmp. You can confirm
psql -d csireg1 -p 6432 -h /tmp
If that works, a good solution is to simply have pgbouncer start putting
its sockets where psql (and everything else that uses libpq) expects to
unix_socket_directory = /var/run/postgresql
--
End Point Corporation
PGP Key: 0x14964AC8
_______________________________________________
Pgbouncer-general mailing list
http://lists.pgfoundry.org/mailman/listinfo/pgbouncer-general
Greg Sabino Mullane
2015-11-16 15:07:03 UTC
Permalink
Post by Greg Sabino Mullane
unix_socket_directory = /var/run/postgresql
;unix_socket_dir = /tmp
It's 'unix_socket_dir', not 'unix_socket_directory'. Postgres
and pgbouncer do not use the exact same names.
--
Greg Sabino Mullane ***@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
Armand Pirvu (home)
2015-11-16 15:53:18 UTC
Permalink
My bad Greg

I had also to fix a permission issue and all good


Thanks all for help



Armand
Post by Greg Sabino Mullane
Post by Greg Sabino Mullane
unix_socket_directory = /var/run/postgresql
;unix_socket_dir = /tmp
It's 'unix_socket_dir', not 'unix_socket_directory'. Postgres
and pgbouncer do not use the exact same names.
--
End Point Corporation
PGP Key: 0x14964AC8
Loading...