Haproxy Sticky-Table没有更新

时间:2016-12-30 17:57:09

标签: haproxy rate-limiting

我正在尝试使用粘性表使用haproxy进行http速率限制。但是,当我尝试查看粘性表时,我无法看到它

我的配置如下

global
    log             127.0.0.1 local1 notice
    daemon
    stats socket /run/haproxy/admin.sock mode 600 level admin
    stats timeout 2m
    user haproxy
    group haproxy
    chroot /var/lib/haproxy
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private
    tune.ssl.default-dh-param 2048
    ssl-default-bind-options no-sslv3

frontend https-jira
    bind 198.159.146.11:80
    bind 198.159.146.11:443 ssl crt /etc/haproxy/certs/stg-test.abc.com.pem
    log  127.0.0.1 local1 notice
    option httpclose
    option http-server-close
    stick-table type ip size 500k expire 30s store  
    conn_cur,conn_rate(10s),http_req_rate(10s),http_err_rate(10s)
    reqadd X-Forwarded-Proto:\ https
    reqadd X-Forwarded-Proto:\ http
    acl stg-jira hdr(host) -i stg-test.abc.com
    redirect scheme https if !{ ssl_fc } stg-test
    use_backend stg-test-backend if stg-test

  backend stg-test-backend
     server test-server 192.168.1.25:8080 check inter 2000 maxconn 500  rise 2  fall 3

当我尝试使用以下任何一个命令查看粘性表时,我无法查看表条目

  echo "show table https-test" | nc -U /run/haproxy/admin.sock

  OR

  watch -n 1 'echo "show table https-test" | socat unix:/run/haproxy/admin.sock -'

  OR

  echo "show table https-test" | socat unix-connect:/run/haproxy/admin.sock stdio

任何人都可以帮我配置创建粘性表并查看粘性表

1 个答案:

答案 0 :(得分:2)

如果你这样做:

sudo watch -n 1 'echo "show table" | socat unix:/var/run/haproxy.sock -'

将为您提供表格的名称;

在你的情况下它将是

sudo watch -n 1 'echo "show table stg-test-backend" | socat unix:/var/run/haproxy.sock -'