我正在尝试使用Github 链接上提供的自动故障转移快速安装教程来安装repmgr。
但是当我试图用repmgr -d repmgr -U repmgr -h [MASTERIP] -D /var/lib/postgresql/9.1/witness -f /var/lib/postgresql/9.1/repmgr/repmgr.conf witness create创建证人的时候,我被困在了证人部分。
我得到以下错误:
Connection to database failed: fe_sendauth: no password supplied
我不知道错误说的是哪个数据库?是主数据库还是证人?
另外,我还没有找到一个密码参数来传递给repmgr,有吗?
以下是每个服务器的repmgr.conf文件:
证人:
cluster=main
node=3
node_name=witness
conninfo='host=[WITNESS IP] dbname=witness user=witness password=witness port=5499'
master_response_timeout=60
reconnect_attempts=6
reconnect_interval=10
failover=automatic
promote_command='promote_command.sh'
follow_command='/usr/lib/postgresql/9.1/bin/repmgr standby follow -f /etc/repmgr/repmgr.conf'待命:
cluster=main
node=2
node_name=node2
conninfo='host=[STANDBY IP] dbname=[DB NAME] user=[DB USER NAME] password=[PASSWORD]'
master_response_timeout=60
reconnect_attempts=6
reconnect_interval=10
failover=automatic
promote_command='promote_command.sh'
follow_command='/usr/lib/postgresql/9.1/bin/repmgr standby follow -f /etc/repmgr/repmgr.conf'师父:
cluster=main
node=1
node_name=node1
conninfo='host=[MASTER IP] dbname=[MASTER DB] user=[MASTER DB USER] password=[PASSWORD]'
master_response_timeout=60
reconnect_attempts=6
reconnect_interval=10
failover=automatic
promote_command='promote_command.sh'
follow_command='/usr/lib/postgresql/9.1/bin/repmgr standby follow -f /etc/repmgr/repmgr.conf'发布于 2017-02-01 15:56:35
错误消息意味着repmgr帐户无法使用提供的密码(可能是空密码)登录到主服务器。
在pg_hba.conf中,您需要允许主机上的连接:
host all repmgr 192.168.1.1/32 md5
host replication all 192.168.1.1/32 md5然后触发主服务器重新加载:
/usr/lib/postgresql/9.1/bin/pg_ctl reload -D /var/lib/postgresql/9.1/main(其中-D是PostgreSQL的数据目录)。
假设您已经创建了一个repmgr帐户,在主用户上使用一些secret_passw0rd
createuser --login --superuser -P repmgr -W
createdb -O repmgr repmgr然后在备用服务器上,在.pgpass home中创建一个postgres文件:
su - postgres
cat > .pgpass << EOF
*:*:*:repmgr:secret_passw0rd
EOF
chmod 0600 .pgpass假设您使用md5密码身份验证进行复制,如果切换到trust,可以跳过设置密码:
host all repmgr 192.168.1.1/32 trust
host replication all 192.168.1.1/32 trust现在您可以检查到主服务器的连接:
psql -h master.hostname -U repmgrhttps://dba.stackexchange.com/questions/42269
复制相似问题