Install and configure apache2.2 + tomcat6.0 cluster in Windows XP

Source: Internet
Author: User

1.
Software Download

1.1jdk1.6

Next on Sun's official website, preferably over 1.6

1.2 Apache HTTP
Server: httpd-2.2.16-win32-x86-no_ssl.msi

Download landlords: http://httpd.apache.org/download.cgi

1.3 Tomcat: apache-tomcat-6.0.26-windows-x86.zip (installation free)

: Http://tomcat.apache.org/download-60.cgi

1.4 Tomcat
Connector: mod_jk-1.2.30-httpd-2.2.3.so

Download landlords: http://apache.etoak.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.30/

Tomcat Connector to select the correct version, mod_jk-1.2.30-httpd-2.2.3.so is for Apache
2.2.x.

2 Software Installation

Introduction to sub-Environment

Machine IP Address

Whether to install Apache HTTP
Server

Will Tomcat be installed?

JDK installation?

192.168.1.102

Yes

Yes

Yes

192.168.1.103

No

Yes

Yes

 

2.1 JDK Installation

Download JDK. After installing each server, add java_home and classpath to the environment variables,

Add

Java_home: C:/program files/Java/jdk1.6.0

Classpath: C:/program files/Java/jdk1.6.0/lib. (Note that "." is required)

2.2 Apache HTTP
Server Installation

On the host 192.168.1.102, double-click the downloaded installation file and follow the prompts. My installation directory is D:/program files/apache2.2

2.3tomcat Installation

Under 192.168.1.102, unzip the downloaded apache-atat-6.0.26-windows-x86.zip, rename the decompressed folder as tomcat6, copy tomcat6 to D:/program files, and open D:/program in notepad.
Files/tomcat6/bin/startup. bat, add:

Set java_home = C:/Program
Files/Java/jdk1.6.0

Set catalina_home = D:/program files/tomcat6

Java_home is the JDK installation path and catalina_home is the tomcat installation path. Edit D:/Program
Files/tomcat6/bin/shutdown. bat, add the same content at the beginning.

Install Tomcat on the host 192.168.1.103 in the same way.

3 Software Configuration

3.1 configuration of Apache HTTP Server

3.1.1 copy the downloaded file mod_jk-1.2.30-httpd-2.2.3.so to D:/program files/apache2.2/modules.

3.1.2 In the conf directory under the installation directory D:/program files/apache2.2, find the httpd. conf file, open it in notepad, and add a line at the end of the file

Include CONF/mod_jk.conf

The first letter of include is capitalized.

3.1.3 create the mod_jk.conf file in the conf directory and add the following content:

# Load mod_jk Module

Loadmodule jk_module
Modular/mod_jk-1.2.30-httpd-2.2.3.so

# Specify the workers. properties file path

Jkworkersfile CONF/workers. Properties

# Specify which requests are sent to Tomcat for processing. "controller" controls the specified load distribution in workers. propertise.

#,/* Indicates that all requests are processed by Tomcat

Jkmount/* Controller

 

3.1.4 create the workers. properties file in the conf directory and add the following content:

Worker. List =
Controller, tomcat1, tomcat2 # Server LIST

#========= Export AT1 ========

Worker. tomcat1.port = 8009 # ajp13 port number, which is configured in server. xml under tomcat. The default value is 8009.

Worker. tomcat1.host = localhost # Tomcat host address. If not, enter the IP address

Worker. tomcat1.type = ajp13

Worker. tomcat1.lbfactor = 1 # server weighting ratio. The higher the value, the more requests are allocated.

#======= Tomcat2 =========

Worker. tomcat2.port = 8009 # ajp13 port number, which is configured in server. xml under tomcat. The default value is 8009.

Worker. tomcat2.host = 192.168.1.102 # Tomcat host address. If not, enter the IP address

Worker. tomcat2.type = ajp13

Worker. tomcat2.lbfactor = 1 # server weighting ratio. The higher the value, the more requests are allocated.

#======= Controller, Server Load balancer controller ========

Worker. Controller. type = LB

Worker. Controller. balanced_workers = worker at1, tomcat2 # specify Tomcat that shares the request

Worker. Controller. sticky_session = 1

 

Note: Both tomcat1 and Apache HTTP Server are installed under 192.168.1.103, so the host of tomcat1 is configured as localhost. Of course, you can change it to the IP address 192.168.1.103.

 

3.2.tomcat Configuration

Go to the conf directory under the installation directory, open the server. xml file, find the commented <cluster> node, and comment it out.

Before I modify it

<! --

<Cluster
Classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"/>

-->

After modification

<Cluster
Classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"/>

 

4. Cluster startup

4.1 start Tomcat

Go to the bin directory under the tomcat installation directory on each machine and double-click STARTUP. BAT to run it. My detailed path is D:/program files/tomcat6/bin.

4.2 start Apache HTTP Server

After all the hosts are started, start Apache HTTP Server under 192.168.1.103. At this point, the cluster has been started.

5. deployment on the cluster of the project

Before deploying a project, you must edit the Web. xml under the project's WEB-INF directory

</Web-app>

Previously added

<Distributable/>

You can. After modification, deploy the project under Tomcat's webapps.

The configuration process in this article is recorded in actual operations. The eInvoice project is successfully deployed in the cluster and the session is shared among Tomcat servers in the cluster. Note that because our Tomcat is installed on different machines, if Tomcat is installed on the same machine, then on the same machine, the ports related to Tomcat except one of Tomcat must be modified. Otherwise, a conflict may occur. For specific modifications, see:

Http://blog.csdn.net/welun521/archive/2009/05/12/4169879.aspx

The main process of cluster configuration is also referred to in this article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.