当前位置: 首页 > news >正文

keepalived两台设备同时出现VIP问题

目录

问题背景:

日志分析如下:

原因和解决方案总结:

问题背景:

keepalived-master和keepalived-slave同时出现了VIP,出现了非对称路由和双主现象

日志分析如下:

  • master能够接受到来自slave的通告消息,并且master优先级100高于slave80,这是正常的。
  • slave日志没有与master替换相关的信息记录,smtp持续报错,并且没有接受到来自master的通告消息,无法确认master状态即slave认为master宕机,所以就up上vip给自己。
[root@test1 ~]# journalctl -fu keepalived  
-- Logs begin at Wed 2024-10-30 18:47:13 CST. --
May 28 21:46:28 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:29 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:30 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:31 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:32 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:33 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100
May 28 21:46:34 test1 Keepalived_vrrp[28060]: (VI_1) Received advert from 192.168.2.191 with lower priority 80, ours 100[root@test2 ~]# journalctl -fu keepalived
-- Logs begin at Wed 2024-10-30 18:43:15 CST. --
May 28 21:39:30 test2 Keepalived_healthcheckers[22487]: Removing service [192.168.2.193]:tcp:80 from VS [192.168.2.100]:tcp:80
May 28 21:39:30 test2 Keepalived_healthcheckers[22487]: Lost quorum 1-0=1 > 0 for VS [192.168.2.100]:tcp:80
May 28 21:39:30 test2 Keepalived_healthcheckers[22487]: smtp fd 10 returned write error
May 28 21:43:48 test2 Keepalived_healthcheckers[22487]: TCP connection to [192.168.2.192]:tcp:80 success.
May 28 21:43:48 test2 Keepalived_healthcheckers[22487]: Adding service [192.168.2.192]:tcp:80 to VS [192.168.2.100]:tcp:80
May 28 21:43:48 test2 Keepalived_healthcheckers[22487]: Gained quorum 1+0=1 <= 1 for VS [192.168.2.100]:tcp:80
May 28 21:43:48 test2 Keepalived_healthcheckers[22487]: smtp fd 10 returned write error
May 28 21:43:56 test2 Keepalived_healthcheckers[22487]: TCP connection to [192.168.2.193]:tcp:80 success.
May 28 21:43:56 test2 Keepalived_healthcheckers[22487]: Adding service [192.168.2.193]:tcp:80 to VS [192.168.2.100]:tcp:80
May 28 21:43:56 test2 Keepalived_healthcheckers[22487]: smtp fd 10 returned write error

原因和解决方案总结:

  • 查看防火墙状态,按以上日志的话主要查看slave设备的防火墙,将其关闭。(本人所遇问题为防火墙问题)。
  • 在产生切换master行为后,网络故障或延迟导致通告消息不及时,产生双主,建议手动停止keepalived,删除一侧VIP地址,再按照优先级配置从大到小顺序进行启动master和slave。
  • 主从keepalived配置文件中的vrrp_instance配置错误,着重关注网卡名称interface是否配置正确。
  • 查看主从服务的时间是否同步,若不同步可能需要使用chrony进行统一时间。

http://www.xdnf.cn/news/699499.html

相关文章:

  • MySql--explain的用法
  • 【Linux网络篇】:简单的TCP网络程序编写以及相关内容的扩展
  • css样式块重复调用
  • 楼宇自控系统重塑建筑设备管理:告别低效,迈向智能管理时代
  • 华为OD机试真题——书籍叠放(2025A卷:200分)Java/python/JavaScript/C/C++/GO最佳实现
  • Linux系统之cal命令的基本使用
  • 国有企业采购方式及适用情形
  • Java集合进阶
  • C++补充基础小知识:什么是接口类 和 抽象类?为什么要继承?
  • 线程的生命周期?怎么终止线程?线程和线程池有什么区别?如何创建线程池?说一下 ThreadPoolExecutor 的参数含义?
  • yolov12毕设前置知识准备 1
  • Linux基本指令/上
  • Python常用模块实用指南
  • Python人工智能算法学习 禁忌搜索算法求解旅行商问题(TSP)的研究与实现
  • .net Winfrom 如何将窗口设置为MDI容器
  • QGIS新手教程2:线图层与多边形图层基础操作指南(点线互转、中心点提取与WKT导出)
  • Git:现代软件开发的基石——原理、实践与行业智慧·优雅草卓伊凡
  • go实例化结构体的方式
  • 【C/C++】设计模式之工厂模式:从简单到抽象的演进
  • 《接口和抽象类到底怎么选?设计原则与经典误区解析》
  • com.alibaba.fastjson.JSONException: default constructor not found.
  • 【25-cv-05887、25-cv-05893、25-cv-05897】一张图片连发3案!
  • 【Python实例】读取/处理 Landsat LST数据
  • Three.js引擎基础
  • HIS系统——药库管理模块功能解析
  • 【操作系统】内存管理知识点深度解析
  • 直播框架:基础知识点
  • 【基础题库回复四则】2022-1-26
  • git提交更改
  • 三强联合!Attention+LSTM,结合特征融合,起手二区!