Haproxy安裝配置(二)
阿新 • • 發佈:2019-01-21
tex mage c++ fff art tar ffffff eal -c 1.yum安裝
yum install net-tools vim tree screen lsof tcpdump nc mtr nmap gcc glibc gcc-c++ make haproxy keepalived nginx timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms option httpchk HEAD / HTTP/1.0
balance source #源IP roundrobin輪詢
server web-node1 192.168.168.32:8080 check inter 2000 rise 30 fall 15
server web-node2 192.168.168.33:8080 check inter 2000 rise 30 fall 15
yum install net-tools vim tree screen lsof tcpdump nc mtr nmap gcc glibc gcc-c++ make haproxy keepalived nginx
2.haproxy.cfg配置文件
global
maxconn 100000
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
nbproc 1
pidfile /var/run/haproxy.pid
log 127.0.0.1 local3 info
defaults
option http-keep-alive
maxconn 100000
mode http
timeout client 50000ms
timeout server 50000ms
listen stats
mode http
bind 0.0.0.0:8888
stats enable
stats uri /haproxy-status
stats auth haproxy:haproxy
frontend main
bind 192.168.168.32:80
mode http
option httplog
log global
default_backend backend_test
backend backend_test
option forwardfor header X-REAL-IP
balance source #源IP roundrobin輪詢
server web-node1 192.168.168.32:8080 check inter 2000 rise 30 fall 15
server web-node2 192.168.168.33:8080 check inter 2000 rise 30 fall 15
3.啟動
systemctl start haproxy
nginx請自己配置
http://192.168.1.1:8888/haproxy-status
Haproxy安裝配置(二)