Skip to content

Files

Latest commit

 Cannot retrieve latest commit at this time.

History

History
60 lines (34 loc) · 2.08 KB

20110511_01.md

File metadata and controls

60 lines (34 loc) · 2.08 KB

PostgreSQL replication monitor

作者

digoal

日期

2011-05-11

标签

PostgreSQL , 监控 , nagios , replication


背景

PostgreSQL的 stream replication延迟一般来说受到以下几方面的影响 :

1. primary 和 standby之间通讯的网络质量 .

2. primary 的 负载 .

3. standby 的 负载 .

4. standby的在查询事务长度以及配置参数 如 max_standby_archive_delay,max_standby_streaming_delay .

同步的情况可以从主节点和STANDBY节点的以下函数或统计视图获取:

primary :

pg_current_xlog_location()  
  
9.1版本增加的统计视图 : pg_stat_replication  

standby :

pg_last_xlog_receive_location  
pg_last_xlog_replay_location  

1. 主节点和STANDBY节点之间网络质量问题的表象:

sent_location 和 pg_last_xlog_receive_location的差别比较大.

2. primary 的 负载压力比较大的表象:

pg_current_xlog_location 和 sent_location的差别比较大.

3.standby 的 负载压力比较大的表象 :

pg_last_xlog_receive_location 和 pg_last_xlog_replay_location 的差别比较大。

4. standby的在查询事务长度以及配置参数 如 max_standby_archive_delay,max_standby_streaming_delay 配置过大或长事务且与APPLY的数据有冲突时的表象 :

pg_last_xlog_receive_location 和 pg_last_xlog_replay_location 的差别比较大。

Count