문제

Even though it might sound related to this question, it isn't, because I'm intreseted in the use of unix sockets instead of TCP/IP ones.

However, I am unable to connect to a remote PostgreSQL database using unix sockets and an ssh tunnel with pgAdmin4. pgAdmin always claims a refused connection by the server and asks for a password, which makes me wonder. When sshing into the server and using psql a connection can be made just flawlessly using the unix socket (/var/run/postgresql). Is there anything special that needs to be set to allow such a setup, or might this even be a bug in pgAdmin itself? I'd appreciate any ideas to solve this problem without having to resort on TCP/IP connections on the remote side.

I also post some screens from my current config:

connection tab

ssh tunnel tab

도움이 되었습니까?

해결책

That should work fine with the correct ssh command.

To forward from a local Unix socket to a remote one runs

ssh -L /tmp/.s.PGSQL.5555:/var/run/postgresql/.s.PGSQL.5432 -N laurenz@dbserver

Then you would use host /tmp and port 5555 to connect.

To forward a local TCP socket to a remote Unix socket, run:

ssh -L 5555:/var/run/postgresql/.s.PGSQL.5432 -N laurenz@dbserver

Then you would use host 127.0.0.1 and port 5555 to connect.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top