如何使用“keepalived”让从服务器在主服务器重启时接管 VIP

如何使用“keepalived”让从服务器在主服务器重启时接管 VIP

我在用着保持活跃并阅读keepalived.conf.概要。我尝试了所有方法,感觉就像。无论我做什么,当主服务器重新启动时,我都无法让我的备份服务器在 10 秒内接管 VIP。

keepalived配置文件我使用的样子如下:

global_defs
{
  # don't run scripts configured to be run as root if any part of the path
  # is writable by a non-root user.
  enable_script_security 1

  # delay for second set of gratuitous ARPs after transition to MASTER
  # seconds, default 5, 0 for no second set
  vrrp_garp_master_delay 0

  # number of gratuitous ARP messages to send at a time after transition to
  # MASTER
  # default 5
  vrrp_garp_master_repeat 1

  # delay for second set of gratuitous ARPs after lower priority advert
  # received when MASTER
  vrrp_garp_lower_prio_delay 0

  # number of gratuitous ARP messages to send at a time after lower priority
  # advert received when MASTER
  vrrp_garp_lower_prio_repeat 1

  # minimum time interval for refreshing gratuitous ARPs while MASTER
  # secs, default 0 (no refreshing)
  vrrp_garp_master_refresh 10

  # number of gratuitous ARP messages to send at a time while MASTER
  # default 1
  vrrp_garp_master_refresh_repeat 1

  # delay in ms between gratuitous ARP messages sent on an interface
  # decimal, seconds (resolution usecs). Default 0.
  vrrp_garp_interval 0.001

  # delay in ms between unsolicited NA messages sent on an interface
  # decimal, seconds (resolution usecs). Default 0.
  vrrp_gna_interval 0.001
}

vrrp_instance VI_1
{
  state             {{STATE}}
  interface         {{INTERFACE}}
  virtual_router_id {{VRID}}
  priority          {{PRIORITY}}
  advert_int        1
  debug             4
  authentication
  {
    auth_type PASS
    auth_pass {{PASSWORD}}
  }
  virtual_ipaddress
  {
    {{IP_VIRTUAL}}
  }
}

相关内容