2016-12-30 65 views
0

我正在嘗試使用haproxy使用粘貼表進行http速率限制。但是,當我嘗試查看粘性表我不能夠Haproxy Sticky-Table not updating

我configuraiton看到這裏如下

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

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 -'