Installation of Apache2, Vim, keepalived and Ipvsadm
Open vim/etc/keepalived/keepalived.conf
Click I, enter the edit status, enter:
! Configuration File for keepalivedglobal_defs { router_id lvsmaster}vrrp_instance vi_1 {State MASTER Interface ENS33 # External service nic virtual_router_id #VRRP组名, two node settings must be the same to indicate that each node belongs to the same vrrp> group priority 100 # The priority of the primary node (between 1-254), the standby node must be lower than the primary node priority Advert_int 1 #设置主备之间同步检查的时间间隔单位秒 authentication {#设置验证信息, two nodes must be consistent Auth_type PASS auth_pass abcd123 } virtual_ipaddress {#指定虚拟IP, two node settings must be the same 192.168.144.200 } }virtual_server 192.168.144.200 { delay_loop 6 Lb_algo rr lb_kind DR persistence_timeout 0 protocol TCP real_server 192.168.144.128 { weight 1 tcp_check { connect_timeout Nb_get_retry 3 delay_before_retry 3 connect_port }} }
Then click ESC, Exit Edit, enter: Wq hold.
Start Service keepalived Start
Edit apache2 Default Page index.html
Start LAN Access lvs:192.168.144.200
Ubuntu64 apache2+lvs+keepalived