debian keepalived 双机配置

kevin.Zhu 发布于:2013-1-16 16:45 分类:负载均衡  有 8 人浏览,获得评论 0 条  

1. apt-get install keepalived
2. 在/etc/keepalived/ 目录新建文件 keepalived.conf
   =========内容如下:==============
   
! Configuration File for keepalived
global_defs {
   notification_email {     #需要通知的Email 
     example@xx.com

   }   
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP    #状态,有MASTER和BACKUP两种
    interface eth0  #网络接口
    virtual_router_id 70    #id 主从需相同
    mcast_src_ip 192.168.0.187      #广播自己的IP地址
    priority 50             # 权重 , master机高于slave机
    advert_int 1            # 
    authentication {        # 通信验证 , 主从机需相同
        auth_type PASS
        auth_pass 111111
    }   
    virtual_ipaddress {     #对外被访问的 虚拟IP地址 
        192.168.0.241
    }   
}