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

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

redis配置文件中对repl-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数据,
2)slave角度,在repl-timeout没有收到master发送的数据包或者ping。
3)master角度,在repl-timeout时间没有收到REPCONF ACK确认信息。

当redis检测到repl-timeout超时(默认值60s),将会关闭主从之间的连接,redis slave发起重新建立主从连接的请求。
对于内存数据集比较大的系统,可以增大repl-timeout参数。

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.

转自:http://mdba.cn/?p=816

原创文章,作者:s19930811,如若转载,请注明出处:http://www.178linux.com/2482

赞 (1)
s19930811s19930811
上一篇 2016-04-05 23:05
下一篇 2016-04-06 22:51

相关推荐

  • HA之corosync+pacemaker+crmsh

    高可用集群框架 图片转载之http://www.178linux.com/16656 实验拓扑: 两台节点服务器: node1     192.168.150.137     node1.com node2     192.168.150.138     node2.com nf…

    Linux干货 2017-01-18
  • 0809作业

    4、如何设置tab缩进为4个字符? 在/etc/vimrc中加入一行 set ts=4 保存退出 5、复制/etc/rc.d/init.d/functions文件至/tmp目录;替换/tmp/functions文件中的/etc/sysconfig/init为/var/log; :%s@/etc/sysconfig/init@/var/log@g 6、删除/t…

    Linux干货 2016-08-11
  • Linux用户和组管理及相关命令详解

        概要:在学习Linux的初级阶段,用户管理是基础管理的重要部分,任何命令的运行,系统的正常运转,均离不开用户管理的内容,本篇就为大家介绍下Linux用户管理的一些基础概念和一些基础命令的用法。内容主要分为以下三个部分:        &nbs…

    Linux干货 2016-08-02
  • 数据库基础

    数据库基础 一、数据模型 数据库模型图 1、层次模型、2、网状模型、 3、关系模型二维关系: 表:就是一个关系及属性的描述,如:学生(学好,姓名,性别,班级)       行:row, entity       列:colume,…

    Linux干货 2016-10-19
  • 马哥教育21期网络班—第9周课程+练习—-成长进行时–不退步

    1、写一个脚本,判断当前系统上所有用户的shell是否为可登录shell(即用户的shell不是/sbin/nologin);分别这两类用户的个数;通过字符串比较来实现; #!/bin/bash  declare -i other=0 declare -i nologin=0   &nbs…

    Linux干货 2016-09-05
  • linux操作系统rpm软件包管理

    软件包管理 软件包运行环境: API:Application Programming Interface     使用标准:POSIX:     源代码运行步骤:预处理(如处理注释)—>编译成汇编代码—>链接其他库文件 ABI:applicatio…

    2016-08-22