查看集群运行信息./repmgr service status
[kingbase@kingbase01 bin]$ ./repmgr service status
ID | Name | Role | Status | Upstream | repmgrd | PID | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+---------+---------+--------------------
1 | node1 | primary | * running | | running | 2274638 | no | n/a
2 | node2 | standby | running | node1 | running | 1559834 | no | 1 second(s) ago
3 | node3 | witness | * running | node1 | running | 2214783 | no | 0 second(s) ago
集群配置文件路径,要求主备配置文件一致,不一致将启动失败。
kingbase/data/es_rep.conf
命令行停止与启动集群
停止:./sys_monitor.sh stop
[kingbase@kingbase01 bin]$ ./sys_monitor.sh stop
2023-06-13 14:30:18 Ready to stop all DB ...
Service process "node_export" was killed at process 116837
Service process "postgres_ex" was killed at process 116838
.......
启动:./sys_monitor.sh start
[kingbase@kingbase01 bin]$ ./sys_monitor.sh start
2023-06-13 14:30:36 Ready to start all DB ...
2023-06-13 14:30:36 begin to start DB on "[172.16.1.1]".
waiting for server to start.... done.......
备份模式,还原到新模式
#备份模式demo
./sys_dump -Uusername -h 192.168.1.1 -d DBname -f /opt/demo.dmp -Fc -n demo
#将demo模式还原到public模式
./sys_restore -Uusername -h 192.168.1.1 -d DBname /opt/demo.dmp -Fc -g demo -G public
查询数据库集簇系统参数
SELECT name,setting from sys_settings;
查询当前最大连接数
SELECT setting AS "最大连接数" FROM pg_settings WHERE name = 'max_connections';