"HAProxy"의 두 판 사이의 차이
잔글 (→HAProxy 설치) |
잔글 |
||
(같은 사용자의 중간 판 14개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
LoadBalance와 Proxy 기능을 제공하는 HAProxy를 정리 합니다. | LoadBalance와 Proxy 기능을 제공하는 HAProxy를 정리 합니다. | ||
− | |||
− | |||
− | |||
− | |||
− | + | *홈페이지 : http://www.haproxy.org/, [https://github.com/cbonte/haproxy-dconv https://github.com/cbonte/haproxy-dconv] | |
− | + | **매뉴얼 : [http://cbonte.github.io/haproxy-dconv/index.html http://cbonte.github.io/haproxy-dconv/index.html] | |
− | * | + | **[http://cbonte.github.io/haproxy-dconv/configuration-1.5.html http://cbonte.github.io/haproxy-dconv/configuration-1.5.html] |
− | + | **[http://cbonte.github.io/haproxy-dconv/configuration-1.4.html http://cbonte.github.io/haproxy-dconv/configuration-1.4.html] | |
+ | *다운로드 : http://www.haproxy.org/#down | ||
+ | *라이선스 : [[GNU GPLv2|GNU GPLv2]], ... | ||
+ | *플랫폼 : C | ||
− | + | == HAProxy 개요 == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | *HAProxy | + | HAProxy는 L4 Switch, L7 Switch와 Load Balance 기능을 소프트웨어적으로 제공 한다. 초당 8만건의 트래픽을 처리 한다. |
− | + | ||
− | + | Load Balance 기술 | |
+ | |||
+ | *NAT (Network Address Translation) | ||
+ | *DSR (Dynamic Source Routing) | ||
+ | *Tunneling | ||
+ | |||
+ | |||
+ | |||
+ | Load Balance 동작 모드 | ||
+ | |||
+ | *Bridge/Transparent Mode : 목적지 IP와 MAC 주소를 재설정 | ||
+ | *Router Mode : 출발지와 목적지의 IP와 MAC 주소를 재설정 | ||
+ | *One Arm Mode : <span style="line-height: 20.7999992370605px;">목적지 IP와 MAC 주소를 재설정, 응답시 IP pool의 주소를 사용</span> | ||
+ | *<span style="line-height: 20.7999992370605px;">DSR (Direct Server Return) Mode : 목적지 MAC 주소를 재설정</span> | ||
+ | |||
+ | == HAProxy 설치 == | ||
+ | |||
+ | [[CentOS|CentOS]]에서 HAProxy를 설치 합니다. | ||
+ | |||
+ | {| cellspacing="1" cellpadding="1" style="color: rgb(0, 0, 0); font-family: sans-serif; line-height: 20.7999992370605px; width: 100%;" | ||
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | yum install haproxy | ||
+ | |||
+ | service haproxy start<br/> #chkconfig haproxy on | ||
+ | |||
+ | |} | ||
+ | |||
+ | <br/>HAProxy 설정 파일 | ||
+ | |||
+ | */etc/haproxy/haproxy.cfg | ||
+ | |||
+ | == HAProxy 설정 == | ||
+ | |||
+ | === HAProxy 1.4.24 기본 설정 === | ||
+ | |||
+ | vi /etc/haproxy/haproxy.cfg | ||
+ | |||
+ | {| cellspacing="1" cellpadding="1" style="color: rgb(0, 0, 0); font-family: sans-serif; line-height: 20.7999992370605px; width: 859px;" | ||
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | global #--- Global 설정<br/> log 127.0.0.1 local2 | ||
+ | |||
+ | chroot /var/lib/haproxy<br/> pidfile /var/run/haproxy.pid<br/> maxconn 4000<br/> user haproxy<br/> group haproxy<br/> daemon | ||
+ | |||
+ | stats socket /var/lib/haproxy/stats | ||
+ | |||
+ | defaults #--- Default 설정<br/> mode http #--- 처리할 프로토콜 지정 (http, tcp)<br/> log global<br/> option httplog<br/> option dontlognull<br/> option http-server-close<br/> option forwardfor except 127.0.0.0/8<br/> option redispatch<br/> retries 3<br/> timeout http-request 10s<br/> timeout queue 1m<br/> timeout connect 10s<br/> timeout client 1m<br/> timeout server 1m<br/> timeout http-keep-alive 10s<br/> timeout check 10s<br/> maxconn 3000 | ||
+ | |||
+ | frontend main *:5000 #--- 모든 IP의 5000 port 요청에 대한 처리 설정<br/> #--- 시작 url과 종료 url로 url_static를 설정 합니다.<br/> acl url_static path_beg -i /static /images /javascript /stylesheets<br/> acl url_static path_end -i .jpg .gif .png .css .js | ||
+ | |||
+ | use_backend static if url_static #--- url_static 요청은 static backend에서 처리 합니다.<br/> default_backend app #--- Default 요청은 app backend에서 처리 합니다. | ||
+ | |||
+ | backend static #--- static backend 설정<br/> balance roundrobin<br/> server static 127.0.0.1:4331 check | ||
+ | |||
+ | backend app #--- app backend 설정<br/> balance roundrobin<br/> server app1 127.0.0.1:5001 check<br/> server app2 127.0.0.1:5002 check<br/> server app3 127.0.0.1:5003 check<br/> server app4 127.0.0.1:5004 check | ||
+ | |||
+ | |} | ||
+ | |||
+ | === Load Balance 설정 === | ||
+ | |||
+ | vi /etc/haproxy/haproxy.cfg | ||
+ | |||
+ | {| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 859px;" | ||
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | <font color="#333333" face="sans-serif, Arial, Verdana, Trebuchet MS">frontend main *:5000 #--- 모든 IP의 5000 port 요청에 대한 처리 설정<br/> #--- 시작 url과 종료 url로 url_static를 설정 합니다.<br/> acl url_static path_beg -i /static /images /javascript /stylesheets<br/> acl url_static path_end -i .jpg .gif .png .css .js<br/> </font>acl is_ossbiz hdr_end(host) -i www.ossbiz.co.kr #--- 호스트명 | ||
+ | |||
+ | <font color="#333333" face="sans-serif, Arial, Verdana, Trebuchet MS"> use_backend static if url_static #--- url_static 요청은 static backend에서 처리 합니다.<br/> use_backend ossbiz if is_ossibz #--- is_ossbiz 요청은 ossbiz backend에서 처리 합니다.<br/> default_backend jopenbusiness #--- Default 요청은 jopenbusiness backend에서 처리 합니다.</font> | ||
+ | |||
+ | <font color="#333333" face="sans-serif, Arial, Verdana, Trebuchet MS">backend static #--- static backend 설정<br/> balance roundrobin<br/> server static 127.0.0.1:4331 check</font> | ||
+ | |||
+ | <font color="#333333" face="sans-serif, Arial, Verdana, Trebuchet MS">backend ossbiz<br/> balance roundrobin<br/> server ossbiz01 127.0.0.1:8101 check</font> | ||
+ | |||
+ | <font color="#333333" face="sans-serif, Arial, Verdana, Trebuchet MS">backend jopenbusiness #--- app backend 설정<br/> balance roundrobin<br/> server app1 127.0.0.1:8001 check<br/> server app2 127.0.0.1:8002 check</font> | ||
+ | |||
+ | |} | ||
+ | |||
+ | === Cluster 설정 === | ||
+ | |||
+ | ppp | ||
+ | |||
+ | == 참고 문헌 == | ||
− | |||
*[http://helloworld.naver.com/helloworld/284659 L4/L7 스위치의 대안, 오픈 소스 로드 밸런서 HAProxy, 2013.02] | *[http://helloworld.naver.com/helloworld/284659 L4/L7 스위치의 대안, 오픈 소스 로드 밸런서 HAProxy, 2013.02] | ||
− | *http://blog.daum.net/sssssssim/3 | + | *[http://blog.daum.net/sssssssim/3 http://blog.daum.net/sssssssim/3] |
− | + | *[http://blog.silverbucket.net/post/31927044856/3-ways-to-configure-haproxy-for-websockets http://blog.silverbucket.net/post/31927044856/3-ways-to-configure-haproxy-for-websockets] | |
− | *http://blog.silverbucket.net/post/31927044856/3-ways-to-configure-haproxy-for-websockets | + | [[Category:Network|Category:Network]]<br/>[[Category:Cloud|Category:Cloud]] |
− | |||
− | |||
− | [[Category:Network]] | ||
− | [[Category:Cloud]] |
2015년 6월 19일 (금) 09:17 기준 최신판
LoadBalance와 Proxy 기능을 제공하는 HAProxy를 정리 합니다.
- 홈페이지 : http://www.haproxy.org/, https://github.com/cbonte/haproxy-dconv
- 다운로드 : http://www.haproxy.org/#down
- 라이선스 : GNU GPLv2, ...
- 플랫폼 : C
목차
HAProxy 개요
HAProxy는 L4 Switch, L7 Switch와 Load Balance 기능을 소프트웨어적으로 제공 한다. 초당 8만건의 트래픽을 처리 한다.
Load Balance 기술
- NAT (Network Address Translation)
- DSR (Dynamic Source Routing)
- Tunneling
Load Balance 동작 모드
- Bridge/Transparent Mode : 목적지 IP와 MAC 주소를 재설정
- Router Mode : 출발지와 목적지의 IP와 MAC 주소를 재설정
- One Arm Mode : 목적지 IP와 MAC 주소를 재설정, 응답시 IP pool의 주소를 사용
- DSR (Direct Server Return) Mode : 목적지 MAC 주소를 재설정
HAProxy 설치
CentOS에서 HAProxy를 설치 합니다.
yum install haproxy service haproxy start |
HAProxy 설정 파일
- /etc/haproxy/haproxy.cfg
HAProxy 설정
HAProxy 1.4.24 기본 설정
vi /etc/haproxy/haproxy.cfg
global #--- Global 설정 chroot /var/lib/haproxy stats socket /var/lib/haproxy/stats defaults #--- Default 설정 frontend main *:5000 #--- 모든 IP의 5000 port 요청에 대한 처리 설정 use_backend static if url_static #--- url_static 요청은 static backend에서 처리 합니다. backend static #--- static backend 설정 backend app #--- app backend 설정 |
Load Balance 설정
vi /etc/haproxy/haproxy.cfg
frontend main *:5000 #--- 모든 IP의 5000 port 요청에 대한 처리 설정 use_backend static if url_static #--- url_static 요청은 static backend에서 처리 합니다. backend static #--- static backend 설정 backend ossbiz backend jopenbusiness #--- app backend 설정 |
Cluster 설정
ppp