码迷,mamicode.com
首页 > 其他好文 > 详细

VRRP笔记三:配置keepalived为实现haproxy高可用的双主模型配置文件示例:

时间:2017-02-14 12:17:51      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:pad   amp   route   server   eve   evel   file   instance   log   

说明:其基本实现思想为创建两个虚拟路由器,并以两个节点互为主从。
 
! Configuration File for keepalived  
  
global_defs {  
   notification_email {  
         linuxedu@foxmail.com
         mageedu@126.com  
   }  
   notification_email_from kanotify@magedu.com 
   smtp_connect_timeout 3  
   smtp_server 127.0.0.1  
   router_id LVS_DEVEL  
}  
 
vrrp_script chk_haproxy {  
    script "killall -0 haproxy"  
    interval 1  
    weight 2  
}  
 
vrrp_script chk_mantaince_down {
   script "[[ -f /etc/keepalived/down ]] && exit 1 || exit 0"
   interval 1
   weight 2
}
 
vrrp_instance VI_1 {  
    interface eth0  
    state MASTER  # BACKUP for slave routers
    priority 101  # 100 for BACKUP
    virtual_router_id 51 
    garp_master_delay 1 
  
    authentication {  
        auth_type PASS  
        auth_pass password  
    }  
    track_interface {  
       eth0    
    }  
    virtual_ipaddress {  
        172.16.100.1/16 dev eth0 label eth0:0 
    }  
    track_script {  
        chk_haproxy  
        chk_mantaince_down
    }  
  
 
    notify_master "/etc/keepalived/notify.sh master"  
    notify_backup "/etc/keepalived/notify.sh backup"  
    notify_fault "/etc/keepalived/notify.sh fault"  
} 
 
vrrp_instance VI_2 {  
    interface eth0  
    state BACKUP  # BACKUP for slave routers
    priority 100  # 100 for BACKUP
    virtual_router_id 52
    garp_master_delay 1 
  
    authentication {  
        auth_type PASS  
        auth_pass password  
    }  
    track_interface {  
       eth0    
    }  
    virtual_ipaddress {  
        172.16.100.2/16 dev eth0 label eth0:1
    }  
    track_script {  
        chk_haproxy  
        chk_mantaince_down
    }    
}
 
 
说明:
1、对于VI_1和VI_2来说,两个节点要互为主从关系;

 

VRRP笔记三:配置keepalived为实现haproxy高可用的双主模型配置文件示例:

标签:pad   amp   route   server   eve   evel   file   instance   log   

原文地址:http://www.cnblogs.com/djoker/p/6396768.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!