Redis主从集群使用三台虚拟机各配置两台redis服务器实现三主三从集群服务—–Redis

[root@localhost ~]# ps -ef|grep redis
root       2585   2544  0 19:47 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6381.conf
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.129  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:8f:1b:2b  txqueuelen 1000  (Ethernet)
        RX packets 305  bytes 54134 (52.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 166  bytes 17055 (16.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 64  bytes 5568 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5568 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:55:d3:7b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 7min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
    Tasks: 2
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
1月 23 19:55:01 localhost.localdomain systemd[1]: Stopping firewalld - dynam...
1月 23 19:55:03 localhost.localdomain systemd[1]: Stopped firewalld - dynami...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[ERR] Wrong number of arguments for specified --cluster sub command
[root@localhost ~]#  192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385
bash: 192.168.92.129:6382: 未找到命令...
[root@localhost ~]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Could not connect to Redis at 192.168.92.129:6382: Connection refused
[root@localhost ~]# ps -ef|grep redis
root       2612      1  0 19:47 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root       3005   2544  0 20:00 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost ~]# ps -ef|grep redis
root       2612      1  0 19:47 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root       3034   2544  0 20:01 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# cd /myredis/cluster/
[root@localhost cluster]# vim redisCluster6382.conf 
[root@localhost cluster]# vim redisCluster6382.conf 
[root@localhost cluster]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost cluster]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost cluster]# redis-server /myredis/cluster/redisCluster6381.conf
[root@localhost cluster]# ps -ef|grep redis
root       3142      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6382 [cluster]
root       3154      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6381 [cluster]
root       3175   2544  0 20:07 pts/0    00:00:00 grep --color=auto redis
[root@localhost cluster]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.92.130:6384 to 192.168.92.129:6381
Adding replica 192.168.92.131:6386 to 192.168.92.130:6383
Adding replica 192.168.92.129:6382 to 192.168.92.131:6385
M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381
   slots:[0-5460] (5461 slots) master
S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382
   replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015
M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383
   slots:[5461-10922] (5462 slots) master
S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384
   replicates ee718fe879729ec1f961b08c4342c78537997ab4
M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385
   slots:[10923-16383] (5461 slots) master
S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386
   replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859
Can I set the above configuration? (type 'yes' to accept): 

[root@localhost ~]# ps -ef|grep redis
root       2585   2544  0 19:47 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6381.conf
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.129  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:8f:1b:2b  txqueuelen 1000  (Ethernet)
        RX packets 305  bytes 54134 (52.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 166  bytes 17055 (16.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 64  bytes 5568 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5568 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:55:d3:7b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 7min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
    Tasks: 2
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2024-01-23 19:45:32 CST; 8min ago
     Docs: man:firewalld(1)
 Main PID: 818 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─818 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

1月 23 19:45:32 localhost.localdomain systemd[1]: Starting firewalld - dynam...
1月 23 19:45:32 localhost.localdomain systemd[1]: Started firewalld - dynami...
1月 23 19:45:33 localhost.localdomain firewalld[818]: WARNING: AllowZoneDrif...
1月 23 19:55:01 localhost.localdomain systemd[1]: Stopping firewalld - dynam...
1月 23 19:55:03 localhost.localdomain systemd[1]: Stopped firewalld - dynami...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[ERR] Wrong number of arguments for specified --cluster sub command
[root@localhost ~]#  192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385
bash: 192.168.92.129:6382: 未找到命令...
[root@localhost ~]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Could not connect to Redis at 192.168.92.129:6382: Connection refused
[root@localhost ~]# ps -ef|grep redis
root       2612      1  0 19:47 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root       3005   2544  0 20:00 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost ~]# ps -ef|grep redis
root       2612      1  0 19:47 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root       3034   2544  0 20:01 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# cd /myredis/cluster/
[root@localhost cluster]# vim redisCluster6382.conf 
[root@localhost cluster]# vim redisCluster6382.conf 
[root@localhost cluster]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost cluster]# redis-server /myredis/cluster/redisCluster6382.conf
[root@localhost cluster]# redis-server /myredis/cluster/redisCluster6381.conf
[root@localhost cluster]# ps -ef|grep redis
root       3142      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6382 [cluster]
root       3154      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6381 [cluster]
root       3175   2544  0 20:07 pts/0    00:00:00 grep --color=auto redis
[root@localhost cluster]# redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.92.130:6384 to 192.168.92.129:6381
Adding replica 192.168.92.131:6386 to 192.168.92.130:6383
Adding replica 192.168.92.129:6382 to 192.168.92.131:6385
M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381
   slots:[0-5460] (5461 slots) master
