keepalived.conf 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ! Configuration File for keepalived
  2. global_defs {
  3. notification_email {
  4. acassen@firewall.loc
  5. failover@firewall.loc
  6. sysadmin@firewall.loc
  7. }
  8. notification_email_from Alexandre.Cassen@firewall.loc
  9. smtp_server 192.168.200.1
  10. smtp_connect_timeout 30
  11. router_id LVS_DEVEL
  12. vrrp_skip_check_adv_addr
  13. vrrp_garp_interval 0
  14. vrrp_gna_interval 0
  15. }
  16. vrrp_instance VI_1 {
  17. #注意主备参数选择
  18. state BACKUP #无常主模式初始角色,均填写 BACKUP
  19. #state BACKUP #备
  20. interface eth0 #改成本机网卡名 例如 eth0
  21. virtual_router_id 51
  22. nopreempt #非抢占模式
  23. # preempt_delay 10
  24. priority 50 #无常主模式大小相同
  25. advert_int 1
  26. authentication {
  27. auth_type PASS
  28. auth_pass 1111
  29. }
  30. unicast_src_ip 172.18.0.13 # 修改本机内网 IP
  31. unicast_peer {
  32. 172.18.0.16 #修改为对端设备的 IP 地址
  33. }
  34. virtual_ipaddress {
  35. 172.18.0.253 #修改为内网 VIP
  36. }
  37. notify_master "/etc/keepalived/notify_action.sh MASTER"
  38. notify_backup "/etc/keepalived/notify_action.sh BACKUP"
  39. notify_fault "/etc/keepalived/notify_action.sh FAULT"
  40. notify_stop "/etc/keepalived/notify_action.sh STOP"
  41. garp_master_delay 1
  42. garp_master_refresh 5
  43. track_interface {
  44. eth0 #改成本机网卡名 例如 eth0
  45. }
  46. track_script {
  47. checkhaproxy
  48. }
  49. }