Skip to content

Instantly share code, notes, and snippets.

@shm007g
Created November 2, 2018 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shm007g/4d93c53d2a1b7df96e3e5572b71c4df0 to your computer and use it in GitHub Desktop.
Save shm007g/4d93c53d2a1b7df96e3e5572b71c4df0 to your computer and use it in GitHub Desktop.

replica and load-balance

  • apt-get install haproxy
  • vim /etc/haproxy/haproxy.cfg and add text below:
        stats   uri /stats
        stats   auth    sunmingming:solomon

frontend main
        bind *:80
        mode    http
        option  httplog
        log     global
        default_backend httppool

backend httppool
        balance roundrobin
        server hotwords 10.x0x.10x.4:80 maxconn 1024 check inter 2000 rise 2 fall 3
        server hotwords2 127.0.0.1:8000 maxconn 1024 check inter 2000 rise 2 fall 3
  • run haproxy haproxy -f /etc/haproxy/haproxy.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment