, , , ,

Postgres - se connecter a une socket

ps -ef |grep postgres

Trouver le PID du process Postgres père
Exemple : 2962

# ls -l /proc/2962/fd/ |grep socket
lrwx------. 1 postgres postgres 64 Aug  8 06:55 3 -> socket:[25104]
lrwx------. 1 postgres postgres 64 Aug  8 06:55 4 -> socket:[25106]
lrwx------. 1 postgres postgres 64 Aug  8 06:55 8 -> socket:[25118]
# #lsof -i -a -p 2962
# #find / -user postgres -type s 2>/dev/null
# #netstat -lx |egrep "25104|25106|25118"
# ss -xl |egrep "25104|25106|25118"
u_str LISTEN 0      2048                                            /tmp/.s.PGSQL.5455 25106               * 0
su - postgres
$ psql -h /tmp/.s.PGSQL.5455
psql: error: could not connect to server: Not a directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5455/.s.PGSQL.5432"?

$ psql -h /tmp
psql: error: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Solution

psql -h /tmp -p 5455

FIXME