Use the most stable version redis 5.0.7 (picture taken from the official website of the record)
Installation Environment centos 6.8 redis5.0.7 (host) in a table (to ensure that the host can be seen redis log) Two clones (slave)
Master-slave replication mainly modify redis.conf file to achieve results
There is no set master and slave master must log password 1,2,3 Amendment 4 increased from only two slave machine line
1. Modify any IP can access
bind 0.0.0.0
2. Modify off protection
protected-mode no
3 Modify open a daemon thread runs in the background redis
daemonize:yes
4. two slaves need to add a line
replicaof 192.168.52.129 6379 here is the host virtual machine IP and port number
After modification to perform colon wq to save and exit
Into redis bin directory for each virtual machine execute the following two commands to start
1. permanently turn off the firewall chkconfig iptables off
2. Start redis service ./redis-server /usr/local/redis/etc/redis.conf
Verify redis service is running successfully each virtual machine executing the following two commands
1. Go to the client ./redis-cli
2. master / copy information from info replication
The host can see the role as master slaves 2 ip and port information from the machine
Two slaves can see the role as a slave host information
Verify written data in two data from the host machine can read from the main building success
参考csdn https://blog.csdn.net/xch_yang/article/details/104019552