1. 創建集群時報以下錯誤
(1)錯誤1
./redis-trib.rb create --replicas 1 XXXXXX:5301 XXXXXX:5302 XXXXXX:5303 XXXXXX:5304 XXXXXX:5305 XXXXXX:5306
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- redis (LoadError)
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from ./redis-trib.rb:25:in `<main>'
解決方式 : 可能是因為沒有安裝 ruby的 redis插件
gem install redis-3.0.7.gem
(2)錯誤2
./redis-trib.rb create --replicas 1 XXXXXX:5301 XXXXXX:5302 XXXXXX:5303 XXXXXX:5304 XXXXXX:5305 XXXXXX:5306
>>> Creating cluster
[ERR] Node XXXXXX:5302 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
解決方式 : 不同節點的數據庫中包含相同的數據,把所有的數據庫的數據清除即可 , 命令 : flushdb
(3)錯誤3
Can I set the above configuration? (type 'yes' to accept): yes
/usr/local/rvm/gems/ruby-2.2.1/gems/redis-3.0.7/lib/redis/client.rb:97:in `call': ERR Slot 5474 is already busy (Redis::CommandError)
from /usr/local/rvm/gems/ruby-2.2.1/gems/redis-3.0.7/lib/redis.rb:2432:in `block in method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/redis-3.0.7/lib/redis.rb:37:in `block in synchronize'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /usr/local/rvm/gems/ruby-2.2.1/gems/redis-3.0.7/lib/redis.rb:37:in `synchronize'
from /usr/local/rvm/gems/ruby-2.2.1/gems/redis-3.0.7/lib/redis.rb:2431:in `method_missing'
from ./redis-trib.rb:212:in `flush_node_config'
from ./redis-trib.rb:775:in `block in flush_nodes_config'
from ./redis-trib.rb:774:in `each'
from ./redis-trib.rb:774:in `flush_nodes_config'
from ./redis-trib.rb:1295:in `create_cluster_cmd'
from ./redis-trib.rb:1695:in `<main>'
解決方式 : 是因為之前創建redis集群時錯誤因起的,只需要把 redis.conf 中指定的文件刪除即可,一般默認的文件名是: nodes.conf , 所有的節點下都有一個這樣的文件,所以需要把所有的nodes.conf都刪除即可
