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

相关推荐

  • 20160801作业-用户和组

    http://note.youdao.com/yws/public/redirect/share?id=ba6a68550cd5c0ba5fd1cbfb66651916&type=false

    Linux干货 2016-08-08
  • 如何在微软云上搭建mysql主从

    大家好: 今天我分享下在生产环境的微软云服务器上如何搭建mysql主从: 环境如下图: 我把cnux06-testing设为Mysql主服务器,暂时没需求的cnux04-web1db2设为Mysql从服务器 1–首先要在master上开启binlog日志功能并使主从库中的 server-id保持不同 操作步骤如下: A: 先查看mysql的主目录…

    Linux干货 2017-02-14
  • N25期–第六周作业

    请详细总结vim编辑器的使用并完成以下练习题 1、 复制/etc/rc.d/rc.sysinit文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加#; %s@^[[:space:]]\{1,\}.*@#&@ 2、 复制/boot/grub/grub.conf至/tmp目录中,删除/tmp/grub.conf…

    Linux干货 2017-01-17
  • linux下解压命令大全

    .tar  解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— .gz 解压1:gunzip FileName.gz 解压2:gzip -d FileName.gz 压缩:gzip FileName .tar.gz 和 .t…

    Linux干货 2017-07-11
  • 用户操作详解(附图)

                    关于用户和组的基本操作命令     在linux的操作系统中,对于用户以及组的配置是及其常用的和重要的,其中包括了对于用户的添加,删除以及修改用户的…

    Linux干货 2016-08-05
  • 利用varnish构建httpd缓存服务器

    varnish如何存储缓存对象:     file: 单个文件;不支持持久机制;     malloc: 缓存在内存中;     persistent:基于文件的持久存储;(此方式不建议使用) vcl:配置缓存系统的缓存机制;【线程中缓存功…

    Linux干货 2016-06-20