redis主从复制(3)— 复制超时

前两篇[1]关于redis主从复制的文章解释了一些因为slave replication buffer或者replication backlog参数的错误配置(或者默认参数值)导致主从复制中断的现象。redis里面的repl-timeout参数值也太小也将会导致复制不成功。top redis headaches for devops – replication timeout详细解释了因为复制超时导致复制中断的现象。

# The following option sets the replication timeout for:
# 1) Bulk transfer I/O during SYNC, from the point of view of slave.
# 2) Master timeout from the point of view of slaves (data, pings).
# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings).

1)slave角度,如果在repl-timeout时间内没有收到master SYNC传输的rdb snapshot数据,
3)master角度,在repl-timeout时间没有收到REPCONF ACK确认信息。

当redis检测到repl-timeout超时(默认值60s),将会关闭主从之间的连接,redis slave发起重新建立主从连接的请求。

2、slave ping period
另外,需要注意,redis slave会定期从master发送ping命令,时间间隔repl-ping-slave-period指定。
因而,设置参数时, repl-timeout > repl-ping-slave-period。

# Slaves send PINGs to server in a predefined interval.  The default value is 10 seconds.
# repl-ping-slave-period 10

# It is important to make sure that this value is greater than the values pecified for repl-ping-slave-period otherwise a timeout will be detected every time there is low traffic between the master and the slave.
此条目发表在redis分类目录,贴了, 标签。将固定链接加入收藏夹。


电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.