简体   繁体   中英

Is worker.properties is mandatory to enable load balancing and sticky session in Apache http server

I am configuring Http WebServer 2.4 to enable Load balancing and implementing sticky session So configured below things in httpd.conf.Do I need to create worker.properties also or Below things are enough.In some tutorials they mentioned about creating worker.properties.these routes were configured in server.xml.

#JkWorkersFile conf/worker.properties
JkLogFile     logs/mod_jk.log
JkLogLevel    info

#Header add Set-Cookie: "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED 
<Proxy balancer://myclustername >
BalancerMember http://localhost:8080/benefits min=1 max=300 route=tomcat1 loadfactor=1 timeout=300 KeepAlive=On
BalancerMember http://localhost:8081/benefits min=1 max=300 route=tomcat2 loadfactor=1 timeout=300 KeepAlive=On
BalancerMember http://localhost:8082/benefits min=1 max=300 route=tomcat3 loadfactor=1 timeout=300 KeepAlive=On
</Proxy>
ProxyPass /benefits  balancer://myclustername stickysession=JSESSIONID


<Location /balancer-manager>
SetHandler balancer-manager

Order Deny,Allow
Deny from all
Allow from all
</Location>

Do I need to create worker.properties also or Below things are enough

Not required.Mod_proxy_balancer and mod_jk are different load balancer technique. worker.properties used in mod_jk. Use below configuration for mod_proxy_balanncer.

<Proxy balancer://myclustername >
BalancerMember http://localhost:8080 min=1 max=300 route=tomcat1 loadfactor=1 timeout=300 KeepAlive=On
BalancerMember http://localhost:8081 min=1 max=300 route=tomcat2 loadfactor=1 timeout=300 KeepAlive=On
BalancerMember http://localhost:8082 min=1 max=300 route=tomcat3 loadfactor=1 timeout=300 KeepAlive=On
</Proxy>

ProxyPass /   balancer://myclustername/  stickysession=JSESSIONID|jsessionid 
ProxyPassReverse / myclustername://myclustername/

Even you can achieve Stickysession without JSESSIONID.Use reverse proxy and Load balancer for more information. If you are facing issue with JSESSIONID then use ROUTEID.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM