1. 程式人生 > >[Redis Cluster]Redis cluster叢集報錯解決集錦(更新中)

[Redis Cluster]Redis cluster叢集報錯解決集錦(更新中)

一 Node is not empty 

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

1)將每個節點下aof、rdb、nodes.conf本地備份檔案刪除; 
2)172.168.63.201:7001> flushdb #清空當前資料庫(可省略) 
3)之後再執行指令碼,成功執行;

二 Not all 16384 slots are covered by nodes

[ERR] Not all 16384 slots are covered by nodes.

這個往往是由於主node移除了,但是並沒有移除node上面的slot,從而導致了slot總數沒有達到16384,其實也就是slots分佈不正確。所以在刪除節點的時候一定要注意刪除的是否是Master主節點。
1)、官方是推薦使用redis-trib.rb fix 來修復叢集…. ….  通過cluster nodes看到7001這個節點被幹掉了… 那麼
#  ./redis-trib.rb fix xxx.xxx.xx.xxx:7001
修復完成後再用check命令檢查下是否正確
# ./redis-trib.rb check xxx.xxx.xx.xxx:7000
只要輸入任意叢集中節點即可,會自動檢查所有相關節點。可以檢視相應的輸出看下是否是每個Master都有了slots,如果分佈不均勻那可以使用下面的方式重新分配slot:
#  ./redis-trib.rb reshard xxx.xxx.xx.xxx:7001