Last active
August 29, 2015 14:10
-
-
Save JohnKim/31813552e7f89604cad1 to your computer and use it in GitHub Desktop.
[XPUSH-HY] HAPROXY (public)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ 업데이트 | |
$ yum remove matahari* | |
$ yum update | |
~ 서버 종류 확인하기. | |
$ lsb_release -a | |
~ 컴파일하기 위한 툴킷 설치 | |
$ yum -y groupinstall "Development Tools" | |
~ haproxy 다운로드 | |
$ wget http://www.haproxy.org/download/1.5/src/haproxy-1.5.9.tar.gz | |
$ tar xvzf haproxy-1.5.9.tar.gz | |
~ haproxy 컴파일 `uname -r` 로 TARGET 과 ARCH 확인. | |
$ make TARGET=linux1632 ARCH=x86_64 | |
$ make install | |
~ haproxy 기본 설정 | |
$ cp /usr/local/sbin/haproxy /usr/sbin/ | |
$ cp /root/haproxy-1.5.9/examples/haproxy.init /etc/init.d/haproxy | |
$ chmod 755 /etc/init.d/haproxy | |
$ mkdir -p /etc/haproxy | |
~ haproxy 설정 파일 작성 | |
$ vi /etc/haproxy/haproxy.cfg | |
global | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 debug | |
maxconn 45000 # Total Max Connections. This is dependent on ulimit | |
daemon | |
nbproc 1 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example. | |
defaults | |
timeout server 86400000 | |
timeout connect 86400000 | |
timeout client 86400000 | |
timeout queue 1000s | |
# [HTTP Site Configuration] | |
listen http_web 180.182.60.237:80 | |
mode http | |
balance roundrobin # Load Balancing algorithm | |
option httpchk | |
option forwardfor | |
server server1 public.session01:8001 weight 1 maxconn 512 check | |
server server2 public.session01:8002 weight 1 maxconn 512 check | |
# [HTTPS Site Configuration] | |
listen https_web 180.182.60.237:433 | |
mode tcp | |
balance source # Load Balancing algorithm | |
reqadd X-Forwarded-Proto:\ http | |
server server1 public.session01:4331 weight 1 maxconn 512 check | |
server server2 public.session01:4332 weight 1 maxconn 512 check | |
~ haproxy 시작 | |
$ service haproxy start | |
$ chkconfig haproxy on | |
~ 끝 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.percona.com/blog/2014/10/03/haproxy-give-me-some-logs-on-centos-6-5/