一、经过pg_controldata输出,主库Database cluster state,Database cluster state为 in production, 备库为in archive recovery。ide
$PGHOME/bin/pg_controldata -D /PGdata函数
二、经过自带的函数pg_is_in_recovery,是备机则是true,主库是false进程
三、经过进程查看,显示wal sender或者walwrite的是主机,显示wal receiver的是备机it
ps -ef|grep walio