Ajp + apache + tomcat load balancing, ajptomcat
1. Installation of apache + tomcat
Omitted. If you do not understand it, please refer to the previous article!
Ii. apache + tomcat configuration (important)
Method 1:
1. Add the following content to httpd. conf:
NameVirtualHost *:80<VirtualHost*:80> ServerAdmin frinder_liu@163.com ServerName www.abc.org.cn ProxyPass /balancer-manager ! ProxyPass /test balancer://cluster/stickysession=jsessionid nofailover=On ProxyPassReverse /test balancer://cluster/</VirtualHost>ProxyRequestsOff<proxybalancer://cluster>BalancerMemberajp://127.0.0.1:8009/test loadfactor=1 route=tomcat1BalancerMemberajp://127.0.0.1:8109/test loadfactor=1 route=tomcat2</proxy><Location/balancer-manager>SetHandlerbalancer-managerOrderDeny,AllowDenyfrom allAllowfrom all</Location>
2. tomcat configuration
1) tomcat1:
<Enginename="Catalina" defaultHost="localhost"jvmRoute="tomcat1"><Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
Tomcat2:
<Enginename="Catalina" defaultHost="localhost"jvmRoute="tomcat2"><Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
Note: Of course, other configurations are required for tomcat. As we have discussed in the previous article, we don't need to talk about it any more! Note that we configured a long Cluster in the previous article. This is not required,
Method 2! Test results: As shown in the preceding figure, the sessionId is the same, but the appname cannot be obtained for Tomcat 2. Check the test page again:
I believe everyone can see the difference. Why is the value at the first initialization not in Tomcat 2? I have not found the answer to this question. I hope you can tell me the answer to this question. Thank you!
2) tomcat1/tomcat2 follow the detailed Cluster configuration described in the previous article. The results are as follows:
Check whether the consoles of tomcat1 and tomcat2 are accessed twice. The seesion remains unchanged during this process !!!
Again:
We can see that sessions configured in the Cluster are fully shared !!!
Why is there such a problem when using the simple configuration of tomcat1 cluster? I hope you can help me solve it. Thank you!
The apache server uses ajp to connect to the tomcat cluster.
Release the configurations of worker. worker AT1 and 2.
"Apache tomcat integration" is the same as "load balancing between apache and tomcat?
Tomcat1 tomcat2, which is now linked to the cluster.