天堂1111 发表于 2018-12-29 09:57:24

keepalived 的配置文件

     ! Configuration File for keepalived
global_defs {
   notification_email { #发生事件切换的时候,发送的邮箱,可以有多个,每行一个
   itnihao@qq.com
   }
   notification_email_from itnihao@qq.com
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
   }
  
#VIP
vrrp_instance VI_1 {
   state MASTER         #备份服务器此处是BACKUP
   interface eth0         #实例绑定的网卡
   virtual_router_id 51   #标记(0...255)
   priority 100         #优先级,另一台改为90
   advert_int 1         #检查间隔,默认1s
   nopreempt            #不抢占,只在优先级高的机器上设置即可,优先级低的机器不设置
   authentication {       #认证
   auth_type PASS         #认证的方式,支持PASS和AH
   auth_pass 1111         #认证的密码
   }
   virtual_ipaddress {    #指定漂移地址(VIP)
   192.168.16.200         #如果有多个VIP,继续换行填写
   }
   }
  virtual_server 192.168.16.200 80 {#设置VIP port
   delay_loop 2         #每个2秒检查一次real_server状态
   lb_algo wrr            #LVS调度算法
   lb_kind DR             #LVS集群模式
   persistence_timeout 60 #会话保持时间
   protocol TCP         #使用协议TCP或者UDP
  real_server 192.168.16.253 80 {
   weight 3               #权重
#    notify_down "/root/realserver.sh start"#检测到服务down后执行的脚本
   TCP_CHECK {            #tcp健康检查
   connect_timeout 10   #连接超时时间
   nb_get_retry 3         #重连次数
   delay_before_retry 3   #重连间隔时间
   connect_port 80      #健康检查端口
   }
   }
   real_server 192.168.16.252 80 {
   weight 3               #权重
#    notify_down "/root/realserver.sh start"#检测到服务down后执行的脚本
   TCP_CHECK {
   connect_timeout 10   #连接超时时间
   nb_get_retry 3         #重连次数
   delay_before_retry 3   #重连间隔时间
   connect_port 80      #健康检查端口
   }




页: [1]
查看完整版本: keepalived 的配置文件