加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

keepalived的配置文件

发布时间:2016-10-02 07:28:32 所属栏目:Linux 来源:站长网
导读:! 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
! 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        #健康检查端口   
     }

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读