# apt-get install haproxy

# vi /etc/default/haproxy


# root@node01:/etc/keepalived# cat /etc/default/haproxy

# Set ENABLED to 1 if you want the init script to start haproxy.

ENABLED=0 -> 1 //수정

# Add extra flags here.

#EXTRAOPTS="-de -m 16"


https://serversforhackers.com/load-balancing-with-haproxy 파라미터 값 참조

Load Balancing Configuration

To get started balancing traffic between our three HTTP listeners, we need to set some options within HAProxy:

  • frontend - where HAProxy listens to connections
  • backend - Where HAPoxy sends incoming connections
  • stats - Optionally, setup HAProxy web tool for monitoring the load balancer and its nodes



global

        log /dev/log    local0

        log /dev/log    local1 notice

        chroot /var/lib/haproxy

        user haproxy

        group haproxy

        daemon


defaults

        log     global

        mode    http

        option  httplog

        option  dontlognull

        retries 3

        redispatch

        maxconn 2000

        contimeout 5000

        clitimeout 50000

        srvtimeout 50000

        errorfile 400 /etc/haproxy/errors/400.http

        errorfile 403 /etc/haproxy/errors/403.http

        errorfile 408 /etc/haproxy/errors/408.http

        errorfile 500 /etc/haproxy/errors/500.http

        errorfile 502 /etc/haproxy/errors/502.http

        errorfile 503 /etc/haproxy/errors/503.http

        errorfile 504 /etc/haproxy/errors/504.http


frontend http-in

        mode http

        bind *:80

        log global

        option httplog

        default_backend servers


backend servers

        mode http

        balance roundrobin

        option forwardfor

        server web01 192.168.100.103:80 check


###

Try http://x.x.x.x:3000/stats  URL to login into statistics report for HAProxy.


listen stats *:3000  //

        mode http

        stats enable

        stats uri /stats

        stats hide-version

        stats auth admin:admin




'나만의 Cloud' 카테고리의 다른 글

go PATH 설정  (2) 2017.03.17
pacemaker  (0) 2016.11.23
ubuntu apache2 포트 변경 및 DocumentRoot 변경  (0) 2016.06.02
SLA  (0) 2016.05.09
ubuntu keepalived  (0) 2016.04.20
Posted by 뭉탁거림
,