layout: post
title: keepalived—nginx配置模板
date: 2018-03-13
tags: [“Cluster services”,”软件服务”]


  1. global_defs { ####全局定义
  2. notification_email { #####指定keepalived在发生事件时(比如切换),需要发送的email象,可以多个,每行一个
  3. yangzl@19e.com.cn
  4. }
  5. notification_email_from 123@qq.com
  6. smtp_server 127.0.0.1 #####指定发送email的smtp服务器
  7. smtp_connect_timeout 30
  8. router_id LVS_DEVEL1 #######运行keepalived的机器的一个标识
  9. }
  10. vrrp_script Monitor_Nginx {
  11. script "/cron/nginx/nginxCheck.sh"
  12. interval 4
  13. weight 2
  14. }
  15. vrrp_instance VI_1 {
  16. state MASTER
  17. # state BACkUP
  18. interface bond0
  19. virtual_router_id 111 #VRID标记 master和backup必须一致
  20. #发送多播包的地址,如果不设置默认使用绑定的网卡的primary ip
  21. priority 150
  22. advert_int 1
  23. authentication {
  24. auth_type PASS
  25. auth_pass 1111
  26. }
  27. track_script {
  28. Monitor_Nginx ### 就是上面vrrp_script后面的实例名称 执行监控的服务
  29. }
  30. virtual_ipaddress {
  31. 10.16.12.30/32 brd 10.16.12.30 dev bond0 label bond0:9
  32. }
  33. }
文档更新时间: 2018-12-20 11:15   作者:张尚