redis-trib.rb创建Redis集群时失败报错解决方案
Posted 我们的问题主要是读书不多而想得太多
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis-trib.rb创建Redis集群时失败报错解决方案相关的知识,希望对你有一定的参考价值。
问题描述:
[root@eshop-cache01 init.d]# redis-trib.rb create --replicas 1 192.168.1.110:7001 192.168.1.110:7002 192.168.1.112:7003 192.168.1.112:7004 192.168.1.113:7005 192.168.1.113:7006 /usr/local/ruby/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:15:in `<class:Client>‘: undefined local variable or method `redis‘ for Redis::Client:Class (NameError) from /usr/local/ruby/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:6:in `<class:Redis>‘ from /usr/local/ruby/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:5:in `<top (required)>‘ from /usr/local/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require‘ from /usr/local/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require‘ from /usr/local/ruby/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2771:in `<top (required)>‘ from /usr/local/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require‘ from /usr/local/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require‘ from /usr/local/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require‘ from /usr/local/bin/redis-trib.rb:25:in `<main>‘
解决方案:
检查client.rb的配置是否配置正确。
vim /usr/local/rvm/gems/ruby-2.3.3/gems/redis-4.0.0/lib/redis/client.rb,
class Client DEFAULTS = { :url => lambda { ENV["REDIS_URL"] }, :scheme => "redis", :host => "127.0.0.1", :port => 6379, :path => nil, :timeout => 5.0, :password => "passwd123", :db => 0, :driver => nil, :id => nil, :tcp_keepalive => 0, :reconnect_attempts => 1, :inherit_socket => false }
以上是关于redis-trib.rb创建Redis集群时失败报错解决方案的主要内容,如果未能解决你的问题,请参考以下文章
Redis 3.2.1集群 —— Redis-trib.rb工具详解(含原理)
redis cluster集群管理工具redis-trib.rb功能小结