zoukankan      html  css  js  c++  java
  • 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
        }
    




  • 相关阅读:
    Apache RocketMQ + Hudi 快速构建 Lakehouse
    如何快速调度 PTS 的百万并发能力
    flask
    第三方登录————微博
    python定时获取树莓派硬件参数并使用MQTT进行数据推送
    树莓派修改时区
    windows编辑shell,报错syntax error near unexpected token `elif'
    树莓派挂载移动硬盘
    关闭树莓派摄像头红色LED指示灯
    树莓派拍照和录制视频
  • 原文地址:https://www.cnblogs.com/liuyp-ken/p/Redis.html
Copyright © 2011-2022 走看看