[英]Configuring Apache Load Balancer
I have the following code added to my httpd.conf to load balance between two Application Servers 我将以下代码添加到我的httpd.conf中,以在两个应用程序服务器之间实现负载平衡
<VirtualHost www.mydomainx.com:80>
ProxyRequests off
ProxyPreserveHost Off
ServerName www.mydomainx.com
ServerAlias mydomainx.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /test balancer://mycluster stickysession=JSESSIONID|jsessionid
<Proxy balancer://mycluster>
# WebHead1
BalancerMember http://www1.mydomainx.com
# WebHead2
BalancerMember http://www2.mydomainx.com
Order Deny,Allow
Deny from none
Allow from all
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
# I recommend locking this one down to your
# your office
Order deny,allow
Allow from all
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
</VirtualHost>
Whenever i enter the URL to a web browser www.mydomainx.com, it loads the home page , then if i enter a user name and password and click submit, it then reloads either ( http://www1.mydomainx.com / http://www2.mydomainx.com ) reloading the home page again and forcing me to re-enter the username and password, is there a way to prevent all this? 每当我输入网址的web浏览器www.mydomainx.com,它加载主页,然后如果我输入用户名和密码并点击提交,它就会重新加载或者( http://www1.mydomainx.com / HTTP ://www2.mydomainx.com )再次重新加载主页,并强迫我重新输入用户名和密码,是否有办法防止所有这些情况?
Make sure you follow the advice in section stickyness : 确保遵循“ 粘性”部分中的建议:
ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid scolonpathdelim=On
(not only for the /test
directory) (不仅适用于/test
目录)
Furthermore, for the JBoss application server, you need to supply route=web1
/ route=web2
etc. in the Apache config and furthermore jvmRoute="web1"
in the JBoss configuration of the <Engine name="jboss.web"...
element (the location depends on the JBoss version you are using, for v4.2 it is server/default/deploy/jboss-web.deployer/server.xml
) 此外,对于JBoss应用服务器,您需要在Apache配置中提供route=web1
/ route=web2
等,并且在<Engine name="jboss.web"...
的JBoss配置中进一步提供jvmRoute="web1"
<Engine name="jboss.web"...
元素(位置取决于您使用的JBoss版本,对于v4.2,它是server/default/deploy/jboss-web.deployer/server.xml
)
See also this tutorial 另请参阅本教程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.