Experience: Network Redis prevent flash from the total amount for the primary synchronization

Redis prevent network synchronization flash full amount

When the network jitter Redis master synchronization occurs from the whole amount, if the data is large, then, plus the transmission time, Reload time to make the business a long time exception can be adjusted from the following parameters to effectively prevent the risk of network to bring flash.

1.repl-timeout

repl-timeout parameter value which is too small also redis replication will result in unsuccessful.

redis profile parameters repl-timeout is explained as follows:

# 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).

Three cases considered Replication Timeout:

1) slave angle, without receiving master SYNC rdb snapshot data transmitted in repl-timeout period, 
2) the angle Slave does not receive the packet or ping master sent repl-timeout.
3) master angle, do not receive a confirmation message REPCONF ACK repl-timeout time.

When the detected redis repl-timeout timeout (default 60s), will close the connection between the master and slave, redis slave initiate re-establishment request from the connected master.

For large data sets memory system can be increased repl-timeout parameter.

2.slave ping period

redis slave periodically send a ping command from the master, a time interval repl-ping-slave-period specified.

Thus, when setting the parameters, 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.

3.repl-backlog-size

When the primary server command spread, maser not only sends all the data replication buffer update command to all slave, but also write replication backlog. When reconnecting the disconnected slave to master, slave psync command will be sent (including the offset copied offset), the request partial resync. If the requested offset does not exist, then the total amount of the sync operation performed, corresponding to re-establish master-slave replication.

In order to avoid synchronization full amount of network instability.

Modify the parameters as follows:

config set repl-timeout 240
config set repl-backlog-size 524288000

Guess you like

Origin www.cnblogs.com/WIU1905/p/11802847.html