簡體   English   中英

在Redis-sentinel主從配置中,新主設備顯示為初始主設備的向下

[英]In Redis-sentinel master-slave cofiguration new master is shown as down for the initial master

使用3個節點(1個主節點和2個從節點)安裝了redis(v.3.0.4)主從模型,每個節點都有requirepass,如https://www.digitalocean.com/community/tutorials/how-to所述-configure-a-redis-cluster-on-ubuntu-14-04然后在每個節點上啟動3個sentinel,如文章http://blog.commando.io/redis-is-easy-trivial-hard/中所述

在試圖取下主人之后,哨兵已按預期將其中一名奴隸提升為主人。 然后,當舊主機再次啟動時,它成為一個從屬設備並識別出一個新的主設備,這可以在/etc/redis/sentinel.conf中看到,該設備使用“sentinel monitor redis-cluster”屬性中的新主IP進行更新。 但是已經注意到老主人盡管知道了新的主IP,但它認為新的主人是下來的,不像其他奴隸看到它。 這可以通過對舊主服務器運行此命令來檢查:

$redis-cli -a altoros info replication
#
Replication
role:slave
master_host: new master ip
master_port:6379
master_link_status:down

當嘗試使用同步客戶端測試節點上的數據復制時,這似乎也會導致以下錯誤“MASTERDOWN與MASTER的鏈接斷開,slave-serve-stale-data設置為'no'”。

The logs of the old masters (/var/log/redis/redis-server.log) are showing:
20731:S 09 Nov 10:16:31.117 * Connecting to MASTER <new master="" ip="">: 6379
20731:S 09 Nov 10:16:31.117 * MASTER <-> SLAVE sync started
20731:S 09 Nov 10:16:31.118 * Non blocking connect for SYNC fired the event. 
20731:S 09 Nov 10:16:31.118 * Master replied to PING, replication can continue...
20731:S 09 Nov 10:16:31.119 * (Non critical) Master does not under stand REPLCONF listening-port: -NOAUTH Authentication required.
20731:S 09 Nov 10:16:31.119 * (Non critical) Master does not under stand REPLCONF capa:
-NOAUTH Authentication required.

這看起來像老主人無法對新主人進行身份驗證,因為它沒有他的密碼,但如何正確設置呢?

因為注意到/etc/redis/redis.conf在提升新主服務器后沒有改變,與/etc/redis/sentinel.conf不同,這可能會導致主服務器的redis.conf沒有密碼新主人。

非常感謝提前解決問題的任何提示。

主機需要像奴隸一樣配置,因為有一天它可能會成為一個。 因此,你需要設置它的masterauth的密碼吊艙。

你可以這樣做,而無需重新啟動y對“舊主人”執行以下操作:

redis-cli -h oldmasterip -a thepassword config set masterauth thepassword
redis-cli -h oldmasterip -a thepassword config rewrite

從那時起應該沒問題,配置文件將會更新。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM