centos7配置haproxy
生活随笔
收集整理的這篇文章主要介紹了
centos7配置haproxy
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
a. 內(nèi)網(wǎng)配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
b. 外網(wǎng)配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth1
c. 安裝:
yum -y install haproxy
d. 修改配置文件:
vim /etc/haproxy/haproxy.conf
e. 配置文件原代碼:global log 127.0.0.1 local2 # 日志 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 listen haproxy3-monitoring *:80 # Haproxy Monitoring 的使用端口:80 mode http option forwardfor option httpclose stats enable stats show-legends stats refresh 5s stats uri /stats stats realm Haproxy\ Statistics stats auth testuser:test1234 stats admin if TRUE default_backend app-main frontend main bind *:80 option http-server-close option forwardfor default_backend app-main backend app-main balance roundrobin option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost server server1 192.168.8.83:80 check server server2 192.168.8.84:80 check
f. 配置rsyslog:
vim /etc/rsyslog.conf,去掉如下行的注釋:
g. 創(chuàng)建rsyslog的haproxy配置文件:
vim /etc/rsyslog.d/haproxy.conf,寫(xiě)入如下內(nèi)容:
h. 重啟rsyslog:
systemctl restart rsyslog
i. 啟動(dòng)haproxy:
systemctl start haproxy
j. 關(guān)閉apache:
systemctl stop httpd
a. 內(nèi)網(wǎng)配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
b. 關(guān)閉防火墻:
systemctl stop firewalld
a. 頁(yè)面一:
b. 頁(yè)面二:
總結(jié)
以上是生活随笔為你收集整理的centos7配置haproxy的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 理解图形化执行计划 -- 第3部分:分析
- 下一篇: Wordpress安装简要说明