我们做数据库的负载均衡,使用的是 pgpool2框架工程 (主站+1个从站)。
昨天,我在测试服务器上得到了几个数据库错误,说--'。X列不存在'经过调试,我们发现主从复制已经停止或滞后,原因是什么?django迁移只在主服务器上完成,而在从服务器上没有完成。.pgppol仍然在向slave服务器发送读取查询。
我怎样才能避免这样的问题或 自动报警或通知 如果发生任何事情。
如果你使用的是流媒体模式(这是默认的)
master_slave_mode = on
# Activate master/slave mode
# (change requires restart)
您需要配置以下内容来检查复制状态。
# - Streaming -
sr_check_period = 10
# Streaming replication check period
# Disabled (0) by default
sr_check_user = 'nobody'
# Streaming replication check user
# This is neccessary even if you disable streaming
# replication delay check by sr_check_period = 0
sr_check_password = ''
# Password for streaming replication check user
# Leaving it empty will make Pgpool-II to first look for the
# Password in pool_passwd file before using the empty password
sr_check_database = 'postgres'
# Database name for streaming replication check
delay_threshold = 10000000
# Threshold before not dispatching query to standby node
# Unit is in bytes
# Disabled (0) by default
这里是这个功能的文档。https:/www.pgpool.netdocslatestenhtmlruntime-streaming-replication-check.html