HA Proxy Stick-table 和 tcp 连接配置

HA Proxy Stick-table 和 tcp 连接配置

我正在使用 HA Proxy 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

我收到以下错误:

[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:36] : stick-table: unknown argument 'store'.
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:37] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy'
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:38] : unknown argument     'connection' after 'tcp-request' in proxy 'http_proxy'
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:41] : stick-table: unknown argument 'store'.
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:43] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy'
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:45] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy'
[ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:46] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy'
[ALERT] 256/113143 (4627) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[WARNING] 256/113143 (4627) : Proxy 'http_proxy': in multi-process mode, stats will be limited to process assigned to the current request.
[ALERT] 256/113143 (4627) : Fatal errors found in configuration.                                                                     [fail]

你能告诉我代码有什么问题吗?谢谢!

答案1

haproxy 1.4 不支持 store 关键字,以及其中的一些其他内容。

升级到最新的 1.5 版本或查阅适合您版本的正确文档。

相关内容