【问题标题】:Automatic failover not happening in repmgrrepmgr 中未发生自动故障转移
【发布时间】:2020-05-02 16:14:46
【问题描述】:

我有 2 个节点的 postgres 活动/备用集群,我使用 repmgr 创建集群。问题是,当我停止主节点上的 postgres 服务时,不会发生自动故障转移。 master上的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'

master和slave上的内容相同,除了名称,slave上的node2。 谁能指导我没有发生自动故障转移的可能原因

【问题讨论】:

    标签: postgresql database-administration database-replication database-cluster repmgr


    【解决方案1】:

    我自己解决了,我需要创建文件 /etc/default/repmgrd 并在其中添加以下行

    REPMGRD_ENABLED=yes
    REPMGRD_CONF="/etc/repmgr.conf"
    

    【讨论】:

    • 还有一些问题。当节点 1 为主节点且节点 2 为从节点时,在切换时,节点 2 变为主节点。但是当节点 2 是主节点而节点 1 是从节点时,节点 1 不会提升为主节点
    猜你喜欢
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-21
    • 1970-01-01
    • 2013-04-25
    • 2015-03-21
    • 1970-01-01
    相关资源
    最近更新 更多