我有一个HAProxyconfiguration文件正在构build编程,我得到了像每个后端定义的以下错误:
[WARNING] 073/153725 (1663) : parsing [/etc/haproxy/haproxy.cfg:964] : 'use_backend' ignored because backend 'bk_10716' has no frontend capability.
我的configuration文件是相当简单的,只有一个后端的简化版本似乎工作,所以我不能把我的手指在哪里是错的。
我的configuration文件包含这个:
global tune.ssl.default-dh-param 2048 log 127.0.0.1 local1 debug chroot /var/lib/haproxy user haproxy group haproxy maxconn 4000 daemon defaults log global mode http option httplog option dontlognull 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 bind *:1234 stats auth admin:bdi2016 stats uri / stats realm Haproxy\ Statistics stats enable mode http frontend http: bind *:80 mode http option httpclose option forwardfor
其次是大量的这些:
use_backend bk_10011 if { hdr_end(host) -i somedomainname.com } backend bk_10011 server server_10011 127.0.0.1:10011 check
我只是错过了一些明显/愚蠢的东西?
您需要为前端分配一个ID号码(例如,ID 1)。 然后你需要把这个ID分配给后端configuration来匹配。
所以在前端会这样:
frontend http: id 1 bind *:80 mode http option httpclose option forwardfor
并在后端像这样:
use_backend bk_10011 if { hdr_end(host) -i somedomainname.com } backend bk_10011 server server_10011 127.0.0.1:10011 id 1 check
至less这是对我有用的。
这只是一个愚蠢的错误。 我需要在前端指定所有的use_backend if语句而不是每个单独的后端。 这就是为什么它只与一个后端工作,因为不pipe缩进,第一个use_backend “属于” frontend http:和后来的每个后端都显得孤儿。