Describe how Apache + Tomcat + JK implements Tomcat load and clusters

Source: Internet
Author: User

Describe how Apache + Tomcat + JK implements Tomcat load and clusters

I have studied the combination of Apache and Tomcat. I will write the process out later.

In Linux, Apache + Tomcat + JK implements the complete process of load balancing and clustering.

  1. Implementation environment
Virtual Machine: OS: Cetnost 5.4 kernel: 2.6.18-194. el5 server1: ip 192.168.1.107 255.255.255.0server2: ip 192.168.1.139 255.255.255.0

2. Software Used

Httpd-2.2.22.tar.gzapache-tomcat-6.0.35.tar.gztomcat-connectors-1.2.37-src.tar.gz (apache connector with Tocmat) jdk-6u33-linux-i586-rpm.bin 3. compile the program before installation # yum-y install gcc-c ++ gcc-gfortran ncurses-devel 4. next, we will prepare to install and install JDK. Because the Cetnos system will bring a java version, we need to uninstall the built-in java version.
  1. View version:
  2. # Java-version
  3. Java version "1.6.0 _ 18"
  4. Java (TM) 2 Runtime Environment, Standard Edition (build 1.6.0 _ 18-b02)
  5. Java HotSpot (TM) Client VM (build 1.6.0 _ 18-b02, mixed mode, sharing)
  6. View the JDK package name:
  7. # Rpm-qa | grep jdk
  8. Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
  9. Uninstall:
  10. # Yum-y remove java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
  11.  
  12. # Rpm-qa | grep gcj
  13. Libgcj-4.1.2-48.el5
  14. Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
  15.  
  16. # Yum-y remove libgcj-4.1.2-48.el5 java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
  17. Uninstalled
After the installation is complete, check the java version # java-version-bash: java: command not found. Start to install JDK below. I have put all the software under the/setup/directory. Let's install it below.
  1. # Cd/setup/jdk/
  2. # Chmod + x jdk-6u33-linux-i586-rpm.bin
The root user is required to execute this file.
  1. #./Jdk-6u33-linux-i586-rpm.bin
The installation can be completed smoothly According to the displayed prompt information. By default, it is installed in the/usr/java directory. We will make a soft connection.
  1. # Ln-s/usr/java/jdk1.6.0 _ 33 // usr/local/java
Set Environment Variables
  1. # Vi/etc/profile
  2. An "I" enters the editing mode
  3. Add at the end:
  4. Export JAVA_HOME =/usr/java/jdk1.6.0 _ 33
  5. Export CLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
  6. Export PATH = $ PATH: $ JAVA_HOME/bin
  7. Save and exit!
  8. To take effect: # source/etc/profile
Check the version information.
  1. # Java-version
  2. Java version "1.6.0 _ 33"
  3. Java (TM) SE Runtime Environment (build 1.6.0 _ 24-b07)
  4. Java HotSpot (TM) Client VM (build 19.1-b02, mixed mode, sharing)
Apache installation
  1. # Cd/setup/apache
  2. # Tar zxvf httpd-2.2.22.tar.gz
  3. # Cd httpd-2.2.22
  4. #./Configure -- prefix =/usr/local/apache
  5. # Make
  6. # Make install
  7. Here, apche only specifies the installation directory, and others are default.
Start
  1. #/Usr/local/apache/bin/apachectl start
Check whether port 80 is enabled. Installation of Apache and Tomcat Connector start installation of apache and Tomcat Connector tomcat-connectors-1.2.37-src.tar.gz
  1. # Cd/setup/tomcat
  2. # Tar zxvf tomcat-connectors-1.2.37-src.tar.gz
  3. # Cd tomcat-connectors-1.2.37-src/native/
  4. #./Configure -- with-apxs =/home/fiSUSEr/FCM/apache/bin/apxs
  5. # Make
  6. # Make install
After the installation is complete, a mod_jk.so # ls httpd. exp mod_jk.so directory in the/usr/local/apache/modules/directory will be installed successfully. Next, install Tocmat, which does not need to be compiled. You can use it after decompression.
  1. # Cd/setup/tomcat
  2. # Tar zxvf apache-tomcat-6.0.35.tar.gz
  3. # Mv apache-tomcat-6.0.35 app1
  4. # Echo "JAVA_HOME =/usr/java/jdk1.6.0 _ 33">/app1/bin/catalina. sh
Next, you can start it.
  1. #/Setup/tomcat/app1/bin/catalina. sh start
Check whether the port is started
  1. # Netstat-tlnp
  2. Tcp 0 0: ffff: 127.0.0.1: 8005: * LISTEN 26633/java
  3. Tcp 0 0: 8009: * LISTEN 26633/java
  4. Tcp 0 0: 8080: * LISTEN 26633/java
The three ports indicate that Topmcat can be started normally. You can use a browser to open it and you will surely see the "cat ". In the second virtual machine, you only need to have one Tomcat. All the Tomcat servers need to install JDK In the second virtual machine. At this point, the installation of Tomcat JDK Apache JK is complete. The following describes how to connect Apache and Tomcat to achieve Tomcat load and cluster.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • Next Page

Related 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.