[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): yes >>> Nodes configuration updated >>> Assign a different config epoch to each node >>> Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join . >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383 slots:[5461-10922] (5462 slots) master 1 additional replica(s) S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386 slots: (0 slots) slave replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382 slots: (0 slots) slave replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385 slots:[10923-16383] (5461 slots) master 1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384 slots: (0 slots) slave replicates ee718fe879729ec1f961b08c4342c78537997ab4 [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. [root@localhost cluster]# cd /myredis/cluster/ [root@localhost cluster]# ll 总用量 36 drwxr-xr-x. 2 root root 224 1月 23 20:12 appendonlydir -rw-r--r--. 1 root root 7189 1月 23 20:12 cluster6381.log -rw-r--r--. 1 root root 4044 1月 23 20:12 cluster6382.log -rw-r--r--. 1 root root 88 1月 23 20:07 dump6381.rdb -rw-r--r--. 1 root root 171 1月 23 20:12 dump6382.rdb -rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6381.conf -rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6382.conf -rw-r--r--. 1 root root 347 1月 23 19:36 redisCluster6381.conf -rw-r--r--. 1 root root 348 1月 23 20:04 redisCluster6382.conf[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): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
.
>>> Performing Cluster Check (using node 192.168.92.129:6381)
M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381
slots:[0-5460] (5461 slots) master
1 additional replica(s)
M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386
slots: (0 slots) slave
replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859
S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382
slots: (0 slots) slave
replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015
M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384
slots: (0 slots) slave
replicates ee718fe879729ec1f961b08c4342c78537997ab4
All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
All 16384 slots covered.
[root@localhost cluster]# cd /myredis/cluster/
[root@localhost cluster]# ll
总用量 36
drwxr-xr-x. 2 root root 224 1月 23 20:12 appendonlydir
-rw-r--r--. 1 root root 7189 1月 23 20:12 cluster6381.log
-rw-r--r--. 1 root root 4044 1月 23 20:12 cluster6382.log
-rw-r--r--. 1 root root 88 1月 23 20:07 dump6381.rdb
-rw-r--r--. 1 root root 171 1月 23 20:12 dump6382.rdb
-rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6381.conf
-rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6382.conf
-rw-r--r--. 1 root root 347 1月 23 19:36 redisCluster6381.conf
-rw-r--r--. 1 root root 348 1月 23 20:04 redisCluster6382.conf
[root@localhost cluster]# cd /myredis/cluster/ [root@localhost cluster]# ll 总用量 36 drwxr-xr-x. 2 root root 224 1月 23 20:12 appendonlydir -rw-r--r--. 1 root root 7189 1月 23 20:12 cluster6381.log -rw-r--r--. 1 root root 4044 1月 23 20:12 cluster6382.log -rw-r--r--. 1 root root 88 1月 23 20:07 dump6381.rdb -rw-r--r--. 1 root root 171 1月 23 20:12 dump6382.rdb -rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6381.conf -rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6382.conf -rw-r--r--. 1 root root 347 1月 23 19:36 redisCluster6381.conf -rw-r--r--. 1 root root 348 1月 23 20:04 redisCluster6382.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 3302 2544 0 20:15 pts/0 00:00:00 grep --color=auto redis [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> info replication # Replication role:master connected_slaves:1 slave0:ip=192.168.92.130,port=6384,state=online,offset=308,lag=1 master_failover_state:no-failover master_replid:e33ee80b0ca4bd8c4030f194d3b1b262f20f42b0 master_replid2:0000000000000000000000000000000000000000 master_repl_offset:308 second_repl_offset:-1 repl_backlog_active:1 repl_backlog_size:1048576 repl_backlog_first_byte_offset:1 repl_backlog_histlen:308 127.0.0.1:6381> cluster nodes 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383@16383 master - 0 1706012179829 3 connected 5461-10922 a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386@16386 slave 1fca4878cd2a2a4fe055003f53d53c84cb589859 0 1706012180000 3 connected 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382@16382 slave 30b1f7bfccd93049117e1dab1cd6385eaf800015 0 1706012178621 5 connected 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385@16385 master - 0 1706012180000 5 connected 10923-16383 ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381@16381 myself,master - 0 1706012180000 1 connected 0-5460 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384@16384 slave ee718fe879729ec1f961b08c4342c78537997ab4 0 1706012180837 1 connected 127.0.0.1:6381> cluster info cluster_state:ok cluster_slots_assigned:16384 cluster_slots_ok:16384 cluster_slots_pfail:0 cluster_slots_fail:0 cluster_known_nodes:6 cluster_size:3 cluster_current_epoch:6 cluster_my_epoch:1 cluster_stats_messages_ping_sent:642 cluster_stats_messages_pong_sent:657 cluster_stats_messages_sent:1299 cluster_stats_messages_ping_received:652 cluster_stats_messages_pong_received:642 cluster_stats_messages_meet_received:5 cluster_stats_messages_received:1299 total_cluster_links_buffer_limit_exceeded:0[root@localhost cluster]# cd /myredis/cluster/
[root@localhost cluster]# ll
总用量 36
drwxr-xr-x. 2 root root 224 1月 23 20:12 appendonlydir
-rw-r--r--. 1 root root 7189 1月 23 20:12 cluster6381.log
-rw-r--r--. 1 root root 4044 1月 23 20:12 cluster6382.log
-rw-r--r--. 1 root root 88 1月 23 20:07 dump6381.rdb
-rw-r--r--. 1 root root 171 1月 23 20:12 dump6382.rdb
-rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6381.conf
-rw-r--r--. 1 root root 1183 1月 23 20:12 nodes-6382.conf
-rw-r--r--. 1 root root 347 1月 23 19:36 redisCluster6381.conf
-rw-r--r--. 1 root root 348 1月 23 20:04 redisCluster6382.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 3302 2544 0 20:15 pts/0 00:00:00 grep --color=auto redis
[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> info replication
# Replication
role:master
connected_slaves:1
slave0:ip=192.168.92.130,port=6384,state=online,offset=308,lag=1
master_failover_state:no-failover
master_replid:e33ee80b0ca4bd8c4030f194d3b1b262f20f42b0
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:308
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:308
127.0.0.1:6381> cluster nodes
1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383@16383 master - 0 1706012179829 3 connected 5461-10922
a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386@16386 slave 1fca4878cd2a2a4fe055003f53d53c84cb589859 0 1706012180000 3 connected
2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382@16382 slave 30b1f7bfccd93049117e1dab1cd6385eaf800015 0 1706012178621 5 connected
30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385@16385 master - 0 1706012180000 5 connected 10923-16383
ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381@16381 myself,master - 0 1706012180000 1 connected 0-5460
69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384@16384 slave ee718fe879729ec1f961b08c4342c78537997ab4 0 1706012180837 1 connected
127.0.0.1:6381> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:642
cluster_stats_messages_pong_sent:657
cluster_stats_messages_sent:1299
cluster_stats_messages_ping_received:652
cluster_stats_messages_pong_received:642
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:1299
total_cluster_links_buffer_limit_exceeded:0