2

我正在使用 HA 代理 HA-Proxy 版本 1.4.18 2011/09/16 我正在尝试将以下内容插入 /etc/init.d/haproxy.cfg 文件

# Use General Purpose Couter (gpc) 0 in SC1 as a global abuse counter
# Monitors the number of request sent by an IP over a period of 10 seconds
stick-table type ip size 1m expire 10s store gpc0,http_req_rate(10s)
tcp-request connection track-sc1 src
tcp-request connection reject if { src_get_gpc0 gt 0 }

# Table definition  
stick-table type ip size 100k expire 30s store conn_cur(3s)
# Allow clean known IPs to bypass the filter
tcp-request connection accept if { src -f /etc/haproxy/whitelist.lst }
# Shut the new connection as long as the client has already 10 opened
tcp-request connection reject if { src_conn_cur ge 10 }
tcp-request connection track-sc1 src

我收到以下错误:

[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:36]:stick-table:未知参数“存储”。
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:37]:代理“http_proxy”中“tcp-request”之后的未知参数“连接”
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:38]:代理“http_proxy”中“tcp-request”之后的未知参数“连接”
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:41]:stick-table:未知参数“存储”。
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:43]:代理“http_proxy”中“tcp-request”之后的未知参数“连接”
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:45]:代理“http_proxy”中“tcp-request”之后的未知参数“连接”
[警报] 256/113143 (4627):解析 [/etc/haproxy/haproxy.cfg:46]:代理“http_proxy”中“tcp-request”之后的未知参数“连接”
[警报] 256/113143 (4627):在配置文件中发现错误:/etc/haproxy/haproxy.cfg
[警告] 256/113143 (4627):代理“http_proxy”:在多进程模式下,统计信息将仅限于分配给当前请求的进程。
[警报] 256/113143 (4627):在配置中发现致命错误。
[失败]
你能告诉我代码有什么问题吗?

4

1 回答 1

4

Storing data in stick-tables only appeared in haproxy 1.5-dev, not 1.4. You should try the latest 1.5-dev12. BTW if you're on 1.4, you should upgrade to 1.4.22 which fixes a number of bugs since your one-year-old 1.4.18.

于 2012-09-13T23:15:47.137 回答