postgresql主从复制时报错:no pg_hba.conf entry for replication connection from host "192.168.15.131", user "replicator", SSL off

原创 2020-03-20 13:39 阅读(351)次

今天在部署postgresql主从复制时,复制一直不成功,检查了主从库的配置没发现什么问题,于是修改主库的配置,修改postgresql.conf:

logging_collector = on

将日志功能打开,重启主库

看到日志一直在报错:

FATAL:  no pg_hba.conf entry for replication connection from host "192.168.15.131", user "replicator", SSL off

我以为pg_hba.conf中配置了如下就可以:

local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust
但依然会报如上的错误,于是只能规规矩矩把复制用户和ip配置上去,在pg_hba.conf中加上如下配置就可以了:

host    replication     replicator      192.168.15.131/32       trust