
특정 사이트를 호스팅하는 여러 서버의 일부 인프라를 다음을 사용하여 부하 분산 아키텍처로 마이그레이션하고 있습니다.HAProxyOpenBSD 4.6 macppc의 1.3.15.7. 당연히 현재 설정(특정 서버의 특정 사이트)에 대한 콘텐츠 전환 구성부터 시작하고 내 /etc/haproxy/haproxy.cfg는 다음과 같습니다.
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 1024
chroot /var/haproxy
uid 604
gid 604
daemon
#debug
#quiet
pidfile /var/run/haproxy.pid
defaults
log global
mode http
option httplog
option dontlognull
option redispatch
retries 3
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
stats enable
stats auth user:pass
frontend http_proxy *:80
# check to see which domain the reguest is for
acl host_tld.domain.sub1 hdr_end(host) sub1.domain.tld
acl host_tld.domain.sub2 hdr_end(host) sub2.domain.tld
# send to the correct server
use_backend server2 if host_tld.domain.sub1 or host_tld.domain.sub2
default_backend server1
backend server1
server httpd_server1 192.168.1.3:80
backend server2
server httpd_server2 192.168.1.4:80
목표는 server1
도메인을 제외하고 sub1.domain.tld
모든 도메인을 제공하는 sub2.domain.tld
것 입니다 server2
. 그러나 HAProxy를 시작하려고 하면 다음 오류가 발생합니다.
parsing /etc/haproxy/haproxy.cfg : backend 'server2' has no dispatch address and is not in transparent or balance mode.
parsing /etc/haproxy/haproxy.cfg : backend 'server1' has no dispatch address and is not in transparent or balance mode.
Errors found in configuration file, aborting.
Error reading configuration file : /etc/haproxy/haproxy.cfg
나는 다음에 나열된 예를 살펴 보았습니다.HAProxy 1.3 문서그리고http://upstre.am/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/, 하지만 내가 어디에서 잘못되었는지는 알 수 없습니다. 어떤 예제도 option transparent
균형 모드가 필요하지 않은 것 같습니다. 또한 옵션에 대한 문서는 dispatch
이상하게도 1.3 문서에서 생략되었지만 어쨌든 문제 해결에 도움이 될지는 의문입니다.
내가 어디로 잘못 갔나요?
답변1
백엔드에 균형 조정 알고리즘이 필요하므로 "balance roundrobin"(또는 이에 상응하는) 줄을 잊어버렸습니다. 또한 콘텐츠 전환을 수행 중이므로 프런트엔드 또는 기본값 섹션에 "옵션 httpclose"를 추가하세요. 그렇지 않으면 연결 유지 연결에 대한 두 번째 요청이 일치하지 않습니다.