天天看點

keepalived運作時日志中一直列印“ip address associated with VRID 41 not present in MASTER advert”

問題原因

本人在項目中使用了keepalived搭建高可用叢集環境,所有配置配好了之後,啟動keepalived成功,心跳檢測正常,心跳檢測異常後VIP飄逸也正常。

就是mysql資料庫在使用VIP作為連接配接位址時,偶爾會發生斷連并引發異常的情況。異常如下:

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet successfully received from the server was 1 milliseconds ago. The last packet sent successfully to the server was 1 milliseconds ago.

經過排查,發現keepalived日志一直在列印“ip address associated with VRID 41 not present in MASTER advert”

查閱資料後,發現原來是keepalived的配置中的 virtual_router_id 可能在相同區域網路中有沖突,經過排查确認,确實在區域網路同一網段下,部署了兩套keepalived, virtual_router_id 的配置相同,都是41。

解決辦法

修改 /etc/keepalived/keepalived.conf 配置檔案的 virtual_router_id

重新開機keepalived服務,即可。

繼續閱讀