Hi, everyone.
The structure of the server I am currently configuring is shown in the picture below:
And the file httpd.conf of apache0 is as follows:
out #
ProxyRequests off
ProxyPreserveHost on
<Proxy *>
AddDefaultCharset off
Order deny,allow
Allow from all
</Proxy>
ProxyVia On
<VirtualHost *:80>
ServerName mydomain.com
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://focluster">
BalancerMember http://mydomain.com:1081/ route=1
BalancerMember http://mydomain.com:1082/ route=2
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass "/" "balancer://focluster/"
</VirtualHost>
As you can see, apache0 performs proxy functions for apache1 and apache2, but load balancing is applied using mod_proxy_balancer.
And to maintain the session, I hung the sticky session option on the cookie called 'ROUTEID'.
How do I get client requests sent to apache1 when apache2 dies or the WAS associated with apache2 dies in this state?
apache tomcat mod_proxy_balancer failover
It's a different issue from load balancing, so I don't think it'll work as I want. The contents of the question are related to HA, so I think a separate method is needed. Note: HAProxy
If you still only have the Balancer, test it by changing it from the above settings as follows.
<Proxy "balancer://focluster">
BalancerMember http://mydomain.com:1081/ route=1 status=-SE timeout=5 retry=60
BalancerMember http://mydomain.com:1082/ route=2 status=-SE timeout=5 retry=60
ProxySet stickysession=ROUTEID lbmethod=bybusyness failontimeout=on
</Proxy>
timeout=5 is the connection timeout. Wait for this amount of time, and if it fails, request again to /.
Connection timeout in seconds. The number of seconds Apache httpd waits for data sent by / to the backend.
When failontimeout=on is set, the worker is forced to set to an error state when a read timeout of I/O occurs after the request.
If set, an IO read timeout after a request is sent to the backend will force the worker into error state. Worker recovery behaves the same as other worker errors. Available in Apache HTTP Server 2.4.5 and later.
retry=60 returns the error to its normal state 60 seconds after it occurs and allows the request to be received again.
Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache httpd will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance and bring it back online later. A value of 0 means always retry workers in an error state with no timeout.
See https://httpd.apache.org/docs/current/mod/mod_proxy.html#balancermember
© 2024 OneMinuteCode. All rights reserved.