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都删除即可