Computer ???
No. | 487 |
Name. | swindler |
Subject. | HAProxy 실제 설정파일과 설정방법 |
Main Cate. | Linux |
Sub Cate. | |
Date. | 2017-12-27 14:12 |
Hit. | 2522 (125.131.199.20) |
File. | |
HAProxy 1.8.1 버전기준으로 작성 설정파일에 대한 자세한 설명은 다음 사이트에서 확인 가능하다. https://cbonte.github.io/haproxy-dconv/ 섹션은 global, defaults, frontend, backend, listen 등으로 구성된다. global - 프로세스 전체의 섹션 defaults - global에 종속, proxy mode, timeout 등 설정 frontend - 연결에 필요한 virtual ip에 관련된 설정을 함. 여기서 설정된 ip는 backend로 forward 됨 backend - frontend에서 연결을 받을 실제 server 관련 설정임. global daemon # 데몬 형식으로 fork 하면서 실행, 설정하지 않으면 백그라운드로 돌려야 됨. maxconn 512 # 최대 연결수를 지정한다. ulimit -n 을 통해 프로세스가 오픈할 수 있는 갯수만큼 지정할 수 있다. defaults mode http # tcp/http/health 3가지 모드가 있다. 기본은 tcp 이며 해당 포트에 대한 프록시로 사용가능하고, health는 단순히 check하는 모드이다. timeout connect 5s # 클라이언트에서 real 서버까지의 timeout timeout client 50s # 클라이언트에서 frontend 까지의 timeout timeout server 50s # frontend에서 실제 서버까지의 timeout frontend http-in # frontend <name> 으로 작성하고, 뒤에서 설정한다. bind *:80 # default_backend servers # 뒷부분을 backend에서 설정한 이름이다. backend servers server server1 1.1.1.1:80 /etc/haproxy/haproxy.cfg 파일 -------------------------- global daemon maxconn 256 defaults option forwardfor stats enable stats uri /hapxory mode http timeout connect 5s timeout server 50s timeout client 50s frontend http-in bind *:80 default_backend servers backend servers mode http balance roundrobin cookie SERVERID insert indirect nocache server s1 172.187.1.11:80 check inter 5000 fastinter 1000 rise 1 fall 1 weight 1 server s2 172.187.1.12:80 check inter 5000 fastinter 1000 rise 1 fall 1 weight 1 -------------------------- 실행방법 haproxy -f /etc/haproxy/haproxy.cfg [바로가기 링크] : http://coolx.net/cboard/computer/487 |
|
|
|
[Modify] [Delete] | [Reply] [List] |