打赏

pgpool集群命令

pgpool常用命令

(1.) 服务命令

# 停止pgpool
service pgpool stop

# 查看pgpool状态
service pgpool status

# 启动pgpool
service pgpool start

# 查看postgresql状态
service postgresql-11 restart

# 查看postgresql主从
ps -ef |grep wal

# 查看watch dog信息
pcp_watchdog_info -h 127.0.0.1 -p 59898 -U postgres

-----------------------------------------------------------------------
psql -h 192.10.2.3 -p 56432 -d test -U test

\l   # 查看数据库
\dt  # 查看表
\c xx  # 切换库
-----------------------------------------------------------------------
# 查看服务日志
journalctl -u pgpool.service --no-pager  --since "2020-01-31 10:57:00"

journalctl -u postgresql-11.service --no-pager  --since "2020-01-31 10:57:00"

journalctl -f

journalctl --since "2020-01-10 17:15:00"

journalctl --since 09:00 --until "1 hour ago"

journalctl _PID=8088 

(2.) pgpool常用命令

# 执行在线恢复
pcp_recovery_node -h 192.2.2.4 -p 9898 -U postgres -n 0 -v -d

# 从 pgpool 提升一个节点
pcp_promote_node -v -d  -h 192.168.56.100 -p 9898 -U pgpool -n 1

# 从 pgpool 分离一个节点
pcp_detach_node -n 0 -U postgres -p 9898 -h 192.20.2.124

# 给 pgpool 关联一个节点
pcp_attach_node -v -d -n 0 -U postgres -p 9898 -h 192.2.2.12

# 获取 pgpool 节点数量
pcp_node_count -v -d -U postgres -p 9898 -h 192.2.2.124

# 获取 pgpool 节点信息
pcp_node_info -v -d  -n 0 -U postgres -p 9898 -h 192.2.2.12

# 获取 pgpool 的连接池状态
pcp_pool_status -v -d  -U postgres -p 9898 -h 192.2.2.12

# 查看 pgpool watchdog 信息
pcp_watchdog_info -v -d  -U postgres -p 9898 -h 192.2.2.12

# 从节点同步主节点数据,注意目录权限和属主
pg_basebackup -h 192.20.32.14 -p 5432 -U repl -Fp -Pv -Xs -R -D /usr/postgresql-11/data
posted @ 2022-01-03 16:59  苍山落暮  阅读(866)  评论(0编辑  收藏  举报