Postgresql 主从复制滞后,但 pgpool 正在向两个数据库(主从)发送流量
Postgresql Master-slave replication lagged but pgpool was sending traffic to both db (master n slave)
我们使用pgpool2 framwork(master + 1 slave)做数据库负载均衡。
昨天我在测试服务器上遇到了一些数据库错误,说 - 'X 列不存在 '
调试后,我们发现主从复制已停止或滞后,因此 django 迁移仅在主服务器上完成,而没有在从服务器上完成。 pgppol 仍在向从属服务器发送读取查询。
如何避免此类问题或自动化以在发生任何事情时发出警报或通知。
如果您使用的是流式传输模式(默认)
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.net/docs/latest/en/html/runtime-streaming-replication-check.html
我们使用pgpool2 framwork(master + 1 slave)做数据库负载均衡。
昨天我在测试服务器上遇到了一些数据库错误,说 - 'X 列不存在 ' 调试后,我们发现主从复制已停止或滞后,因此 django 迁移仅在主服务器上完成,而没有在从服务器上完成。 pgppol 仍在向从属服务器发送读取查询。
如何避免此类问题或自动化以在发生任何事情时发出警报或通知。
如果您使用的是流式传输模式(默认)
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.net/docs/latest/en/html/runtime-streaming-replication-check.html