4、在2台Director Server(LVS_Master与)上分别配置Keepalived
[root@host1 ~]# less /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { router_id LVS_MASTER
#网上资料说这个值也需要修改,具体不详,之前我们线上的主备就一直是一样的 ^ ^还是修改一下吧! } vrrp_instance VI_1 { state MASTER
#LVS_Backup上修改成BACKUP interface eth0 virtual_router_id 51 priority 100
#LVS_Backup上修改成80 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.10.100 } } virtual_server 192.168.10.100 80 { delay_loop 6 lb_algo rr lb_kind DR nat_mask 255.255.255.0 persistence_timeout 50 protocol TCP real_server 192.168.10.3 80 { weight 1 TCP_CHECK { connect_timeout 10 nb_get_retry 3 connect_port 80 } } real_server 192.168.10.4 80 { weight 1 TCP_CHECK { connect_timeout 10 nb_get_retry 3 connect_port 80 } } }
BACKUP服务器同上配置,先安装lvs再按装keepalived,然后配置/etc/keepalived/keepalived.conf,只需将红色标示的部分改一下即可。
5、分别在2台Real Server上面编写脚本并启动