postgresql 错误:连接到服务器在“10.0.30.7“,端口5432失败:没有到主机的路由

2ic8powd  于 2023-08-04  发布在  PostgreSQL
关注(0)|答案(2)|浏览(153)

首先,我想要一个由repmgr提供的HA PostgreSQL
将其子网划分为10.0.30.0/24
da 1服务器10.0.30.7-- master da 2服务器10.0.30.6-- worker所以我得到错误
第一个月
我可以嘘
postgres@da2:~$ ssh postgres@10.0.30.7 postgres@10.0.30.7的密码:
我的postgresql.conf文件:listen_addresses = '*'端口= 5432
da 1服务器- master - pg_heba.conf

da1 : 

# Database administrative login by Unix domain socket
local   all             postgres                                peer
local   all             repmgr                                  peer 
# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             10.0.30.0/24            md5
# "local" is for Unix domain socket connections only
local   repmgr          repmgr                                  trust
local   all             all                                     peer
# IPv4 local connections:
host    repmgr          repmgr          10.0.30.0/24            trust
host    all             all             10.0.30.0/24            md5
host    all             all             0.0.0.0/0               md5
# IPv6 local connections:
host    all             all             0.0.0.0/0               md5
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     repmgr                                  trust
local   replication     all                                     peer
host    replication     repmgr          10.0.30.0/24            trust
host    replication     replicador      10.0.30.0/24            md5
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256

字符串
DA2:

the da2 : 

# Database administrative login by Unix domain socket
local    all             postgres                                peer
#local   all             repmgr                                  peer 
# TYPE  DATABASE        USER            ADDRESS                 METHOD
host     repmgr         repmgr         10.0.30.7/24              md5
host      all           all            10.0.30.0/24              md5
# "local" is for Unix domain socket connections only
local   all             all                                      peer
# IPv4 local connections:
host    all             all             10.0.30.0/24             md5
# IPv6 local connections:
#host    all             all                             md5
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256


我检查了几乎所有的东西仍然无法连接

wz8daaqr

wz8daaqr1#

你检查过你的防火墙规则了吗?你能在端口5432上从da 1 telnet到da 2吗?请在两个服务器上,请运行:netstat -plntu并返回结果(必须安装net-tools才能运行netstat)

oewdyzsn

oewdyzsn2#

错误No route to host表明客户端的路由表中没有服务器IP地址的路由。您能否ping通服务器的IP地址?您很可能无法执行ping操作,并且ping会说服务器无法访问。如果是这样,则此错误与您的配置无关,您可能遇到了网络连接问题。您可能需要检查防火墙规则。

相关问题