Architecture design:
master:s0
slave:s1、s2
1, the Redis installation, reference
https://www.cnblogs.com/jonban/p/9217221.html
2, Configuration
Edit redis.conf
Notes Host Bind
# bind 127.0.0.1
Configuration access password
requirepass password
Added as follows on the slave (s1, s2):
① slave master host and port
slaveof s0 6379
② slave master password
masterauth password
The results verify the connection master ( you need to start, reference the first step )
./redis-cli s0 -h -p 6379
Password, the machine password redis123.
auth redis123.
View
info replication
The results are as follows:
s0:6379> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=192.168.32.101,port=6379,state=online,offset=71,lag=0
slave1:ip=192.168.32.102,port=6379,state=online,offset=71,lag=0
master_repl_offset:71
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:2
repl_backlog_histlen:70
It may be used to the same manner as s1, s2 on verification
3, the configuration mode Sentinel
pending upgrade. . .
4、
Redis replication from the master configuration.