keepalived---配置讲解

 

全局配置

global_defs {
  notification_email {
  2978625832@qq.com
}

  notification_email_from litj@outlook.com
  smtp_server 127.0.0.1
  smtp_connect_timeout 30
  router_id LVS_DEVEL
}

vrrp_script chk_nginx {
  script "/opt/script/chk_nginx.sh"   # 要检查的服务脚本
  }

vrrp_instance VI_1 {
  state MASTER  
  interface enp0s8 # 监听的网卡
  virtual_router_id 51 # router id 组
  priority 100  # 优先级,抢占模式下,优先级高的获得VIP
  advert_int 1
  authentication {
  auth_type PASS
  auth_pass 1111
}
virtual_ipaddress {
  10.0.3.250  # VIP的地址
}

track_script {
  chk_nginx
  }
}

---------------------------

interface enp0s8 绑定的网卡

virtual_router_id 51 # id

posted @ 2020-09-11 13:36  ucsgroup  阅读(142)  评论(0)    收藏  举报