pgsql查看主备节点的方法

1、通过pg_controldata输出,主库Database cluster state,Database cluster state为 in production, 备库为in archive recovery。

$PGHOME/bin/pg_controldata -D /PGdata

2、通过自带的函数pg_is_in_recovery,是备机则是true,主库是false

3、通过进程查看,显示wal sender或者walwrite的是主机,显示wal receiver的是备机

ps -ef|grep wal

猜你喜欢

转载自blog.51cto.com/2012ivan/2605435