redis-trib.rb命令詳解

redis-trib.rb是官方提供的Redis Cluster的管理工具,無需額外下載,默認位於源碼包的src目錄下,但因該工具是用ruby開發的,因此須要準備相關的依賴環境。node

 

準備redis-trib.rb的運行環境redis

wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz算法

yum -y install zlib-devel

tar xvf ruby-2.5.1.tar.gz數組

cd ruby-2.5.1/ruby

./configure -prefix=/usr/local/ruby工具

makethis

make installspa

cd /usr/local/ruby/命令行

cp bin/ruby /usr/local/bin3d

cp bin/gem /usr/local/bin

 

安裝rubygem redis依賴

wget http://rubygems.org/downloads/redis-3.3.0.gem

gem install -l redis-3.3.0.gem

 

redis-trib.rb支持的操做

# redis-trib.rb help
Usage: redis-trib <command> <options> <arguments ...>

  create          host1:port1 ... hostN:portN
                  --replicas <arg>
  check           host:port
  info            host:port
  fix             host:port
                  --timeout <arg>
  reshard         host:port
                  --from <arg>
                  --to <arg>
                  --slots <arg>
                  --yes
                  --timeout <arg>
                  --pipeline <arg>
  rebalance       host:port
                  --weight <arg>
                  --auto-weights
                  --use-empty-masters
                  --timeout <arg>
                  --simulate
                  --pipeline <arg>
                  --threshold <arg>
  add-node        new_host:new_port existing_host:existing_port
                  --slave
                  --master-id <arg>
  del-node        host:port node_id
  set-timeout     host:port milliseconds
  call            host:port command arg arg .. arg
  import          host:port
                  --from <arg>
                  --copy
                  --replace
  help            (show this help)

For check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.

支持的操做以下:

1. create:建立集羣

2. check:檢查集羣

3. info:查看集羣信息

4. fix:修復集羣

5. reshard:在線遷移slot

6. rebalance:平衡集羣節點slot數量

7. add-node:添加新節點

8. del-node:刪除節點

9. set-timeout:設置節點的超時時間

10. call:在集羣全部節點上執行命令

11. import:將外部redis數據導入集羣

 

建立集羣

redis-trib.rb create --replicas 1 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384

--replicas參數指定集羣中每一個主節點配備幾個從節點,這裏設置爲1。

>>> Creating cluster
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:6379
127.0.0.1:6380
127.0.0.1:6381
Adding replica 127.0.0.1:6383 to 127.0.0.1:6379
Adding replica 127.0.0.1:6384 to 127.0.0.1:6380
Adding replica 127.0.0.1:6382 to 127.0.0.1:6381
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: bc775f9c4dea40820b82c9451778b1fcd42f92bc 127.0.0.1:6379
   slots:0-5460 (5461 slots) master
M: 3b27d00d13706a032a92ff6b0a914af272dcaaf2 127.0.0.1:6380
   slots:5461-10922 (5462 slots) master
M: d874f003257f1fb036bbd856ca605172a1741232 127.0.0.1:6381
   slots:10923-16383 (5461 slots) master
S: 648eb314863b82aaa676380be7db2ec307f5547d 127.0.0.1:6382
   replicates bc775f9c4dea40820b82c9451778b1fcd42f92bc
S: 65a6efb441ac44c348f7da8c62e26b888cda7c48 127.0.0.1:6383
   replicates 3b27d00d13706a032a92ff6b0a914af272dcaaf2
S: 57bda956485109552547aef6c77fba43d2124abf 127.0.0.1:6384
   replicates d874f003257f1fb036bbd856ca605172a1741232
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 127.0.0.1:6379)
M: bc775f9c4dea40820b82c9451778b1fcd42f92bc 127.0.0.1:6379
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 648eb314863b82aaa676380be7db2ec307f5547d 127.0.0.1:6382
   slots: (0 slots) slave
   replicates bc775f9c4dea40820b82c9451778b1fcd42f92bc
M: 3b27d00d13706a032a92ff6b0a914af272dcaaf2 127.0.0.1:6380
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 57bda956485109552547aef6c77fba43d2124abf 127.0.0.1:6384
   slots: (0 slots) slave
   replicates d874f003257f1fb036bbd856ca605172a1741232
S: 65a6efb441ac44c348f7da8c62e26b888cda7c48 127.0.0.1:6383
   slots: (0 slots) slave
   replicates 3b27d00d13706a032a92ff6b0a914af272dcaaf2
