在repmgr中没有发生自动故障切换

问题描述 投票:0回答:1

我有一个由2个节点组成的postgres activestandby集群,我使用repmgr创建了这个集群。问题是,当我停止主节点上的postgres服务时,自动故障转移没有发生。主节点上repmgr.conf文件的内容如下。

node_id=1
data_directory='/data/pgdatabase/masterdb/data'
node_name=node1
conninfo='host=IP-Of-Master user=repmgr dbname=repmgr'
failover=automatic
promote_command='repmgr standby promote -f /etc/repmgr/11/repmgr.conf --log-to-file'
follow_command='repmgr standby follow -f /etc/repmgr/11/repmgr.conf --log-to-file  --upstream-node-id=%n'
log_file='/var/log/repmgr/repmgr.log'
log_level=NOTICE
reconnect_attempts=4
reconnect_interval=5
repmgrd_service_start_command='sudo systemctl repmgr11 start'
repmgrd_service_stop_command='sudo systemctl repmgr11 stop'

postgresql.conf的内容如下:

listen_addresses = '*'
shared_preload_libraries = 'repmgr'
max_wal_senders = 15
max_replication_slots = 15
wal_level = 'replica'
hot_standby = on
archive_mode = on
archive_command = 'cp %p /var/lib/pgsql/11/archive/%f'

主节点和从节点的内容都是一样的 除了从节点上的名字是node2外,其他内容都是一样的 谁能告诉我,自动故障切换不发生的可能原因是什么?

postgresql database-administration database-replication database-cluster repmgr
1个回答
0
投票

我自己解决了这个问题,我需要创建文件etcdefaultrepmgrd,并在其中添加以下几行内容。

REPMGRD_ENABLED=yes
REPMGRD_CONF="/etc/repmgr.conf"
© www.soinside.com 2019 - 2024. All rights reserved.