Мне нужно поменять роли между двумя узлами.
Обстоятельство:
2 сервера:
основной: psql01 и резервный: psql02
После остановки psql01 psql02 становится новым основным. Через некоторое время запустите psql01
На psql01:
[-bash-4.2$ repmgr -f /var/lib/pgsql/repmgr/repmgr.conf cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+--------------+---------+----------------------+----------+----------+----------+----------+---------------------------------------------
1 | psql01 | primary | * running | | default | 100 | 7 | host=psql01 user=repmgr dbname=repmgr
2 | psql02 | standby | ! running as primary | | default | 100 | 8 | host=psql02 user=repmgr dbname=repmgr
WARNING: following issues were detected
- node "postgresql02" (ID: 2) is registered as standby but running as primary](url)
На psql02:
repmgr -f /var/lib/pgsql/repmgr/repmgr.conf cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+--------------+---------+-----------+----------+----------+----------+----------+---------------------------------------------
1 | psql01 | primary | ! running | | default | 100 | 7 | host=psql01 user=repmgr dbname=repmgr
2 | psql02 | primary | * running | | default | 100 | 8 | host=psql02 user=repmgr dbname=repmgr
WARNING: following issues were detected
- node "psql01" (ID: 1) is running but the repmgr node record is inactive
Я пытаюсь перевести свой старый основной в резервный режим с помощью следующих команд:
-bash-4.2$ repmgr -f /var/lib/pgsql/repmgr/repmgr.conf node service --action=stop --checkpoint
NOTICE: issuing CHECKPOINT
DETAIL: executing server command "sudo systemctl stop postgresql-11"
-bash-4.2$ repmgr -f /var/lib/pgsql/repmgr/repmgr.conf -d 'host=psql01 user=repmgr dbname=repmgr' node rejoin
ERROR: connection to database failed
DETAIL:
could not connect to server: Connection refused
Is the server running on host "psql01" (172.16.11.171) and accepting
TCP/IP connections on port 5432?
Что именно случилось? Если psql01 выйдет из строя, как я могу изменить роль на второстепенную?