S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382
   replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015
M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383
   slots:[5461-10922] (5462 slots) master
S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384
   replicates ee718fe879729ec1f961b08c4342c78537997ab4
M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385
   slots:[10923-16383] (5461 slots) master
S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386
   replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859
Can I set the above configuration? (type 'yes' to accept): 

[root@localhost ~]# redis-server /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.130  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::371e:c0c:3dd4:34b4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a5:ad:75  txqueuelen 1000  (Ethernet)
        RX packets 355870  bytes 70598878 (67.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 264373  bytes 85328961 (81.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3738  bytes 3291526 (3.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3738  bytes 3291526 (3.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# ps -ef|grep redis
root      10540      1  0 19:48 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root      10706  10461  0 20:01 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# vim /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# vim /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# ps -ef|grep redis
root      10840      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6383 [cluster]
root      10852      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6384 [cluster]
root      10864  10461  0 20:07 pts/0    00:00:00 grep --color=auto redis

[root@localhost ~]# redis-server /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.130  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::371e:c0c:3dd4:34b4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a5:ad:75  txqueuelen 1000  (Ethernet)
        RX packets 355870  bytes 70598878 (67.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 264373  bytes 85328961 (81.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3738  bytes 3291526 (3.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3738  bytes 3291526 (3.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# ps -ef|grep redis
root      10540      1  0 19:48 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root      10706  10461  0 20:01 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# vim /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# vim /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6383.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6384.conf 
[root@localhost ~]# ps -ef|grep redis
root      10840      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6383 [cluster]
root      10852      1  0 20:07 ?        00:00:00 redis-server 0.0.0.0:6384 [cluster]
root      10864  10461  0 20:07 pts/0    00:00:00 grep --color=auto redis

[root@localhost ~]# redis-server /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.131  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::c264:84a9:bc4f:4bf4  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::371e:c0c:3dd4:34b4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:73:71:a1  txqueuelen 1000  (Ethernet)
        RX packets 332356  bytes 30386511 (28.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 271765  bytes 92302137 (88.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3712  bytes 3702854 (3.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3712  bytes 3702854 (3.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# vim /myredis/cluster
cluster/         cluster6381.pid  
[root@localhost ~]# vim /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# vim /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ps -ef|grep redis
root      10257      1  0 19:49 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root      10578  10202  0 20:05 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-cli -a abc123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> quit
[root@localhost ~]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ps -ef|grep redis
root      10600      1  0 20:06 ?        00:00:00 redis-server 0.0.0.0:6385 [cluster]
root      10612      1  0 20:06 ?        00:00:00 redis-server 0.0.0.0:6386 [cluster]
root      10633  10202  0 20:06 pts/0    00:00:00 grep --color=auto redis

[root@localhost ~]# redis-server /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.92.131  netmask 255.255.255.0  broadcast 192.168.92.255
        inet6 fe80::c264:84a9:bc4f:4bf4  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::371e:c0c:3dd4:34b4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:73:71:a1  txqueuelen 1000  (Ethernet)
        RX packets 332356  bytes 30386511 (28.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 271765  bytes 92302137 (88.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3712  bytes 3702854 (3.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3712  bytes 3702854 (3.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# vim /myredis/cluster
cluster/         cluster6381.pid  
[root@localhost ~]# vim /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# vim /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ps -ef|grep redis
root      10257      1  0 19:49 ?        00:00:01 redis-server 0.0.0.0:6381 [cluster]
root      10578  10202  0 20:05 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# redis-cli -a abc123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> quit
[root@localhost ~]# redis-cli -a abc123 -p 6381
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6381> shutdown
not connected> quit
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6385.conf 
[root@localhost ~]# redis-server /myredis/cluster/redisCluster6386.conf 
[root@localhost ~]# ps -ef|grep redis
root      10600      1  0 20:06 ?        00:00:00 redis-server 0.0.0.0:6385 [cluster]
root      10612      1  0 20:06 ?        00:00:00 redis-server 0.0.0.0:6386 [cluster]
root      10633  10202  0 20:06 pts/0    00:00:00 grep --color=auto redis

redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386

 redis-cli -a abc123 --cluster create --cluster-replicas 1 192.168.92.129:6381 192.168.92.129:6382 192.168.92.130:6383 192.168.92.130:6384 192.168.92.131:6385 192.168.92.131:6386