伺服器清單:
haproxy伺服器配置:
a. 内網配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth0

b. 外網配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth1
c. 安裝:
yum -y install haproxy
d. 修改配置檔案:
vim /etc/haproxy/haproxy.conf
e. 配置檔案原代碼:
f. 配置rsyslog:
vim /etc/rsyslog.conf,去掉如下行的注釋:
g. 建立rsyslog的haproxy配置檔案:
vim /etc/rsyslog.d/haproxy.conf,寫入如下内容:
h. 重新開機rsyslog:
systemctl restart rsyslog
i. 啟動haproxy:
systemctl start haproxy
j. 關閉apache:
systemctl stop httpd
web1伺服器配置:
b. 關閉防火牆:
systemctl stop firewalld
web2伺服器配置(參照web1):
浏覽器通路(192.168.8.252):
a. 頁面一:
b. 頁面二:
本文轉自 Lee_吉 51CTO部落格,原文連結:http://blog.51cto.com/12173069/2061851