pgadmin won't connect to Postgresql via ssh on macOS

I am trying, with no success, to connect pgAdmin 4 to my Postgresql installation on Linode using ssh tunnel as specified in https://linode.com/docs/databases/postgresql/securely-manage-remote-postgresql-servers-with-pgadmin-on-macos-x/

It did not work, with pgAdmin giving me:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

I spent hours searching for a solution and nothing seems to work. I am for sure missing something. Here is what else I tried:

  • I went through all the steps in https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
  • my netstat -nlt shows:

    tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
    tcp 0 0 127.0.0.1:587 0.0.0.0:* СЛУШАТЬ
    tcp 0 0 0.0.0.0:22 0.0.0.0:* СЛУШАТЬ
    tcp 0 0 0.0.0.0:5432 0.0.0.0:* СЛУШАТЬ
    tcp 0 0 127.0.0.1:5433 0.0.0.0:* СЛУШАТЬ
    tcp 0 0 127.0.0.1:25 0.0.0.0:* СЛУШАТЬ
    tcp6 0 0 ::: 80 ::: * СЛУШАТЬ
    tcp6 0 0 ::: 22 ::: * СЛУШАТЬ
    tcp6 0 0 ::: 5432 ::: * СЛУШАТЬ
    tcp6 0 0 :: 1: 5433 ::: * СЛУШАТЬ
    
  • мой статус ufw показывает:

     Статус: активен
    К действию от
    22 РАЗРЕШИТЬ В любом месте
    5432 / tcp РАЗРЕШИТЬ В любом месте
    22 (v6) РАЗРЕШИТЬ В любом месте (v6)
    5432 / tcp (v6) РАЗРЕШИТЬ в любом месте (v6)
    
  • I certainly restarted Postgresql more often than not (for every single modification try)

  • if I run psql -h localhost -p 5433 -U postgres it works fine
  • also with psql -h localhost -p 5432 -U postgres all works fine

But nothing else I do works for pgAdmin.

Does anyone can shed a light on it? What am I missing? What else could I try?

Thank you Greetings from Beijing! Daniel

2
задан 8 February 2018 в 17:12
1 ответ

Это была действительно глупая ошибка, конечно, потому что я новичок в этом:

Согласно инструкциям , я ввел команду

ssh -f - L 5433: 127.0.0.1: 5432 имя пользователя @ удаленный хост -N

, когда я уже подключился к моему серверу Linode. Это должно было быть сделано на моем локальном компьютере, до входа в Linode.

Иначе у моего Mac не было бы возможности узнать о туннеле! Так очевидно, что я не смотрю на это.

0
ответ дан 3 December 2019 в 14:01

Теги

Похожие вопросы