PostgreSQL的repmgr命令参考(2)
PostgreSQL的repmgr命令参考(2)
1 repmgr node status
显示节点基本信息和复制状态的概述。此命令必须在本地节点上运行。
[pg12@test1 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf node status
Node "test1":
PostgreSQL version: 12.9
Total data size: 24 MB
Conninfo: host=192.168.10.100 user=repmgr port=5432 dbname=postgres
Role: standby
WAL archiving: off
Archive command: (none)
Replication connections: 0 (of maximal 10)
Replication slots: 0 physical (of maximal 10; 0 missing)
Upstream node: test2 (ID: 2)
Replication lag: 0 seconds
Last received LSN: 0/33D3668
Last replayed LSN: 0/33D3668
[pg12@test2 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf node status
Node "test2":
PostgreSQL version: 12.9
Total data size: 24 MB
Conninfo: host=192.168.10.101 user=repmgr port=5432 dbname=postgres
Role: primary
WAL archiving: off
Archive command: (none)
Replication connections: 1 (of maximal 10)
Replication slots: 0 physical (of maximal 10; 0 missing)
Replication lag: n/a
2 repmgr node check
从复制的角度对节点执行一些运行状况检查。此命令必须在本地节点上运行。
[pg12@test1 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf node check
Node "test1":
Server role: OK (node is standby)
Replication lag: OK (0 seconds)
WAL archiving: OK (0 pending archive ready files)
Upstream connection: OK (node "test1" (ID: 1) is attached to expected upstream node "test2" (ID: 2))
Downstream servers: OK (this node has no downstream nodes)
Replication slots: OK (node has no physical replication slots)
Missing physical replication slots: OK (node has no missing physical replication slots)
Configured data directory: OK (configured "data_directory" is "/home/pg12/repmgr")
[pg12@test2 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf node check
Node "test2":
Server role: OK (node is primary)
Replication lag: OK (N/A - node is primary)
WAL archiving: OK (0 pending archive ready files)
Upstream connection: OK (N/A - node is primary)
Downstream servers: OK (1 of 1 downstream nodes attached)
Replication slots: OK (node has no physical replication slots)
Missing physical replication slots: OK (node has no missing physical replication slots)
Configured data directory: OK (configured "data_directory" is "/home/pg12/repmgr")
3 repmgr service status
此命令提供集群中所有活动节点的概览以及每个节点的repmgrd实例的状态。它可用于检查repmgr服务暂停和repmgr服务器取消暂停操作的结果。
[pg12@test1 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf service status
ID | Name | Role | Status | Upstream | repmgrd | PID | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+-------+---------+--------------------
1 | test1 | standby | running | test2 | running | 4304 | no | 0 second(s) ago
2 | test2 | primary | * running | | running | 13680 | no | n/a
[pg12@test2 repmgr]$ repmgr -f /home/pg12/conf/repmgr.conf service status
ID | Name | Role | Status | Upstream | repmgrd | PID | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+-------+---------+--------------------
1 | test1 | standby | running | test2 | running | 4304 | no | 0 second(s) ago
2 | test2 | primary | * running | | running | 13680 | no | n/a