标签:instance color mil virtual etc tin nec ace glob
下载keepalived
上面实验基础上删除lb01上的虚拟IP
[root@lb01 ~]# ip addr del 10.0.0.3/24 dev eth0 label eth0:0 [root@lb01 ~]# yum -y install keepalived [root@lb01 ~]# rpm -qa |grep keepalived keepalived-1.2.13-5.el6_6.x86_64
修改keepalived的配置文件
lb01上的keepalived的配置文件
global_defs { router_id LVS_01 } vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 51 priority 150 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.3/24 dev eth0 label eth0:1 } } virtual_server 10.0.0.3 80 { delay_loop 6 lb_algo wrr lb_kind DR nat_mask 255.255.255.0 persistence_timeout 50 protocol TCP real_server 10.0.0.7 80 { weight 1 TCP_CHECK { connect_timeout 8 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 10.0.0.8 80 { weight 1 TCP_CHECK { connect_timeout 8 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } } lb02上的keepalived的配置文件 global_defs { router_id LVS_02 } vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.3/24 dev eth0 label eth0:1 } } virtual_server 10.0.0.3 80 { delay_loop 6 lb_algo wrr lb_kind DR nat_mask 255.255.255.0 persistence_timeout 50 protocol TCP real_server 10.0.0.7 80 { weight 1 TCP_CHECK { connect_timeout 8 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 10.0.0.8 80 { weight 1 TCP_CHECK { connect_timeout 8 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } }
启动keepalived并测试
[root@lb02 ~]# /etc/init.d/keepalived restart Stopping keepalived: [ OK ] Starting keepalived: [ OK ]
打开浏览器
等50秒后刷新浏览器
标签:instance color mil virtual etc tin nec ace glob
原文地址:https://www.cnblogs.com/HByang/p/9155714.html