

在备上 构建主备关系,执行 gs_ctl build -D /gaussdb/data/db1/ -b full -M standby 时报错
信息:
[2022-08-31 17:59:30.432][11944][][gs_ctl]: gs_ctl full build ,datadir is /gaussdb/data/db1
waiting for server to shut down.... done
server stopped
[2022-08-31 17:59:31.462][11944][][gs_ctl]: current workdir is (/home/omm).
[2022-08-31 17:59:31.462][11944][][gs_ctl]: fopen build pid file "/gaussdb/data/db1/gs_build.pid" success
[2022-08-31 17:59:31.462][11944][][gs_ctl]: fprintf build pid file "/gaussdb/data/db1/gs_build.pid" success
[2022-08-31 17:59:31.468][11944][][gs_ctl]: fsync build pid file "/gaussdb/data/db1/gs_build.pid" success
[2022-08-31 17:59:31.469][11944][][gs_ctl]: set gaussdb state file when full build build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD).
[2022-08-31 17:59:31.470][11944][dn_6001][gs_ctl]: build connection to 10.1.13.30 failed cause could not connect to server: Operation now in progress
Is the server running on host "10.1.13.30" and accepting
TCP/IP connections on port 26001?
.
[2022-08-31 17:59:31.470][11944][dn_6001][gs_ctl]: build try host(10.1.13.30) port(26001) failed
[2022-08-31 17:59:31.470][11944][dn_6001][gs_ctl]: could not connect to server.
[2022-08-31 17:59:31.470][11944][dn_6001][gs_ctl]: full build failed(/gaussdb/data/db1).
检查了两台机子的 postgresql.conf 主上如下:
replconninfo1 = 'localhost=10.1.13.30 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=10.1.13.107 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004'
备上如下:
replconninfo1 = 'localhost=10.1.13.107 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=10.1.13.30 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004'
两台机子的pg_hba.conf 如下:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 10.1.13.30/32 sha256
host all all 10.1.13.30/32 trust
host all all 10.1.13.107/32 trust
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 trust


看起来像是添加了不必要的hba条目,建议只保留原有的hba,然后参考这边文章。


试试这个
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 10.1.13.30/32 trust
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 trust


