Keepalived非抢占模式配置

一、前言

HA的实际运行过程中,当主机发生异常,且后期恢复正常后,存在抢占或非抢占两种情况。

结合实际需求,可能有很多用户需要非抢占的HA工作模式。keepalived能够很好的支持这一需求。

 

二、keepalived非抢占配置

下面直接展示keepalived的非抢占配置。

主机配置如下:

vrrp_instance VI_1
{
  state BACKUP
  nopreempt
  priority 100

  advert_int 1
  virtual_router_id 1
  interface eth0

  authentication
  {
    auth_type PASS
    auth_pass abcd@hehe
  }

  virtual_ipaddress
  {
    100.92.2.110
  }
}

 

备机配置如下:

vrrp_instance VI_1
{
  state BACKUP
  nopreempt
  priority 90

  advert_int 1
  virtual_router_id 1
  interface eth0

  authentication
  {
    auth_type PASS
    auth_pass abcd@hehe
  }

  virtual_ipaddress
  {
    100.92.2.110
  }
}

 

重点:

1、两个节点的state都必须配置为BACKUP

2、两个节点都必须加上配置 nopreempt

引用官方文档对nopreempt字段的说明:

"nopreempt" allows the lower priority machine to maintain the master role, even when a higher priority machine comes back online. 

NOTE: For this to work, the initial state of this entry must be BACKUP.

根据上述描述,第一点提到的state必须配置为BACKUP就明白了。

3、其中一个节点的优先级必须要高于另外一个节点的优先级。

转载于:https://www.cnblogs.com/t-bar/p/9940085.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值