zoukankan      html  css  js  c++  java
  • redis集群设置密码详解

    原文:http://lookingdream.blog.51cto.com/5177800/1827851

    注意事项:

    1.如果是使用redis-trib.rb工具构建集群,集群构建完成前不要配置密码,集群构建完毕再通过config set + config rewrite命令逐个机器设置密码(我觉得最好是在每一个redis.conf文件中配置requirepass

    2.如果对集群设置密码,那么requirepass和masterauth都需要设置,否则发生主从切换时,就会遇到授权问题,可以模拟并观察日志

    3.各个节点的密码都必须一致,否则Redirected就会失败

    [plain] view plain copy 在CODE上查看代码片派生到我的代码片

    1. config set masterauth abc  

    2. config set requirepass abc  

    3. config rewrite  

    设置密码后,redis-trib.rb check 192.168.0.107:6379 

    设置密码后,redis-trib.rb check 192.168.0.107:6379  报错连接不上实例,解决方法:

    vim /usr/lib/ruby/gems/1.8/gems/redis-3.3.0/lib/redis/client.rb

    class Redis
      class Client

        DEFAULTS = {
          :url => lambda { ENV["REDIS_URL"] },
          :scheme => "redis",
          :host => "127.0.0.1",
          :port => 6379,
          :path => nil,
          :timeout => 5.0,
          :password => "gh*8pass",
          :db => 0,
          :driver => nil,
          :id => nil,
          :tcp_keepalive => 0,
          :reconnect_attempts => 1,
          :inherit_socket => false
        }

    修改下默认密码就可以了

  • 相关阅读:
    python中的各种排序
    python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
    python中的lambda
    python中有趣的函数
    python中的小技巧
    python 删除list中重复元素
    django-pagination的使用
    django-south
    ios复制到剪贴板
    iOS系统验证关闭
  • 原文地址:https://www.cnblogs.com/shihaiming/p/6374348.html
Copyright © 2011-2022 走看看