Haproxy 프로덕션 환경 구성 상세 정보
8064 단어 haproxy프로덕션 환경 구성 상세 정보
#/usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg -st `cat /var/run/haproxy.pid`
#################### ########################
####### , (OS) #########
global
maxconn 20480 #
log 127.0.0.1 local3 #[err warning info debug]
chroot /var/haproxy #chroot
uid 99 # uid
gid 99 #
daemon # haproxy
nbproc 1 # ( )
pidfile /var/run/haproxy.pid #haproxy pid ,
ulimit-n 65535 #ulimit
##################### ######################
## frontend,backend,listen ##
defaults
log global
mode http # (#7 http;4 tcp )
maxconn 20480 #
option httplog # http
option httpclose # http
option dontlognull #
option forwardfor # ip , Http Header ip
option redispatch #serverId ,
option abortonclose # ,
stats refresh 30 #
retries 3 #3 ,
balance roundrobin # ,
#balance source # , nginx ip_hash
#balance leastconn # ,
contimeout 5000 #
clitimeout 50000 #
srvtimeout 50000 #
timeout check 2000 #
#################### #######################
listen admin_status #Frontend Backend , ,
bind 0.0.0.0:65532 #
mode http #http 7
log 127.0.0.1 local3 err #
stats refresh 5s # 5
stats uri /admin?stats # url
stats realm itnihao\ itnihao #
stats auth admin:admin # admin,
stats auth admin1:admin1 # admin1
stats hide-version # HAproxy
stats admin if TRUE # / , (haproxy-1.4.9 )
errorfile 403 /etc/haproxy/errorfiles/403.http
errorfile 500 /etc/haproxy/errorfiles/500.http
errorfile 502 /etc/haproxy/errorfiles/502.http
errorfile 503 /etc/haproxy/errorfiles/503.http
errorfile 504 /etc/haproxy/errorfiles/504.http
#################HAProxy ###################
capture request header Host len 40
capture request header Content-Length len 10
capture request header Referer len 200
capture response header Server len 40
capture response header Content-Length len 10
capture response header Cache-Control len 8
####################### listen #####################
########### haproxy ############
listen site_status
bind 0.0.0.0:1081 #
mode http #http 7
log 127.0.0.1 local3 err #[err warning info debug]
monitor-uri /site_status # URL, HAProxy , 200, 503
acl site_dead nbsrv(server_web) lt 2 # down backend 1 true
acl site_dead nbsrv(server_blog) lt 2
acl site_dead nbsrv(server_bbs) lt 2
monitor fail if site_dead # 503, 500, 503
monitor-net 192.168.16.2/32 # 192.168.16.2
monitor-net 192.168.16.3/32
########frontend ############
##### ,frontend acl ########
frontend http_80_in
bind 0.0.0.0:80 # , haproxy web , lvs vip
mode http #http 7
log global #
option httplog # http log
option httpclose # http ,HA-Proxy keep-alive
option forwardfor # IP , Http Header IP
########acl #############
acl itnihao_web hdr_reg(host) -i ^(www.itnihao.cn|ww1.itnihao.cn)$
# 2 true -i
acl itnihao_blog hdr_dom(host) -i blog.itnihao.cn
# www.itnihao.cn true -i
#acl itnihao hdr(host) -i itnihao.cn
# itnihao.cn true -i
#acl file_req url_sub -i killall=
# url killall=, true, false
#acl dir_req url_dir -i allow
# url allow , true, false
#acl missing_cl hdr_cnt(Content-length) eq 0
# header Content-length 0 true
########acl #############
#block if missing_cl
# header Content-length 0 403
#block if !file_req || dir_req
#block , 403 , file_req, dir_req,
use_backend server_web if itnihao_web
# itnihao_web server_web backend
use_backend server_blog if itnihao_blog
# itnihao_blog server_blog backend
#redirect prefix http://blog.itniaho.cn code 301 if itnihao
# itnihao.cn , http 301 http://192.168.16.3
default_backend server_bbs
# server_bbs backend
##########backend ##############
# server_web,server_blog,server_bbs
###########################backend server_web#############################
backend server_web
mode http #http 7
balance roundrobin # ,roundrobin
cookie SERVERID # serverid cookie ,serverid
option httpchk GET /index.html #
server web1 192.168.16.2:80 cookie web1 check inter 1500 rise 3 fall 3 weight 1
# ,cookie 1 serverid web1,check inter 1500 rise 3 3 ,
#fall 3 3 ,weight
server web2 192.168.16.3:80 cookie web2 check inter 1500 rise 3 fall 3 weight 2
# ,cookie 1 serverid web2,check inter 1500 rise 3 3 ,
#fall 3 3 ,weight
###################################backend server_blog###############################################
backend server_blog
mode http #http 7
balance roundrobin # ,roundrobin
cookie SERVERID # serverid cookie ,serverid
option httpchk GET /index.html #
server blog1 192.168.16.2:80 cookie blog1 check inter 1500 rise 3 fall 3 weight 1
# ,cookie 1 serverid web1,check inter 1500 rise 3 3 ,fall 3 3 ,weight
server blog2 192.168.16.3:80 cookie blog2 check inter 1500 rise 3 fall 3 weight 2
# ,cookie 1 serverid web2,check inter 1500 rise 3 3 ,fall 3 3 ,weight
###################################backend server_bbs###############################################
backend server_bbs
mode http #http 7
balance roundrobin # ,roundrobin
cookie SERVERID # serverid cookie ,serverid
option httpchk GET /index.html #
server bbs1 192.168.16.2:80 cookie bbs1 check inter 1500 rise 3 fall 3 weight 1
# ,cookie 1 serverid web1,check inter 1500 rise 3 3 ,fall 3 3 ,weight
server bbs2 192.168.16.3:80 cookie bbs2 check inter 1500 rise 3 fall 3 weight 2
# ,cookie 1 serverid web2,check inter 1500 rise 3 3 ,fall 3 3 ,weight
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
HAProxy로 HA화된 Elasticsearch 클러스터 구축이 기사는 의 18 일째입니다. 실험실에있는 ESXi에 Elasticsearch 클러스터를 구축했습니다. 선생님으로부터 중복을 고려한 구축을 제안되었으므로, SPOF의 배제를 목표로 했습니다. 설정 파일은 다음과 같...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.