在创建redis集群服务时,提示以下错误:
/usr/local/rvm/gems/ruby-2.4.5/gems/redis-4.1.0/lib/redis/client.rb:124:in `call': ERR Slot 0 is already busy (Redis::CommandError)from /usr/local/rvm/gems/ruby-2.4.5/gems/redis-4.1.0/lib/redis.rb:3282:in `block in cluster'from /usr/local/rvm/gems/ruby-2.4.5/gems/redis-4.1.0/lib/redis.rb:50:in `block in synchronize'from /usr/local/rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'from /usr/local/rvm/gems/ruby-2.4.5/gems/redis-4.1.0/lib/redis.rb:50:in `synchronize'from /usr/local/rvm/gems/ruby-2.4.5/gems/redis-4.1.0/lib/redis.rb:3281:in `cluster'from ./redis-trib.rb:212:in `flush_node_config'from ./redis-trib.rb:906:in `block in flush_nodes_config'from ./redis-trib.rb:905:in `each'from ./redis-trib.rb:905:in `flush_nodes_config'from ./redis-trib.rb:1426:in `create_cluster_cmd'from ./redis-trib.rb:1830:in `<main>'
错误提示是说:slot插槽被占用了、这是因为 搭建集群前时,以前redis的旧数据和配置信息没有清理干净。
解决方案:
用redis-cli 登录到每个节点执行 flushall 和 cluster reset 就可以了。
./redis-cli -h IP -p 端口
flushall
cluster reset
然后再重新执行创建集群服务命令即可:
./redis-trib.rb create --replicas 1 39.105.XX.XX:7001 114.116.XX.XX:7001 39.105.XX.XX:7001 39.105.XX.XX:7002 114.116.XX.XX:7002 39.105.XX.XX:7002