天天看點

centos7配置haproxy

伺服器清單:

haproxy伺服器配置:

a. 内網配置:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

centos7配置haproxy

b. 外網配置:

cat /etc/sysconfig/network-scripts/ifcfg-eth1

centos7配置haproxy

c. 安裝:

yum -y install haproxy

d. 修改配置檔案:

vim /etc/haproxy/haproxy.conf

centos7配置haproxy

e. 配置檔案原代碼:

f. 配置rsyslog:

vim /etc/rsyslog.conf,去掉如下行的注釋:

centos7配置haproxy

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伺服器配置:

centos7配置haproxy

b. 關閉防火牆:

systemctl stop firewalld

web2伺服器配置(參照web1):

浏覽器通路(192.168.8.252):

a. 頁面一:

centos7配置haproxy

b. 頁面二:

centos7配置haproxy

 本文轉自 Lee_吉 51CTO部落格,原文連結:http://blog.51cto.com/12173069/2061851