#python #postgresql #ssh #psycopg2 #ssh-tunnel
Вопрос:
У меня есть сценарий:
import psycopg2
from sshtunnel import SSHTunnelForwarder
with SSHTunnelForwarder(
('3.120.198.220', 22),
ssh_password='MYPASSWORD',
ssh_username='MYUSER',
ssh_pkey='MYPATH',
remote_bind_address=('192.168.122.61', 5432)) as server:
connection = psycopg2.connect(database='MYDB',user='MYUSER',password='MYPASS',host='192.168.122.61')
cursor = connection.cursor()
и этот вывод у меня есть:
psycopg2.OperationalError: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "192.168.122.61" and accepting
TCP/IP connections on port 5432?
Я проверил свой postgresql.conf, так что он прослушивает все:
listen_addresses = ‘*’
и что мой pg_hba.conf:
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
host all all 127.0.0.1/32 scram-sha-256
host all all 192.168.122.61/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all scram-sha-256
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
есть какие-нибудь идеи?