I
I
Igor2016-10-13 16:59:30
Apache HTTP Server
Igor, 2016-10-13 16:59:30

Apache load balancing how to disable jumping between nodes?

Day. There is a config:

<VirtualHost 100.12.69.1:80>
        ProxyRequests off
        ServerName cluster.local

        <Proxy balancer://cluster>
                BalancerMember http://100.12.69.100:8080 route=AppNode1 loadfactor=1
                BalancerMember http://100.12.69.110:8080 route=AppNode2 loadfactor=1
                ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid
        </Proxy>

        ProxyPass / balancer://cluster/
        ProxyPass http://100.12.69.100 http://100.12.69.100:8080
        ProxyPass http://100.12.69.110 http://100.12.69.110:8080
        ProxyPassReverse / http://100.12.69.100:8080
        ProxyPassReverse / http://100.12.69.110:8080
</VirtualHost>

Round Robin, Session Affinity. But a problem arose: it is necessary that the user who gets to one of the nodes subsequently sits on it until he finishes work, and in the current mode, the node changes on each page update / click on the link.
As if in theory, all requests within the session should walk strictly on a specific node, but no. How can this be fixed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2018-03-19
@Lopar

Working config:

<VirtualHost 100.12.69.1:80>
        ServerName cluster.local
        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

        <Proxy balancer://cluster>
                BalancerMember http://100.12.69.100:8080 route=AppNode1 loadfactor=1
                BalancerMember http://100.12.69.110:8080 route=AppNode2 loadfactor=1
                ProxySet lbmethod=byrequests stickysession=ROUTEID
        </Proxy>

        ProxyPass / balancer://cluster/
        ProxyPassReverse / balancer://cluster/
</VirtualHost>

X
xmoonlight, 2016-10-17
@xmoonlight

the inclusion of the balancer through the conditions of the flag through SetEnv must be controlled.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question