1. 程式人生 > >建立redis cluster時,有警告提示

建立redis cluster時,有警告提示

建立redis叢集的時候會出現警告提示,如下:

[[email protected] redis-cluster]# ./redis-trib.rb create --replicas 1 192.168.5.128:7001 192.168.5.128:7002 192.168.5.128:7003 192.168.5.128:7004 192.168.5.128:7005 192.168.5.128:7006
>>> Creating cluster
Connecting to node 192.168.5.128:7001: OK
/usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: wrong element type nil at 98 (expected array)
/usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: ignoring wrong elements is deprecated, remove them explicitly /usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: this
causes ArgumentError in the next release ...... ...... Connecting to node 192.168.5.128:7002: OK /usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: wrong element type nil at 98 (expected array)
/usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: ignoring wrong elements is deprecated, remove them explicitly /usr/local/share/gems/gems/redis-3.0.0/lib/redis.rb:182: warning: this
causes ArgumentError in the next release ...... ...... Connecting to node 192.168.5.128:7003: OK Connecting to node 192.168.5.128:7004: OK Connecting to node
192.168.5.128:7005: OK Connecting to node 192.168.5.128:7006: OK >>> Performing hash slots allocation on 6 nodes... Using 3 masters: 192.168.5.128:7001 192.168.5.128:7002 192.168.5.128:7003 Adding replica 192.168.5.128:7004 to 192.168.5.128:7001 Adding replica 192.168.5.128:7005 to 192.168.5.128:7002 Adding replica 192.168.5.128:7006 to 192.168.5.128:7003 M: 3cbed89c47ca14b3d1eb11dd2f7525fa6cb4fcd7 192.168.5.128:7001 slots:0-5460 (5461 slots) master M: 27d069e1b4d459a92b6cc9a1c92ad46ea00cb61d 192.168.5.128:7002 slots:5461-10922 (5462 slots) master M: d7d28caadfdc4161261305f2d2baf55d2d8f4221 192.168.5.128:7003 slots:10923-16383 (5461 slots) master S: f124b72c0421c7514f44668d30761d075e42643d 192.168.5.128:7004 replicates 3cbed89c47ca14b3d1eb11dd2f7525fa6cb4fcd7 S: 8cf60c085a58b60557a887a5e8451ce38e6b54fa 192.168.5.128:7005 replicates 27d069e1b4d459a92b6cc9a1c92ad46ea00cb61d S: 05ad0eb9b5f839771b09dc18192909d5fa1f893e 192.168.5.128:7006 replicates d7d28caadfdc4161261305f2d2baf55d2d8f4221 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.5.128:7001) M: 3cbed89c47ca14b3d1eb11dd2f7525fa6cb4fcd7 192.168.5.128:7001 slots:0-5460 (5461 slots) master M: 27d069e1b4d459a92b6cc9a1c92ad46ea00cb61d 192.168.5.128:7002 slots:5461-10922 (5462 slots) master M: d7d28caadfdc4161261305f2d2baf55d2d8f4221 192.168.5.128:7003 slots:10923-16383 (5461 slots) master M: f124b72c0421c7514f44668d30761d075e42643d 192.168.5.128:7004 slots: (0 slots) master replicates 3cbed89c47ca14b3d1eb11dd2f7525fa6cb4fcd7 M: 8cf60c085a58b60557a887a5e8451ce38e6b54fa 192.168.5.128:7005 slots: (0 slots) master replicates 27d069e1b4d459a92b6cc9a1c92ad46ea00cb61d M: 05ad0eb9b5f839771b09dc18192909d5fa1f893e 192.168.5.128:7006 slots: (0 slots) master replicates d7d28caadfdc4161261305f2d2baf55d2d8f4221 [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. [[email protected] redis-cluster]#

  是警告不是錯誤,不影響建立redis叢集。但是看著還是很不舒服。

警告翻譯如下:

warning: wrong element type nil at 98 (expected array)
warning: ignoring wrong elements is deprecated, remove them explicitly
warning: this causes ArgumentError in the next release
警告:98處的錯誤元素型別為nil(預期陣列)
警告:不推薦忽略錯誤的元素,請明確刪除它們
警告:這會在下一個版本中導致ArgumentError

解決方法:

1)、將需要新增的節點下appendonly.aof、dump.rdb等本地備份檔案刪除;
2)、同時將新node的叢集配置檔案刪除,即:刪除你redis.conf裡面cluster-config-file所在的檔案;如果是預設的話,那就是刪除nodes.conf 檔案。
3)、再次新增新節點如果還是報錯,則登入新node後,./redis-cli –h 192.168.5.128 –p 7007 對資料庫進行清除:
  192.168.5.128:7007>  flushdb      #清空當前資料庫

參考連結:

  http://www.php-master.com/post/325868.html