2014-09-04 69 views
0

我有一個haproxy配置的大問題。我的網址:haproxy餘額uri深度

http://domain.com/some-text/?9/3/90/custom/184/2256184/2.jpg<br> 

的目標是,HAProxy的應派具有相同的ID(如2256184)的URL總是在相同的網絡服務器。

我試過參數「balance uri depth 8」,但它不起作用。任何人有一個想法如何解決這個問題?

我HAProxy的1.5配置:

global 
    log /dev/log local0 debug 
    chroot /var/lib/haproxy 
    user haproxy 
    group haproxy 
    daemon 
    maxconn 5000 

defaults 
    log  global 
    mode http 
    option httplog 
    option forwardfor  
    option http-server-close 
    option dontlognull 
    timeout connect 5s 
    timeout client 25s 
    timeout server 25s 

frontend http-frontend 
    bind 0.0.0.0:80 
    mode http 
    maxconn 50000 
    default_backend webfarm 

backend webfarm 
    mode http 
    balance uri depth 8 
    option forwardfor 
    hash-type consistent 
    server webmember01 192.168.10.22:80 weight 50 check 
    server webmember02 192.168.10.23:80 weight 50 check 

回答

0

你的URL例如只包含7目錄。 我猜HAProxy會回落到默認的LB算法,這是roundrobin。

巴蒂斯特

+0

感謝您的回答。我已經嘗試過參數平衡uri深度7和6.一旦我改變「some-text」下的文本,haproxy就會將url發送到另一臺服務器。它似乎haproxy忽略「平衡uri深度」
http://domain.com/some-text/9/3/90/custom/184/2256184/2.jpg – user3589380 2014-09-08 09:41:55

+0

我減少問題是URL,因爲我網址是問號domain.com/some-text/?9/3/90/custom/184/2256184/2.jpg – user3589380 2014-09-11 09:14:38

0

HAProxy的唯一默認使用的URL的左手,如果你想使用整個URL(包括?之後的部分),你需要提供whole參數。

如果您的網址有?,例如:

domain.com/some-text/?9/3/90/custom/184/2256184/2.jpg 

您將需要使用此參數,因爲在你的情況,你有興趣在?的右側的信息。

balance uri whole