0
我有HAProxy(v1.5.8)作爲負載平衡器與keepalived(v1.2.2),以維持高可用性。本地網絡上的另一臺計算機上也有多臺Jetty服務器作爲帶有Web應用程序的後端服務器。HAProxy不轉發請求到後端服務器
我現在的問題是:我可以通過它訪問網絡應用IP(下面的代碼中的zzzz),但是當我嘗試訪問VIP(下面的代碼中的yyyy)時,我得到一個連接拒絕錯誤。我沒有任何iptables規則集(Debian 7)。
我haproxy.cfg文件,這是一個:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
#stats socket /run/haproxy/admin.sock mode 660 level admin
#stats timeout 30s
maxconn 4096
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen stats x.x.x.x:9000
mode http
balance
option httplog
timeout client 5000
timeout connect 4000
timeout server 30000
stats uri /haproxy_stats
stats realm HAProxy/Statistics
stats auth user:passwd
stats admin if TRUE
listen webfarm y.y.y.y:8080
mode http
stats enable
stats auth someuser:somepassword
balance roundrobin
cookie JSESSIONID prefix
option httpclose
option forwardfor
option httpchk HEAD /check.txt HTTP/1.0
server webA z.z.z.z:9400 check
在我所定義的貴賓,我將使用(在KEEPALIVED的conf文件是haproxy.cfg定義的一樣:
virtual_ipaddress {
y.y.y.y
}
在統計網我得到的下一個結果:
後這一點,我相信haproxy無法到達後端,因爲它們顯示爲前端服務器。我錯過了conf文件中的某些東西?
謝謝
我設法讓服務器使用apache測試服務器返回有效的響應,但重定向仍然失敗。 如果我去的Apache IP我可以得到索引文件好,但如果我去虛擬IP haproxy正在偵聽,我得到主機無法訪問的錯誤。 'ip addr sh eth0'告訴我IP正在工作。你知道爲什麼它可能無法重定向請求嗎? 謝謝 – CRM