redis叢集設定密碼詳解

來源:互聯網
上載者:User

標籤:redis叢集

注意事項:

1.如果是使用redis-trib.rb工具構建叢集,叢集構建完成前不要配置密碼,叢集構建完畢再通過config set + config rewrite命令逐個機器設定密碼

2.如果對叢集設定密碼,那麼requirepass和masterauth都需要設定,否則發生主從切換時,就會遇到授權問題,可以類比並觀察日誌

3.各個節點的密碼都必須一致,否則Redirected就會失敗

[plain] view plain copy 650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />

  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
    }

修改下預設密碼就可以了


本文出自 “夢想照進現實” 部落格,請務必保留此出處http://lookingdream.blog.51cto.com/5177800/1827851

redis叢集設定密碼詳解

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.