server1:
yum install httpd -y
cd /var/www/html
vim index.html
systemctl start httpd
vim /etc/httpd/conf/httpd.conf
systemctl start httpd
将端口改成8000
cd /etc/haproxy/
vim haproxy.cfg
systemctl restart haproxy.service
server3:
测试:
当动态访问时,实现轮询
当访问为静态时
server1 拿到 server3的资源
此时
vim haproxy.cfg
systemctl restart haproxy
只要server2不down掉,server1永远是备机