我正在尝试用PostgtrSql 11在Debian上设置repmgr版本5。
文档似乎更多地面向centos/RHEL。
当我尝试设置见证者节点以启动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 registeredrepmgr守护进程的模拟运行也正常:
$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"但在尝试运行守护进程start时仍会出现错误:
$ 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发布于 2020-07-03 23:55:10
显然,启动repmgr守护进程的正确命令是: repmgrd -f /etc/prepamgr.conf
发布于 2021-03-03 07:50:41
建议将repmgrd作为systemd服务运行,根据docs (对于debian),您可能首先需要配置/etc/default/repmgrd,我的配置如下:
# default settings for repmgrd. This file is source by /bin/sh from
# /etc/init.d/repmgrd
# disable repmgrd by default so it won't get started upon installation
# valid values: yes/no
REPMGRD_ENABLED=yes
# configuration file (required)
REPMGRD_CONF="/etc/repmgr/12/repmgr.conf"
# additional options
REPMGRD_OPTS="--daemonize=false"
# user to run repmgrd as
REPMGRD_USER=postgres
# repmgrd binary
REPMGRD_BIN=/bin/repmgrd
# pid file
REPMGRD_PIDFILE=/var/run/repmgrd.pid其次,我将重新访问sudoers (visudo),以检查non-root用户是否可以执行sudo /etc/init.d/repmgrd start。
此外,根据您的配置,运行repmgr命令的用户应该能够写入日志。
https://stackoverflow.com/questions/62702415
复制相似问题