Slave Replication) 详解(4)

复制缓冲区大小,这是一个环形复制缓冲区,用来保存最新复制的命令。这样在slave离线的时候,不需要完全复制master的数据,如果可以执行部分同步,只需要把缓冲区的部分数据复制给slave,就能恢复正常复制状态。缓冲区的大小越大,slave离线的时间可以更长,复制缓冲区只有在有slave连接的时候才分配内存。没有slave的一段时间,内存会被释放出来,默认1m。

# Set the replication backlog size. The backlog is a buffer that accumulates

# slave data when slaves are disconnected for some time, so that when a slave

# wants to reconnect again, often a full resync is not needed, but a partial

# resync is enough, just passing the portion of data the slave missed while

# disconnected.

#设置复制backlog大小。backlog是一个缓冲器(buffer)当slave断开一段时间时积累slave数据,以便当slave想要再次重新连接时,通常不需要再“完全同步(full resync)”,而是“部分再同步(partial resync)”就足够了,仅仅传输slave在断开连接时错失的那部分数据(余下的)即可。

#

# The bigger the replication backlog, the longer the time the slave can be

# disconnected and later be able to perform a partial resynchronization.

#复制backlog越大,slave可以断开连接的时间就越长,之后就可以执行”部分重新同步(partial resynchronization)“。

# The backlog is only allocated once there is at least a slave connected. 只有在至少有一个slave连接时才分配backlog。

#

# repl-backlog-size 1mb

# After a master has no longer connected slaves for some time, the backlog

# will be freed. The following option configures the amount of seconds that

# need to elapse, starting from the time the last slave disconnected, for

# the backlog buffer to be freed.

# master没有slave一段时间会释放复制缓冲区的内存,repl-backlog-ttl用来设置该时间长度。单位为秒。

#在master已经不再连接slave一段时间后,backlog将被释放。 以下选项配置需要经过的秒数,从最后一个slave服务器断开的时间开始,backlog缓冲区被释放。

# A value of 0 means to never release the backlog. 值为0表示永不释放backlog

#

# repl-backlog-ttl 3600

---------------------------------

# 当master不可用,Sentinel会根据slave的优先级选举一个master。最低的优先级的slave,当选master。而配置成0,永远不会被选举。

# The slave priority is an integer number published by Redis in the INFO output.

# It is used by Redis Sentinel in order to select a slave to promote into a

# master if the master is no longer working correctly.

#slave优先级是由Redis在INFO输出中发布的整数。 它由Redis Sentinel使用,以便选择slave,如果master不再正常工作,则升级为主设备。

# A slave with a low priority number is considered better for promotion, so

# for instance if there are three slaves with priority 10, 100, 25 Sentinel will

# pick the one with priority 10, that is the lowest.

#具有低优先级编号的slave被认为更好地用于提升,因此例如如果存在具有优先级10,100,25的三个从设备,则哨兵将选择具有优先级10,即最低的那个。

# However a special priority of 0 marks the slave as not able to perform the

# role of master, so a slave with priority of 0 will never be selected by

# Redis Sentinel for promotion.

#然而,0的特殊优先级标志着slave不能执行主设备的角色,因此优先级为0的从设备将不会被Redis Sentinel选择用于升级。

# By default the priority is 100.

slave-priority 100

Slave Replication) 详解

-----------------------------------------

#

# It is possible for a master to stop accepting writes if there are less than

# N slaves connected, having a lag less or equal than M seconds.

#如果连接少于N个slave,具有小于或等于M秒的滞后,则master可以停止接受写入。

# The N slaves need to be in "online" state.

#

# The lag in seconds, that must be <= the specified value, is calculated from

# the last ping received from the slave, that is usually sent every second.

#以秒为单位的滞后,必须小于指定值,根据从slave接收的最后一次ping计算,通常每秒发送一次。

# This option does not GUARANTEE that N replicas will accept the write, but

# will limit the window of exposure for lost writes in case not enough slaves

# are available, to the specified number of seconds.

#此选项不保证N个副本将接受写入,但会在没有足够的slave可用的情况下,将丢失写入的曝光窗口限制为指定的秒数。

# For example to require at least 3 slaves with a lag <= 10 seconds use:  例如,至少需要3个slave,lag小于10s

#

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/58b3b5a4db60b2caeb1fbc689fc5c447.html