Быстрый вопрос о postgresql-10 и repmgrd
У меня есть два узла postgres1 и postgres2 [master / standby], и я установил PGSQL-10 и repmgr10 и вручную попытался сформировать кластер, а также выполнить репликацию, отработку отказа ипереключение, но это было сделано вручную, и оно работает, когда я делаю это вручную.
Переход к repmgrd, когда я пытаюсь переключиться и продвинуть резерв в качестве основного, но я не могу сделать это в качестве основногоневозможно отключиться от удаленного резервного узла, и я получаю ошибку ниже, я не знаю, почему
Я включил пароль меньше SSH Доступ также между узлами и добавлен ниже в sudoers.d также
/etc/sudoers.d/postgres
-----------------------
postgres ALL = NOPASSWD: /usr/bin/systemctl stop postgresql-10,/usr/bin/systemctl start postgresql-10,/usr/bin/systemctl restart postgresql-10,/usr/bin/systemctl reload postgresql-10, /usr/pgsql-10/bin/pg_ctl
repmgr.conf
-----------
node_id=11
node_name='PG1'
conninfo='host=postgres1 user=repmgr dbname=repmgr connect_timeout=2'
data_directory='/var/lib/pgsql/10/data'
use_replication_slots=yes
monitoring_history=yes
service_start_command = 'sudo /usr/pgsql-10/bin/pg_ctl 10 main start'
service_stop_command = 'sudo /usr/pgsql-10/bin/pg_ctl 10 main stop'
service_restart_command = 'sudo /usr/pgsql-10/bin/pg_ctl 10 main restart'
service_reload_command = 'sudo /usr/pgsql-10/bin/pg_ctl 10 main reload'
#service_start_command = 'sudo /usr/bin/systemctl start postgresql-10'
#service_stop_command = 'sudo /usr/bin/systemctl stop postgresql-10'
#service_restart_command = 'sudo /usr/bin/systemctl restart postgresql-10'
#service_reload_command = 'sudo /usr/bin/systemctl reload postgresql-10'
#service_promote_command = 'sudo /usr/pgsql-10/bin/pg_ctl promote'
repmgrd_service_start_command='sudo systemctl repmgr10 start'
repmgrd_service_stop_command='sudo systemctl repmgr10 stop'
promote_check_timeout = 15
failover=automatic
promote_command='/usr/pgsql-10/bin/repmgr standby promote -f /etc/repmgr/10/repmgr.conf --log-to-file'
follow_command='/usr/pgsql-10/bin/repmgr standby follow -f /etc/repmgr/10/repmgr.conf --log-to-file --upstream-node-id=%n'
log_file='/var/log/repmgr/repmgrd.log'
pg_bindir='/usr/pgsql-10/bin/'
Error-log:
---------
INFO: replication lag on this standby is 0 seconds
NOTICE: local node "PG2" (ID: 22) will be promoted to primary; current primary "PG1" (ID: 11) will be demoted to standby
NOTICE: stopping current primary node "PG1" (ID: 11)
NOTICE: issuing CHECKPOINT
DETAIL: executing server command "sudo /usr/pgsql-10/bin/pg_ctl 10 main stop"
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
INFO: checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")
DRY-RUN
repmgr -f /etc/repmgr/10/repmgr.conf standby switchover --siblings-follow --verbose --dry-run
SWITCHOVER
repmgr -f /etc/repmgr/10/repmgr.conf standby switchover --siblings-follow --verbose