Build an Apache + Tomcat server Load balancer Cluster
1. Required Software
Apache_2.2.4-win32-x86-no_ssl, apache server
Mod_jk-apache-2.2.4 connector connecting apache and tomcat
Apache-tomcat-6.0.33tomcat servers.
2. Software Installation 2.1 apache installation
Continue to the next step. On this page:
Either the domain name or localhost can be entered;
After the installation is complete, enable access to localhost. The installation is successful as follows:
2.2tomcat Installation
Omitted. There are a lot of online materials.
3. cluster configuration 3.1integration of Apache and mod_jk.so
(1) modify the httpd. conf configuration file and add the following statement:
Purpose: Load mod_jk.so and read the mod_jk.conf configuration file.
(2) Create the file mod_jk.conf In the conf folder under the apache installation directory.
Add the following Configuration:
Role: mod_jk is used as the connector, and mod_jk.conf is used as the connector configuration file to configure the workers. properties server's work configuration file.
(3) create the workers. properties file in the conf folder under the apache installation directory.
The configuration is as follows:
Purpose: configure the working tomcat node.
3.2tomcat Configuration
(1) Copy two tomcat servers
(2) modify the server. xml file in the conf folder under the tomcat installation directory as follows:
The jvmRoute and worker. properities files are configured with the same name.
Tomcat1 configuration is the same as tomcat2 configuration.
4. Test
Create a folder under the tomcat working directory webapps with the following structure:
The content of the test. jsp file is as follows:
Result
Test path: http: // localhost/test. jsp
First visit:
Second access:
Apache distributes requests based on the configured Server Load balancer policies and parameters.
5. FAQs
(1) apache installation failed
Solution: Set the installation directory to the root directory, for example, H :/.
(2) apache startup failure
Solution: run the cmd name to the apache installation directory/bin and enter the httpd-t command. A detailed error message is displayed, which can be used for troubleshooting. For example: can not load Apache2.2/modules/mod_jk.so into server: % 1 \ xb2 \ xbb \ xca \ xc7 \ xd3 \ xd0 \ xd0 \ xa7 \ xb5 \ xc4Win32 \ xd3 \ xa6 \ xd3 \ xc3 \ xb3 \ xcc \ xd0 \ xf2 \ xa1 \ xa3, this problem may be caused by a version issue or a configuration file issue. You can change the mod_jk version or check httpd. conf configuration file.