keepalived的配置

来源:互联网 发布:wap商城源码 编辑:程序博客网 时间:2024/06/08 14:21

安装完keepadlived以后,配置keepalived.conf
MASTER:

vim /etc/keepalived/keepalived.conf! Configuration File for keepalived global_defs {   notification_email {    49000448@qq.com   }   notification_email_from Alexandre.Cassen@firewall.loc   smtp_server 127.0.0.1   smtp_connect_timeout 30   router_id LVS_3     //BACKUP:router_id LVS_1}vrrp_instance VI_1 {               ##代表一个模块儿,可以有多个    state MASTER        //BACKUP:BACKUP         interface eno16777736      ##添加VIP的网卡    virtual_router_id 51        ##指定VRRP实例ID,范围是0-255    priority 150              //BACKUP:100    advert_int 1    authentication {        auth_type PASS     ##密码类型:明文        auth_pass 1111     ##密码是1111    }    virtual_ipaddress {      ##VIP地址      192.168.202.29/24     }}virtual_server 192.168.202.29 80 {     ##VIP地址    delay_loop 6                lb_algo wrr                ##算法    lb_kind DR                ##模式    nat_mask 255.255.255.0    ##子网掩码    persistence_timeout 50         protocol TCP                    real_server 192.168.202.103 80 {        weight 1                      TCP_CHECK {        connect_timeout 8               nb_get_retry 3        delay_before_retry 3        connect_port 80        }    }    real_server 192.168.202.104 80 {        weight 1                      TCP_CHECK {        connect_timeout 8               nb_get_retry 3        delay_before_retry 3        connect_port 80        }    }}