Keepalived兩節點出現雙VIP的情況,keepalived節點vip

來源:互聯網
上載者:User

Keepalived兩節點出現雙VIP的情況,keepalived節點vip

一.現象

安裝有keepalived的兩節點伺服器10.11.4.186/187,主要做高可用,設定VIP10.11.4.185。

二.問題原因 1. 查看日誌 

查看10.11.4.187的日誌發現,其上keepalived服務剛啟動後不久就進入master模式,獲得VIP;同時查看10.11.4.186的日誌,並沒有任何異常。

初步判斷是兩邊的協商機制出問題(vrrp),10.11.4.187 backup節點與10.11.4.186 主節點協商不成功,認為主節點故障,切換升主。

2. 驗證分析驗證
# 採用tcpdump抓包定位問題,以下是在10.11.4.186 主節點的抓包結果[root@psql_master ~]# tcpdump -i eth0 vrrp -n

# 以下是在10.11.4.187 備節點的抓包結果[root@psql_standby ~]# tcpdump -i eth0 vrrp -n

分析三.解決方案1. 配置iptables 
# 配置iptables,允許vrrp流量,或者允許組播流量[root@psql_standby ~]# vim /etc/sysconfig/iptables-A INPUT -p vrrp -j ACCEPT# 或者:-A INPUT -m pkttype --pkt-type multicast -j ACCEPT# 重啟iptables:[root@psql_standby ~]# service iptables restart

放開iptables策略後,tcpdump抓包發現:備節點10.11.4.187收到更進階的通告,已不再主動向外發vrrp通告。

2. 設定vrrp單播通告(未驗證)
# 如果兩節點的上聯交換器禁用了組播,則只能採用vrrp單播通告的方式[root@psql_master ~]# vim /etc/keepalived/keepalived.conf   priority 100    unicast_src_ip  10.11.4.186         ##source ip    unicast_peer {            10.11.4.187               ##dest ip    }[root@psql_standby ~]# vim /etc/keepalived/keepalived.conf   priority 90    unicast_src_ip  10.11.4.187         ##source ip    unicast_peer {            10.11.4.186               ##dest ip    }

聯繫我們

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