При работе NAICE в схеме с резервированием используется кластер БД PostgreSQL. Для синхронизации используется Replication Manager for PostgreSQL clusters или далее repmanager.
Repmanager по умолчанию использует порт TCP:15432 для синхронизации.
О разворачивании NAICE в схеме с резервированием описано в инструкциях:
v1.1_3.4 Установка с резервированием (c использованием VRRP)
v1.1_3.5 Установка с резервированием (без использования VRRP)
Контейнер с СУБД PostgreSQL имеет свой номер для каждой ноды кластера. Он определяется в переменных при разворачивании кластера плейбуками Ansible.
Далее в документации будут использоваться наименования нод:
Каждая нода кластера имеет свою роль:
Все команды необходимо выполнять из под непривилегированного пользователя через "sudo". Обращение к контейнерам на ноде node_primary и node_standby выполняется разными командами. node_primary: sudo docker exec -it naice-postgres-1 <команда> node_standby: sudo docker exec -it naice-postgres-2 <команда> |
Зайти на первую ноду, указанную в node_primary, и выполнить команду sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show:
$ sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ------+------------+---------+-----------+------------+----------+----------+----------+--------------------------------------------------------------------------------------- 1001 | postgres-1 | primary | * running | | default | 100 | 1 | user=repmgr password=repmgr host=postgres-1 dbname=repmgr port=5432 connect_timeout=1 1002 | postgres-2 | standby | running | postgres-1 | default | 100 | 1 | user=repmgr password=repmgr host=postgres-2 dbname=repmgr port=5432 connect_timeout=1 |
Зайти на вторую ноду, указанную в node_standby, и выполнить команду sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show:
$ sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ------+------------+---------+-----------+------------+----------+----------+----------+--------------------------------------------------------------------------------------- 1001 | postgres-1 | primary | * running | | default | 100 | 1 | user=repmgr password=repmgr host=postgres-1 dbname=repmgr port=5432 connect_timeout=1 1002 | postgres-2 | standby | running | postgres-1 | default | 100 | 1 | user=repmgr password=repmgr host=postgres-2 dbname=repmgr port=5432 connect_timeout=1 |
Роль Primary может принадлежать как на первой, так и второй ноде - это не влияет на работоспособность кластера СУБД. |
Зайти на первую ноду, указанную в node_primary и выполнить команду:
sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster crosscheck |
Зайти на вторую ноду, указанную в node_standby и выполнить команду:
sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster crosscheck |
Результатом выполнения команд будет проверка состояния кластера, которая сопровождается выводом лога, в конце которого ожидается вывод:
debug1: Exit status 0 Name | ID | 1001 | 1002 ------------+------+------+------ postgres-1 | 1001 | * | * postgres-2 | 1002 | * | * |
$ sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster crosscheck debug1: OpenSSH_10.0p2 Debian-7, OpenSSL 3.5.1 1 Jul 2025 debug1: Reading configuration data /home/worker/.ssh/config debug1: /home/worker/.ssh/config line 1: Applying options for postgres-2 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to 100.123.0.109 [100.123.0.109] port 15432. debug1: Connection established. debug1: identity file /home/worker/.ssh/id_rsa type 0 debug1: identity file /home/worker/.ssh/id_rsa-cert type -1 debug1: identity file /home/worker/.ssh/id_ecdsa type -1 debug1: identity file /home/worker/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/worker/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/worker/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/worker/.ssh/id_ed25519 type -1 debug1: identity file /home/worker/.ssh/id_ed25519-cert type -1 debug1: identity file /home/worker/.ssh/id_ed25519_sk type -1 debug1: identity file /home/worker/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/worker/.ssh/id_xmss type -1 debug1: identity file /home/worker/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_10.0p2 Debian-7 debug1: Remote protocol version 2.0, remote software version OpenSSH_10.0p2 Debian-7 debug1: compat_banner: match: OpenSSH_10.0p2 Debian-7 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 100.123.0.109:15432 as 'worker' debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: mlkem768x25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: SSH2_MSG_KEX_ECDH_REPLY received debug1: Server host key: ssh-ed25519 SHA256:JeEGsFXqq6/nkIBh5357L0l3VcC8IKRFTJhfLrzo0ag debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: Host '[100.123.0.109]:15432' is known and matches the ED25519 host key. debug1: Found key in /home/worker/.ssh/known_hosts:1 debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: Sending SSH2_MSG_EXT_INFO debug1: expecting SSH2_MSG_NEWKEYS debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0> debug1: kex_ext_info_check_ver: ping@openssh.com=<0> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Will attempt key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE debug1: Will attempt key: /home/worker/.ssh/id_ecdsa debug1: Will attempt key: /home/worker/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/worker/.ssh/id_ed25519 debug1: Will attempt key: /home/worker/.ssh/id_ed25519_sk debug1: Will attempt key: /home/worker/.ssh/id_xmss debug1: Offering public key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE debug1: Server accepts key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE Authenticated to 100.123.0.109 ([100.123.0.109]:15432) using "publickey". debug1: channel 0: new session [client-session] (inactive timeout: 0) debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: filesystem debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 debug1: client_input_hostkeys: searching /home/worker/.ssh/known_hosts for [100.123.0.109]:15432 / (none) debug1: client_input_hostkeys: searching /home/worker/.ssh/known_hosts2 for [100.123.0.109]:15432 / (none) debug1: client_input_hostkeys: hostkeys file /home/worker/.ssh/known_hosts2 does not exist debug1: Remote: /home/worker/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Remote: /home/worker/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Sending environment. debug1: channel 0: setting env LANG = "en_US.UTF-8" debug1: Sending command: /opt/bitnami/postgresql/bin/repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster matrix --csv --terse -L NOTICE Learned new hostkey: RSA SHA256:ICTB2pWo5OM7TnpiPFSOan01ZWBfzziuEC1aii94JNk Learned new hostkey: ECDSA SHA256:xgEEQehSK0BNwPJ/QI5cKnOG7PPFW/2c4Wu6VVCniRc Adding new key for [100.123.0.109]:15432 to /home/worker/.ssh/known_hosts: ssh-rsa SHA256:ICTB2pWo5OM7TnpiPFSOan01ZWBfzziuEC1aii94JNk Adding new key for [100.123.0.109]:15432 to /home/worker/.ssh/known_hosts: ecdsa-sha2-nistp256 SHA256:xgEEQehSK0BNwPJ/QI5cKnOG7PPFW/2c4Wu6VVCniRc debug1: update_known_hosts: known hosts file /home/worker/.ssh/known_hosts2 does not exist debug1: pledge: fork debug1: OpenSSH_10.0p2 Debian-7, OpenSSL 3.5.1 1 Jul 2025 debug1: Reading configuration data /home/worker/.ssh/config debug1: /home/worker/.ssh/config line 1: Applying options for postgres-1 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to 100.123.0.105 [100.123.0.105] port 15432. debug1: Connection established. debug1: identity file /home/worker/.ssh/id_rsa type 0 debug1: identity file /home/worker/.ssh/id_rsa-cert type -1 debug1: identity file /home/worker/.ssh/id_ecdsa type -1 debug1: identity file /home/worker/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/worker/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/worker/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/worker/.ssh/id_ed25519 type -1 debug1: identity file /home/worker/.ssh/id_ed25519-cert type -1 debug1: identity file /home/worker/.ssh/id_ed25519_sk type -1 debug1: identity file /home/worker/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/worker/.ssh/id_xmss type -1 debug1: identity file /home/worker/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_10.0p2 Debian-7 debug1: Remote protocol version 2.0, remote software version OpenSSH_10.0p2 Debian-7 debug1: compat_banner: match: OpenSSH_10.0p2 Debian-7 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 100.123.0.105:15432 as 'worker' debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts: No such file or directory debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: mlkem768x25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: SSH2_MSG_KEX_ECDH_REPLY received debug1: Server host key: ssh-ed25519 SHA256:JeEGsFXqq6/nkIBh5357L0l3VcC8IKRFTJhfLrzo0ag debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts: No such file or directory debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: checking without port identifier debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts: No such file or directory debug1: load_hostkeys: fopen /home/worker/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory Warning: Permanently added '[100.123.0.105]:15432' (ED25519) to the list of known hosts. debug1: check_host_key: hostkey not known or explicitly trusted: disabling UpdateHostkeys debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: Sending SSH2_MSG_EXT_INFO debug1: expecting SSH2_MSG_NEWKEYS debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0> debug1: kex_ext_info_check_ver: ping@openssh.com=<0> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Will attempt key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE debug1: Will attempt key: /home/worker/.ssh/id_ecdsa debug1: Will attempt key: /home/worker/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/worker/.ssh/id_ed25519 debug1: Will attempt key: /home/worker/.ssh/id_ed25519_sk debug1: Will attempt key: /home/worker/.ssh/id_xmss debug1: Offering public key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE debug1: Server accepts key: /home/worker/.ssh/id_rsa RSA SHA256:0G2jNARWuHCusgBcgUXO5X6qN9qII5KqDeYdnkXhczE Authenticated to 100.123.0.105 ([100.123.0.105]:15432) using "publickey". debug1: channel 0: new session [client-session] (inactive timeout: 0) debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: network debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 debug1: Remote: /home/worker/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Remote: /home/worker/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Sending environment. debug1: channel 0: setting env LANG = "en_US.UTF-8" debug1: channel 0: setting env LC_MESSAGES = "POSIX" debug1: Sending command: /opt/bitnami/postgresql/bin/repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf -L NOTICE cluster show --csv --terse debug1: pledge: fork debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 5176, received 4540 bytes, in 0.2 seconds Bytes per second: sent 32459.6, received 28471.1 debug1: Exit status 0 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 5696, received 12744 bytes, in 0.4 seconds Bytes per second: sent 13716.4, received 30688.5 debug1: Exit status 0 Name | ID | 1001 | 1002 ------------+------+------+------ postgres-1 | 1001 | * | * postgres-2 | 1002 | * | * |
В кластере PostgreSQL можно выполнить смену роли ноды Standby на Primary.
Понижение роли ноды Primary невозможно. Механизм смены роли предполагает, что выполняется повышение роли ноды Standby до Primary, в результате чего нода, имеющая роль Primary автоматически понизит её до Standby. |
Перед сменой роли необходимо убедиться в том, что окружение подготовлено и смена роли возможна. Для этого необходимо выполнить команду:
# если standby - первая нода sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf standby switchover --dry-run # если standby - вторая нода sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf standby switchover --dry-run |
В случае успеха, команда должна завершиться выводом (приведён пример для node_standby):
debug1: Exit status 0 INFO: following shutdown command would be run on node "postgres-1": "/opt/bitnami/postgresql/bin/pg_ctl -o "--config-file="/opt/bitnami/postgresql/conf/postgresql.conf" --external_pid_file="/opt/bitnami/postgresql/tmp/postgresql.pid" --hba_file="/opt/bitnami/postgresql/conf/pg_hba.conf"" -w -D "/bitnami/postgresql/data" stop" INFO: parameter "shutdown_check_timeout" is set to 60 seconds INFO: prerequisites for executing STANDBY SWITCHOVER are met |
Команда: repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf standby switchover --dry-run только проверяет готовность к выполнению. Смена роли при этом не выполняется. |
Для смены роли необходимо выполнить команду на ноде имеющей роль Standby:
# если backup - первая нода sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf standby switchover # если backup - вторая нода sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf standby switchover |
В случае успешной смены роли ноды, в конце лога появится сообщение (пример для перевода мастерства на node_standby):
debug1: Exit status 0 NOTICE: current primary has been cleanly shut down at location 0/9000028 NOTICE: promoting standby to primary DETAIL: promoting server "postgres-2" (ID: 1002) using pg_promote() NOTICE: waiting up to 60 seconds (parameter "promote_check_timeout") for promotion to complete NOTICE: STANDBY PROMOTE successful DETAIL: server "postgres-2" (ID: 1002) was successfully promoted to primary [REPMGR EVENT] Node id: 1002; Event type: standby_promote; Success [1|0]: 1; Time: 2026-03-01 14:35:58.169608+07; Details: server "postgres-2" (ID: 1002) was successfully promoted to primary Looking for the script: /opt/bitnami/repmgr/events/execs/standby_promote.sh [REPMGR EVENT] will execute script '/opt/bitnami/repmgr/events/execs/standby_promote.sh' for the event [REPMGR EVENT::standby_promote] Node id: 1002; Event type: standby_promote; Success [1|0]: 1; Time: 2026-03-01 14:35:58.169608+07; Details: server "postgres-2" (ID: 1002) was successfully promoted to primary [REPMGR EVENT::standby_promote] Locking primary... [REPMGR EVENT::standby_promote] Unlocking standby... NOTICE: node "postgres-2" (ID: 1002) promoted to primary, node "postgres-1" (ID: 1001) demoted to standby [REPMGR EVENT] Node id: 1002; Event type: standby_switchover; Success [1|0]: 1; Time: 2026-03-01 14:35:58.698977+07; Details: node "postgres-2" (ID: 1002) promoted to primary, node "postgres-1" (ID: 1001) demoted to standby Looking for the script: /opt/bitnami/repmgr/events/execs/standby_switchover.sh [REPMGR EVENT] no script '/opt/bitnami/repmgr/events/execs/standby_switchover.sh' found. Skipping... NOTICE: switchover was successful DETAIL: node "postgres-2" is now primary and node "postgres-1" is attached as standby NOTICE: STANDBY SWITCHOVER has completed successfully |
При этом роль ноды, ранее бывшей Primary, будет понижена до Standby.
При выполнении команды проверки состояния кластера:
# Пример для node_primary: $ sudo docker exec -it naice-postgres-1 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ------+------------+---------+-----------+----------+----------+----------+----------+--------------------------------------------------------------------------------------- 1001 | postgres-1 | primary | * running | | default | 100 | 5 | user=repmgr password=repmgr host=postgres-1 dbname=repmgr port=5432 connect_timeout=1 1002 | postgres-2 | primary | - failed | ? | default | 100 | | user=repmgr password=repmgr host=postgres-2 dbname=repmgr port=5432 connect_timeout=1 WARNING: following issues were detected - unable to connect to node "postgres-2" (ID: 1002) HINT: execute with --verbose option to see connection error messages # Пример для node_standby: $ sudo docker exec -it naice-postgres-2 repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ------+------------+---------+---------------+--------------+----------+----------+----------+--------------------------------------------------------------------------------------- 1001 | postgres-1 | standby | ? unreachable | ? postgres-2 | default | 100 | | user=repmgr password=repmgr host=postgres-1 dbname=repmgr port=5432 connect_timeout=1 1002 | postgres-2 | primary | * running | | default | 100 | 4 | user=repmgr password=repmgr host=postgres-2 dbname=repmgr port=5432 connect_timeout=1 WARNING: following issues were detected - unable to connect to node "postgres-1" (ID: 1001) - node "postgres-1" (ID: 1001) is registered as an active standby but is unreachable HINT: execute with --verbose option to see connection error messages |
Данный вывод означает что соседняя нода кластера недоступна. Необходимо проверить:
# Пример для node_primary: $ sudo docker compose -f docker-compose.repmgr.yml ps -a postgres-1 NAME COMMAND SERVICE STATUS PORTS naice-postgres-1 "/opt/bitnami/script…" postgres-1 running (healthy) 0.0.0.0:15432->22/tcp, 0.0.0.0:5432->5432/tcp, :::15432->22/tcp, :::5432->5432/tcp # Пример для node_standby: $ sudo docker compose -f docker-compose.repmgr.yml ps -a postgres-2 NAME COMMAND SERVICE STATUS PORTS naice-postgres-2 "/opt/bitnami/script…" postgres-2 running (healthy) 0.0.0.0:15432->22/tcp, 0.0.0.0:5432->5432/tcp, :::15432->22/tcp, :::5432->5432/tcp |