redis master配置了密碼進行主從同步

來源:互聯網
上載者:User

標籤:

1.如果master不設定密碼,那麼直接在slave伺服器配置slaveof即可 配置如下

#slaveof ip 連接埠slaveof  221.224.85.186 6379 

配置好我們看下redis的日誌 看是否同步成功

5014:S 25 Jan 10:53:53.667 * Connecting to MASTER 221.224.85.186:63795014:S 25 Jan 10:53:53.667 * MASTER <-> SLAVE sync started5014:S 25 Jan 10:53:53.700 * Non blocking connect for SYNC fired the event.5014:S 25 Jan 10:53:53.734 * Master replied to PING, replication can continue...5014:S 25 Jan 10:53:53.832 * Partial resynchronization not possible (no cached master)5014:S 25 Jan 10:53:53.867 * Full resync from master: 4d6221e370675f397c396c9222b1b60bfcea1efb:15014:S 25 Jan 10:53:53.985 * MASTER <-> SLAVE sync: receiving 844 bytes from master5014:S 25 Jan 10:53:53.985 * MASTER <-> SLAVE sync: Flushing old data5014:S 25 Jan 10:53:53.985 * MASTER <-> SLAVE sync: Loading DB in memory5014:S 25 Jan 10:53:53.985 * MASTER <-> SLAVE sync: Finished with success
5014:S 25 Jan 10:53:53.667 * Connecting to MASTER 221.224.85.186:6379
這句是從上面slave伺服器日誌裡面擷取的,我們可以看到串連的master的伺服器的ip是221.224.85.186

MASTER <-> SLAVE sync: Finished with success
看到輸出的語句是success表示同步成功.

2.master設定密碼的情況下同步資料,其實很簡單,我們只要讓slave能連上master就可以了,我們在slave的設定檔中加一句話即可。
masterauth 123456

 OK。

 不然可能會出現一下錯誤

 

4939:S 25 Jan 09:53:20.450 # MASTER aborted replication with an error: NOAUTH Authentication required.4939:S 25 Jan 09:53:21.291 * Connecting to MASTER 120.27.137.142:63794939:S 25 Jan 09:53:21.292 * MASTER <-> SLAVE sync started4939:S 25 Jan 09:53:21.317 * Non blocking connect for SYNC fired the event.4939:S 25 Jan 09:53:21.342 * Master replied to PING, replication can continue...4939:S 25 Jan 09:53:21.368 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.4939:S 25 Jan 09:53:21.393 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.4939:S 25 Jan 09:53:21.393 * Partial resynchronization not possible (no cached master)4939:S 25 Jan 09:53:21.419 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.4939:S 25 Jan 09:53:21.419 * Retrying with SYNC...4939:S 25 Jan 09:53:21.444 # MASTER aborted replication with an error: NOAUTH Authentication required.

 

redis master配置了密碼進行主從同步

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.