티스토리 뷰

$ apt-get install --no-install-recommends software-properties-common
$ add-apt-repository ppa:vbernat/haproxy-2.6
$ apt-get install haproxy=2.6.\*
$ cd /etc/haproxy
$ root:/etc/haproxy# cp haproxy.cfg haproxy.bak
$ root:/etc/haproxy# vi haproxy.cfg
global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        pidfile       /var/run/haproxy/haproxy.pid
        ulimit-n      655350
        maxconn       100000
        user haproxy
        group haproxy
        daemon

listen  192.168.0.5 # 웹으로 접속할 IP
        bind :8000   # 포트 설정
        mode http
        log global
        stats enable
        option dontlog-normal
        stats enable
        stats refresh 10s
        stats realm Haproxy\ Statistics
        stats auth id:pw
        stats uri /
        http-request use-service prometheus-exporter if { path /metrics }

        # Default SSL material locations
        #ca-base /etc/ssl/certs
        #crt-base /etc/ssl/private

        # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
        #ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
        #ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
        #ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        option  tcplog
        option  tcpka
        timeout queue           1m
        timeout connect         5s
        timeout client          480m
        timeout server          480m
        timeout check           5s

frontend http-haproxy
        bind *:9080 # listening 되어야 하는 IP,PORT 설정
        mode http
        default_backend http-backend # default_backend를 servers 로 설정

backend http-backend
    balance roundrobin
    mode http
    option forwardfor
    option httpchk GET /
    http-check expect string OK
    http-request set-header X-Forwarded-Port %[dst_port]
    server websrv1 127.0.0.1:19090 check inter 1s fastinter 500ms rise 1 fall 1 weight 1
    server websrv2 127.0.0.1:19091 check inter 1s fastinter 500ms rise 1 fall 1 weight 1

 

 

 

 

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함