- apache tomcat Load Balance
1. apache installation
httpd-2.2.25-win32-x86-openssl-0.9.8y.msi
2. Module copy
tomcat-connectors-1.2.40-windows-i386-httpd-2.2.x/mod_jk.so =>
/apache/modules/mod_jk.so
3. tomcat copy
/apache-tomcat-7
/apache-tomcat-72
4. apache configuration modify
/apache/conf/httpd.conf
# apache-tomcat connector
<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-apj.conf"
</IfModule>
</IfModule>
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogLevel info
JkLogFile logs/mod_jk.log
JkMount /*.html lb
JkMount /*.jsp lb
JkMount /*.ajax lb
JkMount /*.xpl lb
JkMount /j_spring_security_check lb
DocumentRoot "/wtpwebapps/testApp"
<Directory "/wtpwebapps/testApp">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location /jkmanager/>
JkMount jkstatus
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
/apache/conf/workers.properties
worker.list=lb
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.lb.type=lb
worker.lb.balance_workers=worker1,worker2
worker.list=jkstatus
worker.jkstatus.type=status
5. apache configuration test
/apache/bin>httpd -t
Syntax OK
6. tomcat configuration
1) server 1
<Connector port="7009" protocol="AJP/1.3" redirectPort="7443" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
<Context docBase="/wtpwebapps/testApp" path="" reloadable="false"
sessionCookieName="SERVER2_JESSIONID"/>
2) server 2
<Connector port="7109" protocol="AJP/1.3" redirectPort="7143" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
<Context docBase="/wtpwebapps/testApp" path="" reloadable="false"
sessionCookieName="SERVER1_JESSIONID"/>
1. apache installation
httpd-2.2.25-win32-x86-openssl-0.9.8y.msi
2. Module copy
tomcat-connectors-1.2.40-windows-i386-httpd-2.2.x/mod_jk.so =>
/apache/modules/mod_jk.so
3. tomcat copy
/apache-tomcat-7
/apache-tomcat-72
4. apache configuration modify
/apache/conf/httpd.conf
# apache-tomcat connector
<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-apj.conf"
</IfModule>
</IfModule>
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogLevel info
JkLogFile logs/mod_jk.log
JkMount /*.html lb
JkMount /*.jsp lb
JkMount /*.ajax lb
JkMount /*.xpl lb
JkMount /j_spring_security_check lb
DocumentRoot "/wtpwebapps/testApp"
<Directory "/wtpwebapps/testApp">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location /jkmanager/>
JkMount jkstatus
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
/apache/conf/workers.properties
worker.list=lb
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.lb.type=lb
worker.lb.balance_workers=worker1,worker2
worker.list=jkstatus
worker.jkstatus.type=status
5. apache configuration test
/apache/bin>httpd -t
Syntax OK
6. tomcat configuration
1) server 1
<Connector port="7009" protocol="AJP/1.3" redirectPort="7443" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
<Context docBase="/wtpwebapps/testApp" path="" reloadable="false"
sessionCookieName="SERVER2_JESSIONID"/>
2) server 2
<Connector port="7109" protocol="AJP/1.3" redirectPort="7143" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
<Context docBase="/wtpwebapps/testApp" path="" reloadable="false"
sessionCookieName="SERVER1_JESSIONID"/>
Comments
Post a Comment