wget https://fossies.org/linux/misc/haproxy-1.8.14.tar.gz
tar zxvf haproxy-1.8.14.tar.gz
cd haproxy-1.8.14
make TARGET=linux31
make install PREFIX=/data/haproxy
mkdir /data/haproxy/{conf,logs}
cp examples/option-http_proxy.cfg /data/haproxy/conf/haproxy.cfg
vi /data/haproxy/conf/haproxy.cfg
global
daemon
nbproc 1
pidfile /data/haproxy/conf/haproxy.pid
defaults
mode tcp
retries 2
option redispatch
option abortonclose
balance roundrobin
maxconn 102400
timeout connect 5000ms
timeout client 30000ms
timeout server 30000ms
#timeout check 2000
log 127.0.0.1 local0 info
listen test1
bind 0.0.0.0:9999
mode tcp
server s1 yourip:yourport check weight 1 inter 2000 rise 2 fall 3
#server s2
listen admin_stats
bind 0.0.0.0:1688
mode http
log 127.0.0.1 local0 err
stats refresh 30s
stats uri /haproxy-status
stats realm welcome login\ Haproxy
stats auth admin:admin
stats hide-version
stats admin if TRUE
保存退出,
./haproxy -f ../conf/haproxy.cfg