安装httpd服务 写好网页文件
启动服务
image
多主模型IPVS示例

配置keepalive
高可用的ipvs集群示例:修改keepalived配置文件
修改主机:192.168.234.27的keepalived配置文件
| [root@234c27 keepalived]# vim /etc/keepalived/keepalived.conf global_defs { notification_email { root@localhost } notification_email_from keepalived@localhost smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id kpone vrrp _mcast_group4 234.10.10.10 } vrrp_instance VI_1 { state MASTER interface ens37 virtual_router_id 50 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.100/24 } } vrrp_instance VI_2 { state BACKUP interface ens37 virtual_router_id 51 priority 80 advert_int 1 authentication { auth_type PASS auth_pass 2222 } virtual_ipaddress { 10.0.0.200/24 } } virtual_server 10.0.0.100 80 { delay_loop 6 lb_algo wrr lb_kind DR #persistence_timeout 50 protocol TCP #sorry_server 127.0.0.1:80 real_server 192.168.234.47 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } } virtual_server 10.0.0.200 80 { delay_loop 6 lb_algo wrr lb_kind DR #persistence_timeout 50 protocol TCP #sorry_server 127.0.0.1:80 real_server 192.168.234.57 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } } |
修改主机:192.168.234.37的keepalived配置文件
| [root@234c37 ~]# vim /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { notification_email { root@localhost } notification_email_from keepalived@localhost smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id kptwo vrrp _mcast_group4 234.10.10.10 } vrrp_instance VI_1 { state BACKUP interface ens37 virtual_router_id 50 priority 80 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.100/24 } } vrrp_instance VI_2 { state MASTER interface ens37 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 2222 } virtual_ipaddress { 10.0.0.200/24 } } virtual_server 10.0.0.100 80 { delay_loop 6 lb_algo wrr lb_kind DR #persistence_timeout 50 protocol TCP #sorry_server 127.0.0.1:80 real_server 192.168.234.47 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } } virtual_server 10.0.0.200 80 { delay_loop 6 lb_algo wrr lb_kind DR #persistence_timeout 50 protocol TCP #sorry_server 127.0.0.1:80 real_server 192.168.234.57 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } } |








