От: | Аноним | ||
Дата: | 25.11.13 17:26 | ||
Оценка: |
<Proxy balancer://app1>
Header add Set-Cookie "app1.ROUTEID=ROUTE.%{BALANCER_WORKER_ROUTE}e" env=BALANCER_ROUTE_CHANGED
BalancerMember http://host1 route=route_0
BalancerMember http://host2 route=route_1
ProxySet lbmethod=byrequests stickysession=app1.ROUTEID
</Proxy>
When using cookie based stickyness, you need to configure the name of the cookie that contains the information about which back-end to use.
This is done via the stickysession attribute added to either ProxyPass or ProxySet.
The name of the cookie is case-sensitive. The balancer extracts the value of the cookie and looks for a member worker with route equal to that value.
At present there are 6 environment variables exported:
BALANCER_SESSION_STICKY
This is assigned the stickysession value used for the current request. It is the name of the cookie or request parameter used for sticky sessions
BALANCER_SESSION_ROUTE
This is assigned the route parsed from the current request.
BALANCER_NAME
This is assigned the name of the balancer used for the current request. The value is something like balancer://foo.
BALANCER_WORKER_NAME
This is assigned the name of the worker used for the current request. The value is something like http://hostA:1234.
BALANCER_WORKER_ROUTE
This is assigned the route of the worker that will be used for the current request.
BALANCER_ROUTE_CHANGED
This is set to 1 if the session route does not match the worker route (BALANCER_SESSION_ROUTE != BALANCER_WORKER_ROUTE) or the session does not yet have an established route. This can be used to determine when/if the client needs to be sent an updated route when sticky sessions are used.