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

相关推荐

  • shell脚本编程3

    补充,shift使用方法 root@localhost wang]# cat jiaoben1.sh  #!/bin/bash echo "$1" echo "$*" shift echo "$1" echo &quot…

    Linux干货 2016-08-24
  • 第十周

    1、请详细描述CentOS系统的启动流程(详细到每个过程系统做了哪些事情) 1.POST 开机加电自检,对计算机的cpu,硬盘,内存等进行检测。 2.BIOS 对引导程序进行探测,并把控制权交给引导程序。 3.MBR Master bootloader record主引导程序.通常位于硬盘第一扇区/dev/hda(0,0)或/dev/sda(0,0). 此阶…

    Linux干货 2017-03-30
  • Find工具实例

      1、显示当前系统上root、fadora或user1用户的默认shell。         [root@localhost ~]# grep -E "^(root|fadora|user1)\>"&n…

    Linux干货 2016-11-27
  • Linux的发展史

    Linux的诞生 1987年荷兰阿姆斯特丹Vrije大学的Andrew S.Tanenbaum 教授为了让学生们更了解操作系统而参照Unix系统编写了Minix系统。在1988年芬兰赫尔辛基大学迎来了一位新生Linus Benedict Torvalds ,他在学习了Minix系统后,以此为平台和指导开发出了Linux。在1991年8月Linus Toval…

    Linux干货 2016-10-19
  • sed编辑器

    sed: Stream EDitor, 行编辑器;  用法: sed [option]… ‘script’ inputfile… script: ‘地址命令‘  常用选项: -n:不输出模式中的内容至屏幕; -e: 多点编辑; -f /PATH/TO/SCRIPT_F…

    Linux干货 2015-07-06
  • 进程管理

    进程概念 内核的功用:进程管理、文件系统、网络功能、内存管理、驱动程序、安全功能等 Process(进程):运行中的程序的一个副本,是被载入内存的一个指令集合 进程ID (Process ID ,PID )号码被用来标记各个进程 UID、GID、和SELinux语境决定对文件系统的存取和访问权限 通常从执行进程的用户来继承 存在生命周期 task struc…

    2017-05-09