##################
添加从库点给指定主库:
[[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7004 192.168.31.33:7001 --cluster-slave --cluster-master-id 06f1a071ffac504d14f6448fd08bc56a12ee4c2e Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Adding node 192.168.31.33:7004 to cluster 192.168.31.33:7001 >>> Performing Cluster Check (using node 192.168.31.33:7001) M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001 slots:[0-5460] (5461 slots) master M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002 slots:[5461-10922] (5462 slots) master M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003 slots:[10923-16383] (5461 slots) master [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. >>> Send CLUSTER MEET to node 192.168.31.33:7004 to make it join the cluster. Waiting for the cluster to join >>> Configure node as replica of 192.168.31.33:7001. [OK] New node added correctly. [[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7005 192.168.31.33:7002 --cluster-slave --cluster-master-id 3b2010b088f81db2dbae5f674f133aeef293d2e8 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Adding node 192.168.31.33:7005 to cluster 192.168.31.33:7002 >>> Performing Cluster Check (using node 192.168.31.33:7002) M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002 slots:[5461-10922] (5462 slots) master S: 930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004 slots: (0 slots) slave replicates 06f1a071ffac504d14f6448fd08bc56a12ee4c2e M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003 slots:[10923-16383] (5461 slots) master M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001 slots:[0-5460] (5461 slots) master 1 additional replica(s) [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. >>> Send CLUSTER MEET to node 192.168.31.33:7005 to make it join the cluster. Waiting for the cluster to join >>> Configure node as replica of 192.168.31.33:7002. [OK] New node added correctly. [[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7006 192.168.31.33:7003 --cluster-slave --cluster-master-id 331628fcc89591eafd378d5c4bf15c67be4a60d7 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Adding node 192.168.31.33:7006 to cluster 192.168.31.33:7003 >>> Performing Cluster Check (using node 192.168.31.33:7003) M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003 slots:[10923-16383] (5461 slots) master M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002 slots:[5461-10922] (5462 slots) master 1 additional replica(s) S: 3fd90616dada7055d874dc92b6c5ef15fc060b8e 192.168.31.33:7005 slots: (0 slots) slave replicates 3b2010b088f81db2dbae5f674f133aeef293d2e8 M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001 slots:[0-5460] (5461 slots) master 1 additional replica(s) S: 930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004 slots: (0 slots) slave replicates 06f1a071ffac504d14f6448fd08bc56a12ee4c2e [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. >>> Send CLUSTER MEET to node 192.168.31.33:7006 to make it join the cluster. Waiting for the cluster to join >>> Configure node as replica of 192.168.31.33:7003. [OK] New node added correctly. [[email protected] redis_7001]$
查看集群节点信息:
127.0.0.1:7001> cluster nodes 930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004@17004 slave 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 0 1676509675000 1 connected 3fd90616dada7055d874dc92b6c5ef15fc060b8e 192.168.31.33:7005@17005 slave 3b2010b088f81db2dbae5f674f133aeef293d2e8 0 1676509676153 2 connected 3c2b55d4b06fc23510bfe94d803763e6f1c72d2a 192.168.31.33:7006@17006 slave 331628fcc89591eafd378d5c4bf15c67be4a60d7 0 1676509674133 3 connected 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002@17002 master - 0 1676509673122 2 connected 5461-10922 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001@17001 myself,master - 0 1676509674000 1 connected 0-5460 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003@17003 master - 0 1676509675143 3 connected 10923-16383
查看集群信息:
127.0.0.1:7001> 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:3 cluster_my_epoch:1 cluster_stats_messages_ping_sent:1924 cluster_stats_messages_pong_sent:1939 cluster_stats_messages_sent:3863 cluster_stats_messages_ping_received:1936 cluster_stats_messages_pong_received:1924 cluster_stats_messages_meet_received:3 cluster_stats_messages_received:3863 total_cluster_links_buffer_limit_exceeded:0
#################################
标签:node,31.33,redis,192.168,cluster,集群,master,slots,搭建 From: https://www.cnblogs.com/igoodful/p/17125481.html