我正在尝试使用 PostgtrSql 11 在 Debian 上设置 repmgr 版本 5。
似乎文档更面向 centos/RHEL。
当我尝试设置 witnes 节点以启动 repmgr 守护程序时,我收到一个错误,不知道在哪里寻找错误的原因。
这是我的 repmgr.conf 文件:
node_id=3
node_name='PG-Node-Witness'
conninfo='host=10.97.7.140 user=repmgr dbname=repmgr connect_timeout=2'
data_directory='/var/lib/postgresql/11/main'
failover='automatic'
promote_command='/usr/bin/repmgr standby promote -f /etc/repmgr.conf --log-to-file'
follow_command='/usr/bin/repmgr standby follow -f /etc/repmgr.conf --log-to-file --upstream-node-id=%n'
priority=60
monitor_interval_secs=2
connection_check_type='ping'
reconnect_attempts=6
reconnect_interval=8
primary_visibility_consensus=true
standby_disconnect_on_failover=true
repmgrd_service_start_command='sudo /etc/init.d/repmgrd start' #??????
repmgrd_service_stop_command='sudo //etc/init.d/repmgrd stop'#??????
service_start_command='sudo /usr/bin/systemctl start postgresql@11-main.service'
service_stop_command='sudo /usr/bin/systemctl stop postgresql@11-main.service'
service_restart_command='sudo /usr/bin/systemctl restart postgresql@11-main.service'
service_reload_command='sudo /usr/bin/systemctl relaod postgresql@11-main.service'
monitoring_history=yes
log_status_interval=60
注册没问题:
repmgr -f /etc/repmgr.conf witness register -h 10.97.7.97
INFO: connecting to witness node "PG-Node-Witness" (ID: 3)
INFO: connecting to primary node
NOTICE: attempting to install extension "repmgr"
NOTICE: "repmgr" extension successfully installed
INFO: witness registration complete
NOTICE: witness node "PG-Node-Witness" (ID: 3) successfully registered
repmgr 守护进程也可以空运行:
$repmgr -f /etc/repmgr.conf daemon start --dry-run
INFO: prerequisites for starting repmgrd met
DETAIL: following command would be executed:
sudo /usr/bin/systemctl start postg...@11-main.service
我设置 /etc/default/repmgrd :
REPMGRD_ENABLED=yes
和
REPMGRD_CONF="/etc/repmgr.conf"
但是在尝试运行守护程序启动时仍然会出错:
$ repmgr -f /etc/repmgr.conf daemon start
我得到:
NOTICE: executing: "sudo /etc/init.d/repmgrd start"
ERROR: repmgrd does not appear to have started after 15 seconds
HINT: use "repmgr service status" to confirm that repmgrd was successfully started