Introduction to the

Set up three active and three slave Redis clusters in an environment with three VMS

  • Environment: 3 VMS Linux OS 192.168.26.129 192.168.26.130 192.168.26.131
  • Redis version: 5.0.4

steps

Redis installation

  1. IO /download Version 5.0.4
  2. Download the files and upload them to three VMS: Redis-5.0.4.tar. gz
  3. Decompress tar -zxvf redis-5.0.4.tar.gz
  4. Compile CD redis-5.0.4 switch to the corresponding folder and run the make command
  5. After installation and compilation, the SRC and conf folders are displayed in the decompressed file. Go to the SRC folder and run make install

Redis start

  1. Create folder 6379 6380 under redis-5.0.4
  2. Cp the redis.conf file under redis-5.0.4 to 6379 and 6380
  3. Conf vim redis.conf bind 192.168.26.129 protected-mode no port 6379 6380 daemonize 6380 Pid 6380 file to redis_6380.pid Release comment cluster-enabled yes release comment cluster-config-file Conf file nodes-6379.conf: open the comment cluster-node-timeout 15000
  4. Switch to the SRC file and run./redis-server /data/redis/redis-5.0.4/6379/redis.conf./redis-server / data/redis/redis – 5.0.4/6380 / redis. Conf

Summary: Each machine does this, so three machines start six instances of Redis

Create the cluster

For versions later than 5.0, run the redis-cli command to create a cluster and switch to the SRC file./redis-cli –cluster create 192.168.26.129:6379 192.168.26.129:6380 192.168.26.130:6379 192.168.26.130:6380 192.168.26.131:6379 192.168.26.131:6380 –cluster-replicas 1