[root@shell bin]# ./redis-benchmark -a 123456 -h 192.168.127.133 -p 6371 -t set,get -r 100000 -n 100000 -c 1000
Error from server: MOVED 10951 192.168.127.135:6375 -nan)
[root@shell bin]#
[root@shell bin]#
[root@shell bin]# /usr/local/redis/bin/redis-cli -a 123456 --cluster check 192.168.127.135:6376
Warning: Using a password with ‘-a’ or ‘-u’ option on the command line interface may not be safe.
192.168.127.135:6375 (548be66a…) -> 1 keys | 5461 slots | 1 slaves.
192.168.127.134:6373 (37c69a3f…) -> 0 keys | 5462 slots | 1 slaves.
192.168.127.133:6371 (d01156fb…) -> 2310 keys | 5461 slots | 1 slaves.
[OK] 2311 keys in 3 masters.
0.14 keys per slot on average.
Performing Cluster Check (using node 192.168.127.135:6376)
S: 473fcfc96baae1acd92a1f2d846d9ad5c5083f70 192.168.127.135:6376
slots: (0 slots) slave
replicates 37c69a3fbc9cbdb59b8273574864b8092dcf7a75
M: 548be66a8e0b63d30f5d4b49b260dba8ca18a878 192.168.127.135:6375
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
M: 37c69a3fbc9cbdb59b8273574864b8092dcf7a75 192.168.127.134:6373
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
M: d01156fbb000437e1709c5a3880d6fcd4581efd2 192.168.127.133:6371
slots:[0-5460] (5461 slots) master
1 additional replica(s)
S: e9e425f87dd17f4b85fa4c987efa0f47f1868e37 192.168.127.133:6372
slots: (0 slots) slave
replicates 548be66a8e0b63d30f5d4b49b260dba8ca18a878
S: 9c8fc9e01c97a4261cc04b0e3d6912cade164fdd 192.168.127.134:6374
slots: (0 slots) slave
replicates d01156fbb000437e1709c5a3880d6fcd4581efd2
[OK] All nodes agree about slots configuration.Check for open slots…
Check slots coverage…
[OK] All 16384 slots covered.
[root@shell bin]# /usr/local/redis/bin/redis-cli -a 123456 --cluster check 192.168.127.135:6375
Warning: Using a password with ‘-a’ or ‘-u’ option on the command line interface may not be safe.
192.168.127.135:6375 (548be66a…) -> 1 keys | 5461 slots | 1 slaves.
192.168.127.134:6373 (37c69a3f…) -> 0 keys | 5462 slots | 1 slaves.
192.168.127.133:6371 (d01156fb…) -> 2310 keys | 5461 slots | 1 slaves.
[OK] 2311 keys in 3 masters.
0.14 keys per slot on average.Performing Cluster Check (using node 192.168.127.135:6375)
M: 548be66a8e0b63d30f5d4b49b260dba8ca18a878 192.168.127.135:6375
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
S: 473fcfc96baae1acd92a1f2d846d9ad5c5083f70 192.168.127.135:6376
slots: (0 slots) slave
replicates 37c69a3fbc9cbdb59b8273574864b8092dcf7a75
S: 9c8fc9e01c97a4261cc04b0e3d6912cade164fdd 192.168.127.134:6374
slots: (0 slots) slave
replicates d01156fbb000437e1709c5a3880d6fcd4581efd2
M: 37c69a3fbc9cbdb59b8273574864b8092dcf7a75 192.168.127.134:6373
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
M: d01156fbb000437e1709c5a3880d6fcd4581efd2 192.168.127.133:6371
slots:[0-5460] (5461 slots) master
1 additional replica(s)
S: e9e425f87dd17f4b85fa4c987efa0f47f1868e37 192.168.127.133:6372
slots: (0 slots) slave
replicates 548be66a8e0b63d30f5d4b49b260dba8ca18a878
[OK] All nodes agree about slots configuration.Check for open slots…
Check slots coverage…
[OK] All 16384 slots covered.
[root@shell bin]# ./redis-benchmark -a 123456 -h 192.168.127.134 -p 6373 -t set,get -r 100000 -n 100000 -c 1000
Error from server: MOVED 416 192.168.127.133:6371l: -nan)
[root@shell bin]#
192.168.127.133上执行:
[root@localhost bin]# /usr/local/redis/bin/redis-cli -c -a 123456 -h 192.168.127.135 -p 6376
Warning: Using a password with ‘-a’ or ‘-u’ option on the command line interface may not be safe.
192.168.127.135:6376> cluster nodes
548be66a8e0b63d30f5d4b49b260dba8ca18a878 192.168.127.135:6375@16375 master - 0 1623935231000 5 connected 10923-16383
37c69a3fbc9cbdb59b8273574864b8092dcf7a75 192.168.127.134:6373@16373 master - 0 1623935233189 3 connected 5461-10922
d01156fbb000437e1709c5a3880d6fcd4581efd2 192.168.127.133:6371@16371 master - 0 1623935234206 1 connected 0-5460
e9e425f87dd17f4b85fa4c987efa0f47f1868e37 192.168.127.133:6372@16372 slave 548be66a8e0b63d30f5d4b49b260dba8ca18a878 0 1623935233000 5 connected
9c8fc9e01c97a4261cc04b0e3d6912cade164fdd 192.168.127.134:6374@16374 slave d01156fbb000437e1709c5a3880d6fcd4581efd2 0 1623935232169 1 connected
473fcfc96baae1acd92a1f2d846d9ad5c5083f70 192.168.127.135:6376@16376 myself,slave 37c69a3fbc9cbdb59b8273574864b8092dcf7a75 0 1623935232000 3 connected
192.168.127.135:6376> 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:3
cluster_stats_messages_ping_sent:21896
cluster_stats_messages_pong_sent:21886
cluster_stats_messages_meet_sent:1
cluster_stats_messages_sent:43783
cluster_stats_messages_ping_received:21886
cluster_stats_messages_pong_received:21897
cluster_stats_messages_received:43783
集群主机都能互相ping通,防火墙都关闭了。
[root@localhost bin]# ./redis-server -v
Redis server v=6.2.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=960301713156afd9