集群配置:2台机器,每台3个Slave,redis版本3.3.2,ruby版本2.3.1,gem版本2.5.1
在执行./redis-trib.rb create --replicas 3语句时,已显示配置好的主从节点,当我输入yes之后就会报以下错误:
Can I set the above configuration? (type ‘yes‘ to accept): yes
/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:111:in `rescue in _write_to_socket‘: Connection timed out (Redis::TimeoutError)
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:104:in `_write_to_socket‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:131:in `block in write‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:130:in `loop‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:130:in `write‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/connection/ruby.rb:374:in `write‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:271:in `block in write‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:250:in `io‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:269:in `write‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:228:in `block (3 levels) in process‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:222:in `each‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:222:in `block (2 levels) in process‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:367:in `ensure_connected‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:221:in `block in process‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:306:in `logging‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:220:in `process‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis/client.rb:120:in `call‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis.rb:2705:in `block in method_missing‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis.rb:58:in `block in synchronize‘
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis.rb:58:in `synchronize‘
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis.rb:2704:in `method_missing‘
from ./redis-trib.rb:212:in `flush_node_config‘
from ./redis-trib.rb:776:in `block in flush_nodes_config‘
from ./redis-trib.rb:775:in `each‘
from ./redis-trib.rb:775:in `flush_nodes_config‘
from ./redis-trib.rb:1296:in `create_cluster_cmd‘
from ./redis-trib.rb:1701:in `<main>‘
我的防火墙和开放端口都做了,selinux也关闭了,可还是不行,请大神赐教!
分析:版本的问题,把3.3.2的redis-gem换成3.3.0就可以了。
gem list
gem uninstall redis --version 3.3.2
gem install redis --version 3.0.0
gem list
[[email protected] data]# gem list
*** LOCAL GEMS ***
redis (3.0.0)
这样就行了