카테고리 없음

[HA] HAProxy Install

twoDeveloper 2024. 7. 2. 10:02

[ 개요 ]

* HAProxy를 통해 clickhouse query 분산 수행

* 서버 부하 최소화

 

[ 설치 ]

* OS : Ubuntu 20.04

* HAProxy : 2.0.33

 

1. HAProxy Install

$ sudo apt update
$ sudo apt install haproxy

$ haproxy -v
HA-Proxy version 2.0.33-0ubuntu0.1 2023/10/31 - https://haproxy.org

 

2. HAProxy Staticstic 설정

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  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

listen haproxy-monitoring
  bind *:20070
  stats enable
  stats uri /
  stats realm Haproxy\ Statistics

- default 하위에 haproxy 상태 페이지 설정 값 적용

- (*) 모든 네트워크 인터페이스에 대해서 20070 port로 접근 가능하도록 bind

- stats enable 은 haproxy 상태 페이지를 활성화

- stats uri 는 상태 페이지에 접근하기 위한 URI 경로를 지정

  - ex) '/'는 루트 경로를 의미하며, 'http://<server_ip>:20070/' 주소로 상태 페이지에 접근 가능

 

* 상태 페이지를 통해 HAProxy의 현재 상태, 각 백엔드 및 프론트엔드 서버의 상태, 세션 수, 응답 시간 등 다양한 성능 지표를 실시간으로 모니터링할 수 있습니다.

 

[ 상태 페이지 ]