System Version: centos 7.2
redis Version: 5.0.5
Download: https://redis.io/download
server.1:192.168.0.1
server.2:192.168.0.2
server.3:192.168.0.3
Deployment instructions: redis three main three from the cluster, using three virtual machines per server, each from two redis service, respectively, to do master, slave
-----------------------------------------------------------------------------------------------
1, the basic installation environment dependence, the following command:
yum -y install gcc
2, the redis-5.0.5.tar.gz are uploaded to server1, server2, server3 and extract command is as follows:
takes -zxf redis-5.0.5.tar.gz
cd-repeat 5.0.5
make
3, in the src directory provides a compiled binary file, run the following command Redis:
src/redis-server
4. Create a directory to store cluster redis.conf file, the command is as follows:
mkidr cluster
cp redis.conf cluster/redis_6379.conf
cp redis.conf cluster/redis_6380.conf
5, modify redis.conf file, as follows:
the bind 10.246 . 186.143 # native IP Port 6379 # custom port, port to avoid conflict daemonize yes # running in the background the PidFile / sdb / Redis / redis_6379.pid # PID storage path, port number 6379 and the synchronization logfile / sdb / Redis / redis_6379. log #log storage path, and port number 6379 synchronized cluster - turn enabled yes # cluster cluster -node-timeout 5000 # default 15 seconds, five seconds into
6, start redis, the command is as follows:
cd /usr/local/redis/redis-5.0.5/src/
./redis-server /usr/local/redis/redis-5.0.5/cluster/redis_6380.conf
./redis-server /usr/local/redis/redis-5.0.5/cluster/redis_6379.conf
Check whether the service is started, ps -ef | grep redis
7, after the service starts, six single-point process, we need to create a cluster, where one the following command:
./redis-cli --cluster create 192.168.0.1:6379 192.168.0.1:6379 192.168.0.2:6379 192.168.0.2:6380 192.168.0.3:6380 192.168.0.3:6380 --cluster-replicas 1
After executing the above command, will pop up the following prompt, enter yes press Enter:
Can I set the above configuration? (type 'yes' to accept):
8, after the above operations are completed, the finished three redis three main configured, to connect any redis view the cluster, the command is as follows:
./redis-cli -h 192.168.0.1 -p 6379
cluster info View cluster information, cluster_know_nodes should show 6
See cluster nodes node status, should show three master, slave three