M: d874f003257f1fb036bbd856ca605172a1741232 127.0.0.1:6381
   slots:10923-16383 (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.

16384個槽所有被分配,集羣建立成功。注意:給redis-trib.rb的節點地址必須是不包含任何槽/數據的節點,不然會拒絕建立集羣。

>>> Creating cluster
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
[ERR] Node 127.0.0.1:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

關於主從節點的選擇及槽的分配,其算法以下:

1> 把節點按照host分類,這樣保證master節點能分配到更多的主機中。

2> 遍歷host列表,從每一個host列表中彈出一個節點,放入interleaved數組。直到全部的節點都彈出爲止。

3> 將interleaved數組中前master個數量的節點保存到masters數組中。

4> 計算每一個master節點負責的slot數量,16384除以master數量取整,這裏記爲N。

5> 遍歷masters數組,每一個master分配N個slot,最後一個master,分配剩下的slot。

6> 接下來爲master分配slave,分配算法會盡可能保證master和slave節點不在同一臺主機上。對於分配完指定slave數量的節點,還有多餘的節點,也會爲這些節點尋找master。分配算法會遍歷兩次masters數組。

7> 第一次遍歷master數組,在餘下的節點列表找到replicas數量個slave。每一個slave爲第一個和master節點host不同的節點,若是沒有不同的節點,則直接取出餘下列表的第一個節點。

8> 第二次遍歷是分配節點數除以replicas不爲整數而多出的一部分節點。

 

檢查集羣狀態

redis-trib.rb check 127.0.0.1:6379

指定任意一個節點便可。

/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: bc775f9c4dea40820b82c9451778b1fcd42f92bc 127.0.0.1:6379
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 648eb314863b82aaa676380be7db2ec307f5547d 127.0.0.1:6382
   slots: (0 slots) slave
   replicates bc775f9c4dea40820b82c9451778b1fcd42f92bc
M: 3b27d00d13706a032a92ff6b0a914af272dcaaf2 127.0.0.1:6380
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 57bda956485109552547aef6c77fba43d2124abf 127.0.0.1:6384
   slots: (0 slots) slave
   replicates d874f003257f1fb036bbd856ca605172a1741232
S: 65a6efb441ac44c348f7da8c62e26b888cda7c48 127.0.0.1:6383
   slots: (0 slots) slave
   replicates 3b27d00d13706a032a92ff6b0a914af272dcaaf2
M: d874f003257f1fb036bbd856ca605172a1741232 127.0.0.1:6381
   slots:10923-16383 (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.

 

查看集羣信息

redis-trib.rb info 127.0.0.1:6383

/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
127.0.0.1:6380 (3b27d00d...) -> 0 keys | 5462 slots | 1 slaves.
127.0.0.1:6381 (d874f003...) -> 1 keys | 5461 slots | 1 slaves.
127.0.0.1:6379 (bc775f9c...) -> 0 keys | 5461 slots | 1 slaves.
[OK] 1 keys in 3 masters.
0.00 keys per slot on average.

 

修復集羣

目前fix命令能修復兩種異常,

1. 節點中存在處於遷移中(importing或migrating狀態)的slot。

2. 節點中存在未分配的slot。

其它異常不能經過fix命令修復。

[root@slowtech conf]# redis-trib.rb fix 127.0.0.1:6379
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing Cluster Check (using node 127.0.0.1:6379)
S: d826c5fd98efa8a17a880e9a90a25f06c88e6ae9 127.0.0.1:6379
   slots: (0 slots) slave
   replicates a8b3d0f9b12d63dab3b7337d602245d96dd55844
S: 55c05d5b0dfea0d52f88548717ddf24975268de6 127.0.0.1:6383
   slots: (0 slots) slave
   replicates a8b3d0f9b12d63dab3b7337d602245d96dd55844
M: f413fb7e6460308b17cdb71442798e1341b56cbc 127.0.0.1:6381
   slots:50-16383 (16334 slots) master
   2 additional replica(s)
S: beba753c5a63607fa66d9ec7427ed9a511ea136e 127.0.0.1:6382
   slots: (0 slots) slave
   replicates f413fb7e6460308b17cdb71442798e1341b56cbc
S: 83797d518e56c235272402611477f576973e9d34 127.0.0.1:6384
   slots: (0 slots) slave
   replicates f413fb7e6460308b17cdb71442798e1341b56cbc
M: a8b3d0f9b12d63dab3b7337d602245d96dd55844 127.0.0.1:6380
   slots:0-49 (50 slots) master
   2 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

 

在線遷移slot

交互環境中使用

如,

redis-trib.rb reshard 127.0.0.1:6379

指定任意一個節點便可。

/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: bc775f9c4dea40820b82c9451778b1fcd42f92bc 127.0.0.1:6379
   slots:3225-5460 (2236 slots) master
   1 additional replica(s)
S: 648eb314863b82aaa676380be7db2ec307f5547d 127.0.0.1:6382
   slots: (0 slots) slave
   replicates bc775f9c4dea40820b82c9451778b1fcd42f92bc
M: 3b27d00d13706a032a92ff6b0a914af272dcaaf2 127.0.0.1:6380
   slots:0-3224,5461-13958 (11723 slots) master
   1 additional replica(s)
S: 57bda956485109552547aef6c77fba43d2124abf 127.0.0.1:6384
   slots: (0 slots) slave
   replicates d874f003257f1fb036bbd856ca605172a1741232
S: 65a6efb441ac44c348f7da8c62e26b888cda7c48 127.0.0.1:6383
   slots: (0 slots) slave
   replicates 3b27d00d13706a032a92ff6b0a914af272dcaaf2
M: d874f003257f1fb036bbd856ca605172a1741232 127.0.0.1:6381
   slots:13959-16383 (2425 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.
How many slots do you want to move (from 1 to 16384)? 200
What is the receiving node ID? 3b27d00d13706a032a92ff6b0a914af272dcaaf2
Please enter all the source node IDs.
  Type 'all' to use all the nodes as source nodes for the hash slots.
  Type 'done' once you entered all the source nodes IDs.
Source node #1:

它首先會提示須要遷移多個槽,我這裏寫的是200。

接着它會提示須要將槽遷移到哪一個節點,這裏必須寫節點ID。

緊跟着它會提示槽從哪些節點中遷出。

若是指定爲all,則待遷移的槽在剩餘節點中平均分配,在這裏,127.0.0.1:6379和127.0.0.1:6381各遷移100個槽出來。

也可從指定節點中遷出,這個時候,必須指定源節點的節點ID,最後以done結束,以下所示,

Source node #1:bc775f9c4dea40820b82c9451778b1fcd42f92bc
Source node #2:done

Ready to move 200 slots.
  Source nodes:
    M: bc775f9c4dea40820b82c9451778b1fcd42f92bc 127.0.0.1:6379
   slots:3225-5460 (2236 slots) master
   1 additional replica(s)
  Destination node:
    M: 3b27d00d13706a032a92ff6b0a914af272dcaaf2 127.0.0.1:6380
   slots:0-3224,5461-13958 (11723 slots) master
   1 additional replica(s)
  Resharding plan:
    Moving slot 3225 from bc775f9c4dea40820b82c9451778b1fcd42f92bc
    Moving slot 3226 from bc775f9c4dea40820b82c9451778b1fcd42f92bc
    Moving slot 3227 from bc775f9c4dea40820b82c9451778b1fcd42f92bc
    ...
Do you want to proceed with the proposed reshard plan (yes/no)? yes
Moving slot 3225 from 127.0.0.1:6379 to 127.0.0.1:6380: .
Moving slot 3226 from 127.0.0.1:6379 to 127.0.0.1:6380: 
Moving slot 3227 from 127.0.0.1:6379 to 127.0.0.1:6380: ..
Moving slot 3228 from 127.0.0.1:6379 to 127.0.0.1:6380: 
...

最後,提示是否繼續進行。

 

命令行中使用

redis-trib.rb reshard host:port --from <arg> --to <arg> --slots <arg> --yes --timeout <arg> --pipeline <arg>

其中,

host:port:必傳參數,集羣內任意節點地址,用來獲取整個集羣信息。

--from:源節點id,若是有多個源節點,使用逗號分隔,若是是all,則源節點爲集羣內出目標節點外的其它全部主節點。

--to:目標節點id,只能填寫一個。

--slots:須要遷移槽的總數量。

--yes:遷移無需用戶手動確認。

--timeout:控制每次migrate操做的超時時間,默認爲60000毫秒。

--pipeline:控制每次批量遷移鍵的數量,默認爲10。

如,

redis-trib.rb reshard --from a8b3d0f9b12d63dab3b7337d602245d96dd55844 --to f413fb7e6460308b17cdb71442798e1341b56cbc  --slots 10923 --yes --pipeline 20 127.0.0.1:6383

 

平衡集羣節點slot數量

rebalance       host:port
                  --weight <arg>
                  --auto-weights
                  --use-empty-masters
                  --timeout <arg>
                  --simulate
                  --pipeline <arg>
                  --threshold <arg>

其中,

--weight <arg>:節點的權重,格式爲node_id=weight,若是須要爲多個節點分配權重的話,須要添加多個--weight <arg>參數,即--weight b31e3a2e=5 --weight 60b8e3a1=5,node_id可爲節點名稱的前綴,只要保證前綴位數能惟一區分該節點便可。沒有傳遞–weight的節點的權重默認爲1。

--auto-weights:自動將每一個節點的權重默認爲1。若是--weight和--auto-weights同時指定,則--auto-weights會覆蓋前者。

--threshold <arg>:只有節點須要遷移的slot閾值超過threshold,纔會執行rebalance操做。

--use-empty-masters:默認沒有分配slot節點的master是不參與rebalance的。若是要讓其參與rebalance,需添加該參數。

--timeout <arg>:設置migrate命令的超時時間。

--simulate:設置該參數,只會提示用戶會遷移哪些slots,而不會執行真正的遷移操做。

--pipeline <arg>:定義cluster getkeysinslot命令一次取出的key數量,不傳的話使用默認值爲10。

如,

# redis-trib.rb rebalance --weight a8b3d0f9b12d63dab3b7337d602245d96dd55844=3 --weight f413fb7e6460308b17cdb71442798e1341b56cbc=2  --use-empty-masters  127.0.0.1:6379
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing Cluster Check (using node 127.0.0.1:6379)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Rebalancing across 2 nodes. Total weight = 5.0
Moving 3824 slots from 127.0.0.1:6380 to 127.0.0.1:6381
#########################################...

 

刪除節點

redis-trib.rb del-node host:port node_id

在刪除節點以前,其對應的槽必須爲空,因此,在進行節點刪除動做以前,必須使用redis-trib.rb reshard將其遷移出去。

須要注意的是,若是某個節點的槽被徹底遷移出去,其對應的slave也會隨着更新,指向遷移的目標節點。

# redis-trib.rb del-node 127.0.0.1:6379 8f7836a9a14fb6638530b42e04f5e58e28de0a6c
>>> Removing node 8f7836a9a14fb6638530b42e04f5e58e28de0a6c from cluster 127.0.0.1:6379
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Sending CLUSTER FORGET messages to the cluster...
>>> SHUTDOWN the node.

 

添加新節點

redis-trib add-node new_host:new_port existing_host:existing_port --slave --master-id <arg>

其中,

new_host:new_port:待添加的節點,必須確保其爲空或不在其它集羣中。不然,會提示如下錯誤。

[ERR] Node 127.0.0.1:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

因此,線上建議使用redis-trib.rb添加新節點,由於其會對新節點的狀態進行檢查。若是手動使用cluster meet命令加入已經存在於其它集羣的節點,會形成被加入節點的集羣合併到現有集羣的狀況,從而形成數據丟失和錯亂,後果很是嚴重,線上謹慎操做。

existing_host:existing_port:集羣中任意一個節點的地址。

若是添加的是主節點,只需指定源節點和目標節點的地址便可。

redis-trib.rb add-node 127.0.0.1:6379 127.0.0.1:6384

若是添加的是從節點,其語法以下,

redis-trib.rb add-node --slave --master-id f413fb7e6460308b17cdb71442798e1341b56cbc 127.0.0.1:6379 127.0.0.1:6384

注意:--slave和--master-id必須寫在前面,一樣的參數,若是是下面這樣寫法,會提示錯誤,

# redis-trib.rb add-node 127.0.0.1:6379 127.0.0.1:6384 --slave --master-id f413fb7e6460308b17cdb71442798e1341b56cbc
[ERR] Wrong number of arguments for specified sub command

 添加從節點,可不設置--master-id,此時會隨機選擇主節點。

 

設置節點的超時時間

redis-trib.rb set-timeout host:port milliseconds

其實就是批量修改集羣各節點的cluster-node-timeout參數。

# redis-trib.rb set-timeout 127.0.0.1:6379 20000
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Reconfiguring node timeout in every cluster node...
*** New timeout set for 127.0.0.1:6379
*** New timeout set for 127.0.0.1:6383
*** New timeout set for 127.0.0.1:6381
*** New timeout set for 127.0.0.1:6382
*** New timeout set for 127.0.0.1:6384
*** New timeout set for 127.0.0.1:6380
>>> New node timeout set. 6 OK, 0 ERR.

 

在集羣全部節點上執行命令

redis-trib.rb call host:port command arg arg .. arg

如,

[root@slowtech conf]# redis-trib.rb call 127.0.0.1:6379 set hello world
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Calling SET hello world
127.0.0.1:6379: MOVED 866 127.0.0.1:6381
127.0.0.1:6383: MOVED 866 127.0.0.1:6381
127.0.0.1:6381: OK
127.0.0.1:6382: MOVED 866 127.0.0.1:6381
127.0.0.1:6384: MOVED 866 127.0.0.1:6381
127.0.0.1:6380: MOVED 866 127.0.0.1:6381

[root@slowtech conf]# redis-trib.rb call 127.0.0.1:6379 get hello
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Calling GET hello
127.0.0.1:6379: MOVED 866 127.0.0.1:6381
127.0.0.1:6383: MOVED 866 127.0.0.1:6381
127.0.0.1:6381: world
127.0.0.1:6382: MOVED 866 127.0.0.1:6381
127.0.0.1:6384: MOVED 866 127.0.0.1:6381
127.0.0.1:6380: MOVED 866 127.0.0.1:6381

 

將外部redis數據導入集羣

redis-trib.rb import --from 127.0.0.1:6378 127.0.0.1:6379

其內部處理流程以下:

1> 經過load_cluster_info_from_node方法加載集羣信息,check_cluster方法檢查集羣是否健康。

2> 鏈接外部redis節點,若是外部節點開啓了cluster_enabled,則提示錯誤([ERR] The source node should not be a cluster node.)

3> 經過scan命令遍歷外部節點,一次獲取1000條數據。

4> 遍歷這些key,計算出key對應的slot。

5> 執行migrate命令,源節點是外部節點,目的節點是集羣slot對應的節點,若是設置了--copy參數,則傳遞copy參數,其會保留源節點的key,若是設置了--replace,則傳遞replace參數。若是目標節點中存在同名key,其值會被覆蓋。兩個參數可同時指定。

6> 不停執行scan命令,直到遍歷完全部key。

7> 遷移完成。

[root@slowtech conf]# redis-trib.rb import --from 127.0.0.1:6378 --replace  127.0.0.1:6379 
>>> Importing data from 127.0.0.1:6378 to cluster 
/usr/local/ruby/lib/ruby/gems/2.5.0/gems/redis-3.3.0/lib/redis/client.rb:459: warning: constant ::Fixnum is deprecated
>>> Performing Cluster Check (using node 127.0.0.1:6379)
S: d826c5fd98efa8a17a880e9a90a25f06c88e6ae9 127.0.0.1:6379
   slots: (0 slots) slave
   replicates a8b3d0f9b12d63dab3b7337d602245d96dd55844
S: 55c05d5b0dfea0d52f88548717ddf24975268de6 127.0.0.1:6383
   slots: (0 slots) slave
   replicates a8b3d0f9b12d63dab3b7337d602245d96dd55844
M: f413fb7e6460308b17cdb71442798e1341b56cbc 127.0.0.1:6381
   slots:50-16383 (16334 slots) master
   2 additional replica(s)
S: beba753c5a63607fa66d9ec7427ed9a511ea136e 127.0.0.1:6382
   slots: (0 slots) slave
   replicates f413fb7e6460308b17cdb71442798e1341b56cbc
S: 83797d518e56c235272402611477f576973e9d34 127.0.0.1:6384
   slots: (0 slots) slave
   replicates f413fb7e6460308b17cdb71442798e1341b56cbc
M: a8b3d0f9b12d63dab3b7337d602245d96dd55844 127.0.0.1:6380
   slots:0-49 (50 slots) master
   2 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Connecting to the source Redis instance
*** Importing 1 keys from DB 0
Migrating key5 to 127.0.0.1:6381: OK

 

參考

1. redis cluster管理工具redis-trib.rb詳解

相關文章
相關標籤/搜索