redis主从复制
redis主从复制
Setting up
Master - 7000
Slave 配置: replicaof 127.0.0.1 7000
Step1
start master
redis-server master.conf
start replica
redis-server replica.conf


Step2
check replca status
redis-cli -c -p 7000
info replication
127.0.0.1:7000> info replication |
Step3
write to master
redis-cli -c -p 7000
set name haibei |
read from replica
redis-cli -c -p 6379
get name |
Protecting the Master Instance Against Risk of Losing Some Writes
master can stop accepting writes if there are less than N replicas connected, having a lag less or equal than M seconds, as controlled by the min-replicas-to-write and min-replicas-max-lag options respectively.
# It is possible for a master to stop accepting writes if there are less than
# N replicas connected, having a lag less or equal than M seconds.
#
# The N replicas 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 replica, that is usually sent every second.
#
# 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 replicas
# are available, to the specified number of seconds.
#
# For example to require at least 3 replicas with a lag <= 10 seconds use:
#
# min-replicas-to-write 3
# min-replicas-max-lag 10
# It is possible for a master to stop accepting writes if there are less than |
How to Setup Redis Replication (with Cluster-Mode Disabled) in CentOS 8 – Part 1
https://www.tecmint.com/setup-redis-replication-in-centos-8/
Installing Redis and setting up Master - Slave Replication
https://bencane.com/2013/11/12/installing-redis-and-setting-up-master-slave-replication/