配置cluster

各个节点安装启动好后,从任何一节点创建集群:

# /data/lnmp/6381/bin/redis-trib.rb create --replicas 1 192.168.1.205:6381 192.168.1.206:6381 192.168.1.207:6381 192.168.1.205:6382 192.168.1.206:6382 192.168.1.207:6382
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.1.207:6381
192.168.1.206:6381
192.168.1.205:6381
Adding replica 192.168.1.206:6382 to 192.168.1.207:6381
Adding replica 192.168.1.207:6382 to 192.168.1.206:6381
Adding replica 192.168.1.205:6382 to 192.168.1.205:6381
M: b4ee0dac81bc99bc2e5f93888503239636e728e4 192.168.1.205:6381
   slots:10923-16383 (5461 slots) master
M: e1ed22a04537e50908938ad924726cee7b9ffdad 192.168.1.206:6381
   slots:5461-10922 (5462 slots) master
M: 2b9d4483cf885d796aa87518f457ba8e878cb061 192.168.1.207:6381
   slots:0-5460 (5461 slots) master
S: fb5e9a6a2f4be5c41b166e5dac1e953be73909ba 192.168.1.205:6382
   replicates b4ee0dac81bc99bc2e5f93888503239636e728e4
S: 850a1ed8e723b4a80a92a1198b84689e9026a08e 192.168.1.206:6382
   replicates 2b9d4483cf885d796aa87518f457ba8e878cb061
S: 6ad8e7bdcfaed6acac134b7a07e7d291db44c307 192.168.1.207:6382
   replicates e1ed22a04537e50908938ad924726cee7b9ffdad
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.1.205:6381)
M: b4ee0dac81bc99bc2e5f93888503239636e728e4 192.168.1.205:6381
   slots:10923-16383 (5461 slots) master
M: e1ed22a04537e50908938ad924726cee7b9ffdad 192.168.1.206:6381
   slots:5461-10922 (5462 slots) master
M: 2b9d4483cf885d796aa87518f457ba8e878cb061 192.168.1.207:6381
   slots:0-5460 (5461 slots) master
M: fb5e9a6a2f4be5c41b166e5dac1e953be73909ba 192.168.1.205:6382
   slots: (0 slots) master
   replicates b4ee0dac81bc99bc2e5f93888503239636e728e4
M: 850a1ed8e723b4a80a92a1198b84689e9026a08e 192.168.1.206:6382
   slots: (0 slots) master
   replicates 2b9d4483cf885d796aa87518f457ba8e878cb061
M: 6ad8e7bdcfaed6acac134b7a07e7d291db44c307 192.168.1.207:6382
   slots: (0 slots) master
   replicates e1ed22a04537e50908938ad924726cee7b9ffdad
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

检测节点:

# /data/lnmp/6381/bin/redis-trib.rb check 192.168.1.205:6381
>>> Performing Cluster Check (using node 192.168.1.205:6381)
M: b4ee0dac81bc99bc2e5f93888503239636e728e4 192.168.1.205:6381
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: 850a1ed8e723b4a80a92a1198b84689e9026a08e 192.168.1.206:6382
   slots: (0 slots) slave
   replicates 2b9d4483cf885d796aa87518f457ba8e878cb061
S: fb5e9a6a2f4be5c41b166e5dac1e953be73909ba 192.168.1.205:6382
   slots: (0 slots) slave
   replicates b4ee0dac81bc99bc2e5f93888503239636e728e4
M: 2b9d4483cf885d796aa87518f457ba8e878cb061 192.168.1.207:6381
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: e1ed22a04537e50908938ad924726cee7b9ffdad 192.168.1.206:6381
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 6ad8e7bdcfaed6acac134b7a07e7d291db44c307 192.168.1.207:6382
   slots: (0 slots) slave
   replicates e1ed22a04537e50908938ad924726cee7b9ffdad
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

results matching ""

    No results matching ""