Redis master and slave settings are much simpler than MySQL master and slave, let's take a look.
1.redis Configuration Master-Slave
Two servers: Master (192.168.31.105) and slave (192.168.31.112)
Install Redis and start with the steps described earlier
Master config file does not move
Add a row to the slave configuration file
Slaveof 192.168.31.105 6379
Masterauth passwd//If the Lord sets a password, add this line
Start master and slave, respectively
2. Testing Redis Master
Master on:
Redis-cli
>set K1 v1
>get K1
"V1"
On slave:
Redis-cli
>get K1
"V1"
3.Redis master-slave Other related configuration (can be used selectively)
Slave-read-only Yes//Let read-only, default is Yes
Repl-ping-slave-period 10//Set slave the frequency of pings to master, initiated every 10s
Repl-timeout 60//Set slave ping does not pass the master number of S after the timeout
Repl-disable-tcp-nodelay No//open tcp_nodelay, will use less bandwidth, but there will be delay, so it is recommended to close
Repl-backlog-size 1MB//sync Queue Length, Backuplog is a buffer of master, master will write the data to the buffer, slave will synchronize the data from the buffer after the master disconnects.
Repl-backlog-ttl 3600//Master disconnect, buffer expiration, default 1 hours
Slave-priority 100//Multiple Slave can be set priority, the lower the value of the higher priority, applied to the cluster, support slave switch to master, the highest priority will switch
Min-slaves-to-write 3//and used in conjunction with the following, it means that master found that there are more than 3 slave latency higher than 10s, then master will temporarily stop the write operation. If either of these values is 0, the function is turned off, and the default first value is 0.
Min-slaves-max-lag 10
This article is from the Linux OPS blog, so be sure to keep this source http://zhumy.blog.51cto.com/11647651/1829289
Redis Master-Slave