vi /usr/local/haproxy/etc/haproxy.cfg


global
    maxconn 100000
    log /dev/log local0 notice
 
defaults
    mode tcp
    log global
 
    option redispatch
    stats enable
    retries 3
 
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms
 
listen admin_stats :8964
    mode http
    stats enable
    stats uri /monitor
 
frontend bbs
    bind :29099
    default_backend bbs
 
backend bbs
    balance leastconn
    server bbs-app-1_16400 bbs-app-1.prod.com:16400 weight 1 maxconn 4096 check inter 1000
    server bbs-app-2_16400 bbs-app-2.prod.com:16400 weight 1 maxconn 4096 check inter 1000
    server bbs-app-03_16400 bbs-app-3.prod.com:16400 weight 1 maxconn 4096 check inter 1000
 
frontend www
    bind :29090
    default_backend www
 
backend www
    balance leastconn
    server bbs-app-1_16400 bbs-app-1.prod.com:16400 weight 1 maxconn 4096 check inter 1000
    server bbs-app-2_16400 bbs-app-2.prod.com:16400 weight 1 maxconn 4096 check inter 1000
    server bbs-app-03_16400 bbs-app-3.prod.com:16400 weight 1 maxconn 4096 check inter 1000