创建redis-cluster集群6个redis容器创建好之后,选择其中的一个容器进入,进行redis-cluster集群创建
[root@mysql bin]# docker-enter f4c971ce2d84root@f4c971ce2d84:~# redis-cli -a 1234 --cluster create 192.168.112.136:8001 192.168.112.136:8002 192.168.112.136:8003 192.168.112.136:8004 192.168.112.136:8005 192.168.112.136:8006 --cluster-replicas 1Warning: 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 - 5460Master[1] -> Slots 5461 - 10922Master[2] -> Slots 10923 - 16383Adding replica 192.168.112.136:8005 to 192.168.112.136:8001Adding replica 192.168.112.136:8006 to 192.168.112.136:8002Adding replica 192.168.112.136:8004 to 192.168.112.136:8003>>> Trying to optimize slaves allocation for anti-affinity[WARNING] Some slaves are in the same host as their masterM: c9e549f4d04d4466d2550d1e027412304099b1f2 192.168.112.136:8001slots:[0-5460] (5461 slots) masterM: 0956927ee74737d5ff91a1885e77f94d531dab76 192.168.112.136:8002slots:[5461-10922] (5462 slots) masterM: d6321788b2717b4142390c158ba70ca758f70964 192.168.112.136:8003slots:[10923-16383] (5461 slots) masterS: 96d2cb55f163ecc13a714ba01d90348c1c3ad02f 192.168.112.136:8004replicates c9e549f4d04d4466d2550d1e027412304099b1f2S: 8a771c26a95e82d9a6818e372d7c0226937670ac 192.168.112.136:8005replicates 0956927ee74737d5ff91a1885e77f94d531dab76S: aa7c2f6173904973f041b35efc5200359188eb0f 192.168.112.136:8006replicates d6321788b2717b4142390c158ba70ca758f70964Can 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 clusterWaiting for the cluster to join.>>> Performing Cluster Check (using node 192.168.112.136:8001)M: c9e549f4d04d4466d2550d1e027412304099b1f2 192.168.112.136:8001slots:[0-5460] (5461 slots) master1 additional replica(s)M: 0956927ee74737d5ff91a1885e77f94d531dab76 192.168.112.136:8002slots:[5461-10922] (5462 slots) master1 additional replica(s)S: 96d2cb55f163ecc13a714ba01d90348c1c3ad02f 192.168.112.136:8004slots: (0 slots) slavereplicates c9e549f4d04d4466d2550d1e027412304099b1f2S: aa7c2f6173904973f041b35efc5200359188eb0f 192.168.112.136:8006slots: (0 slots) slavereplicates d6321788b2717b4142390c158ba70ca758f70964S: 8a771c26a95e82d9a6818e372d7c0226937670ac 192.168.112.136:8005slots: (0 slots) slavereplicates 0956927ee74737d5ff91a1885e77f94d531dab76M: d6321788b2717b4142390c158ba70ca758f70964 192.168.112.136:8003slots:[10923-16383] (5461 slots) master1 additional replica(s)[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.
上述命令执行之后,redis-cluster集群就搭建好了,下面是整个redis-cluster集群的架构图
文章插图
redis-cluster集群架构图
redis-cluster集群状态检查检查redis-cluster集群状态
root@f4c971ce2d84:~# redis-cli -a 1234 --cluster check 192.168.112.136:8001Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.192.168.112.136:8001 (c9e549f4...) -> 0 keys | 5461 slots | 1 slaves.192.168.112.136:8002 (0956927e...) -> 0 keys | 5462 slots | 1 slaves.192.168.112.136:8003 (d6321788...) -> 0 keys | 5461 slots | 1 slaves.[OK] 0 keys in 3 masters.0.00 keys per slot on average.>>> Performing Cluster Check (using node 192.168.112.136:8001)M: c9e549f4d04d4466d2550d1e027412304099b1f2 192.168.112.136:8001slots:[0-5460] (5461 slots) master1 additional replica(s)M: 0956927ee74737d5ff91a1885e77f94d531dab76 192.168.112.136:8002slots:[5461-10922] (5462 slots) master1 additional replica(s)S: 96d2cb55f163ecc13a714ba01d90348c1c3ad02f 192.168.112.136:8004slots: (0 slots) slavereplicates c9e549f4d04d4466d2550d1e027412304099b1f2S: aa7c2f6173904973f041b35efc5200359188eb0f 192.168.112.136:8006slots: (0 slots) slavereplicates d6321788b2717b4142390c158ba70ca758f70964S: 8a771c26a95e82d9a6818e372d7c0226937670ac 192.168.112.136:8005slots: (0 slots) slavereplicates 0956927ee74737d5ff91a1885e77f94d531dab76M: d6321788b2717b4142390c158ba70ca758f70964 192.168.112.136:8003slots:[10923-16383] (5461 slots) master1 additional replica(s)[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.
检查redis集群节点信息root@f4c971ce2d84:~# redis-cli -c -a 1234 -h 192.168.112.136 -p 8001192.168.112.136:8001> cluster nodes0956927ee74737d5ff91a1885e77f94d531dab76 192.168.112.136:8002@18002 master - 0 1603265855374 2 connected 5461-1092296d2cb55f163ecc13a714ba01d90348c1c3ad02f 192.168.112.136:8004@18004 slave c9e549f4d04d4466d2550d1e027412304099b1f2 0 1603265856080 4 connectedaa7c2f6173904973f041b35efc5200359188eb0f 192.168.112.136:8006@18006 slave d6321788b2717b4142390c158ba70ca758f70964 0 1603265855575 6 connected8a771c26a95e82d9a6818e372d7c0226937670ac 192.168.112.136:8005@18005 slave 0956927ee74737d5ff91a1885e77f94d531dab76 0 1603265855575 5 connectedd6321788b2717b4142390c158ba70ca758f70964 192.168.112.136:8003@18003 master - 0 1603265856382 3 connected 10923-16383c9e549f4d04d4466d2550d1e027412304099b1f2 192.168.112.136:8001@18001 myself,master - 0 1603265855000 1 connected 0-5460
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |晚春夜钓正当时,掌握5个“钻石技巧”,下杆就中鱼,可轻松爆护
- 痛经怎么办 7大食疗法让你月月轻松
- 月经不调吃什么 8大食疗方法让你月月轻松
- 6款轻松减肥茶,中医减肥茶利与弊
- CentOS7下利用Rancher搭建K8s集群
- 3款轻松瘦身的减肥茶,三叶减肥茶的副作用
- 接口测试很难吗?教你用Jmeter轻松搞定接口测试
- 深度对比docker和kubernetes的区别和联系
- 利用绿茶制作护肤茶水,绿茶护肤
- 轻松减肥的运动有哪些