The principle of Redis master-slave replication:
The 1.slave server connects to the master database #端口, password, the Ip2.slave server sends the SYCN command #异步请求备份 the 3.master server is backed up to an. rdb file (Local database) #就是类似于做个镜像, but the master operation can still be net Written in the buffer inside the new version of Redis can record the backlog in memory is the location of the backup, the next slave downtime does not have all the backup, if it is master down, from the beginning of the backup cycle these steps, the main process fork a child process to take a snapshot, The main process is not affected the 4.master server transmits the. rdb file to the slave server #发送数据文件5. Slave service Let's import the. Rdb into the database #从库导入数据文件
Redis master server build reference previous article
Redis Master server config file on appendaof Yes
Build from the server and the primary server and start
Modify the configuration file from the server
Cd/opt/redis/conf
VI 6379.conf
SLAVEOF Primary server IP Port
Masterauth Authentication password for master server
3 OK verification
Primary server ip:192.168.56.17
From server ip:192.168.56.15
[[email protected] conf]# redis-cli-h 192.168.56.17192.168.56.17:6379> Auth 123456ok192.168.56.17:6379> set name Xiaomingok192.168.56.17:6379> Get Name "Xiaoming" 192.168.56.17:6379>
Verify from server
[[email protected] conf]# redis-cli-h 192.168.56.15192.168.56.15:6379> auth 123456ok192.168.56.15:6379> get Name "Xiaoming" 192.168.56.15:6379>
Ok no problem:
Description: From the server can not open AppendOnly Yes can also open to see the requirements
This article is from the "Brick Blog" blog, please be sure to keep this source http://wsxxsl.blog.51cto.com/9085838/1886004
Redis Master-slave replication