You have been viewing Apache and Tomcat cluster configurations over the past few days. It took a long time to complete the configuration! Apache2.x and Tomcat can be configured in the form of reverse proxy (modproxy) or JK module, and JK module is used in the end. The efficiency of JK module is higher than that of reverse proxy, this is what I said on the official Apache website. I have never tested it. Although JK configurations are complex,
Apache andMcAtClusterConfiguration. It took a long time to complete the configuration!
Apache2.x and Tom
CatThe configuration can adopt a reverse proxy (mod proxy) or JK module, and the JK module is used eventually. The efficiency of the JK module is higher than that of the reverse proxy, this is what I said on the official Apache website. I have never tested it. Although JK configurations are complex, JK configurations are more flexible.
First, download Apache2.2.11, Tomcat6.0.20
ExtractEdition, and mod_jk-1.2.28-
Httpd-2.2.3.so
Install the Apache server, rename the mod_jk-1.2.28-httpd-2.2.3.so to mod_jk.so, and copy it to the mo in the Apache installation directory
DuLes folder.
In the conf folder of the Apache2.2 installation directory, create the following three files:
Mod_jk.conf, workers. properties, uriworke
RmAp. properties
Add the following at the end of httpd. conf:
- # JK moduleSetBytes
- INcLude conf/mod_jk.conf
Contains the mod_jk.conf configuration file. The following is the content of the mod_jk.conf file:
- # Load JK Module
- LoadModule jk_module modules/mod_jk.so
- # Configure mod_jk
- JkWorkersFile conf/workers. properties
- JkMountFile conf/uriworkermap. properties
- JkShmFile logs/mod_jk.shm
- JkLogFile logs/mod_jk.log
- JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
- JkLogLevel warn
- JkLogStampFormat"[% A % B % d % H: % M: % S % Y]"
- HostnameLookups Off
-
- JkMount jkStatUs
- Order deny, allow
- Deny from all
- Allow from127.0.0.1
Next, configure the workers. properties file:
- # Environment slashForWindows (backslash represents a Windows system)
- Ps = \
- Worker. reTrIes =3
- #Server Load balancerServer and status monitor
- Worker. list = loadbalancer, jkstatus
- Worker. tomcatA. type = ajp13
- Worker. tomcatA. host = localhost
- Worker. tomcatA. port =9001
- Worker. tomcatA. lbfactor =1
- Worker. tomcatA. connection_pool _TimeOut =600
- Worker. tomcatA. socket_keepalive =True
- Worker. tomcatA. socket_timeout =60
- Worker. tomcatB. type = ajp13
- Worker. tomcatB. host = localhost
- Worker. tomcatB. port =9002
- Worker. tomcatB. lbfactor =1
- Worker. tomcatB. connection_pool_timeout =600
- Worker. tomcatB. socket_keepalive =True
- Worker. tomcatB. socket_timeout =60
- Worker. worker ATC. type = ajp13
- Worker. worker ATC. host = localhost
- Worker. worker ATC. port =9003
- Worker. worker ATC. lbfactor =1
- Worker. worker ATC. connection_pool_timeout =600
- Worker. Route ATC. socket_keepalive =True
- Worker. worker ATC. socket_timeout =60
- Worker. jkstatus. type = status
- Worker. loadbalancer. type = lb
- Worker. loadbalancer. sticky_session =True
- Worker. loadbalancer. sticky_session_force =FaLsE
- Worker. loadbalancer. balance_workers = tomcatA, tomcatB, tomcatC
In the preceding configuration file, sticky_session = true and sticky_session_force = false. Many articles suggest that, when the former is set to true, the latter is also set to true.