The Mod_proxy load balancing function provided by ApacheHttpServer is used technically in the cluster environment. The cluster Service adopts Tomcat and the operating system Ubuntu8.0.4. The following describes how to install ApachehttpServer, JDK, and Tomcat in Ubuntu, and how to configure the cluster environment. 1. Install 1. Install Ubuntu8.04 (see http://www.linuxidc.com/Linux/2008-04/122
The cluster environment uses the Mod_proxy load balancing function provided by Apache Http Server technically. The cluster Service adopts Tomcat and the operating system Ubuntu 8.0.4. The following describes how to install Apache http Server, JDK, and Tomcat under Ubuntu, and how to configure the cluster environment.
I. Installation
1. Install Ubuntu 8.04
(See http://www.linuxidc.com/linux/2008-04/12273.htm)
2. install Apache Http Server
Sudo apt-get install apache2
After the installation, the http service is automatically started. It Works appears when you access http: // 127.0.0.1 !, Success.
3. Install JDK
★Install JDK: sudo apt-get install sun-java6-jdk
★Configure the current default java interpreter: sudo update-alternatives-config java
The list of JAVA interpreters is displayed. Select SUN interpreter.
★Configure JAVA environment variables:
Edit the/etc/environment file and add two lines:
CLASSPATH =.:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME =/usr/lib/jvm/java-6-sun
★Edit the/etc/jvm file and add it to the header:
/Usr/lib/jvm/java-6-sun
★Verification:
Echo $ JAVA_HOME
Java-version
4. install Tomcat
Download apache-tomcat-6.0.xx.tar.gz and decompress it directly without any configuration.
2. Configure the Cluster Environment
1. Install the mod_proxy module
By default, the installed Apache Http Server is not included. You can download the source program of Apache Http Server of the same version. copy the so file (listed below) to the modules directory of apache (/usr/lib/apache2/modules /).
★Mod_proxy.so
★Mod_proxy_ajp.so
★Mod_proxy_balancer.so
★Mod_proxy_connect.so
★Mod_proxy_http.so
★Mod_proxy_ftp.so
2. Server Load balancer Configuration
Edit/etc/apache2/hpptd. conf and add the following Configuration:
# The mod_proxy module of Apache uses proxy technology to connect to TomcatLoadModule proxy_module/usr/lib/apache2/modules/mod_proxy.so
# LoadModule proxy_ajp_module/usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule proxy_http_module/usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_connect_module/usr/lib/apache2/modules/mod_proxy_connect.so
LoadModule proxy_balancer_module/usr/lib/apache2/modules/mod_proxy_balancer.so
Sets the proxy server forwarding mode, stickysession indicates session persistence, JSESSIONID indicates session ID, nofailover = on indicates that no failover is used # ProxyPass/foool http://special.example.com/smax = 5 max = 10
ProxyPass/kebbs!
ProxyPass/ke/system!
# ProxyPass/balancer: // mycluster stickysession = jsessionid nofailover = On
ProxyPass/ke balancer: // mycluster stickysession = jsessionid nofailover = On
BalancerMember http: // 127.0.0.1: 8080/
BalancerMember http: // 192.168.3.44: 80/
# Less powerful server, don't send as your requests there
# BalancerMember http: // 1.2.3.6: 8009 smax = 1 loadfactor = 20
For more information about apache cluster configuration, see related documents. Here is a simple explanation:
Proxypass/kebbs! Indicates that/kebbs requests are not forwarded. The/ke/system below also means that.
The forward request is a/ke request.
The next step is load balancing. We can see that load balancing is performed between the local machine and a 3.44 machine.
/Kebbs is a php Forum hanging on the system. Because it is on the local machine, requests are not forwarded. The Forum code is stored in the apache web directory.
/Var/www/kebbs
On the whole, the configuration structure of apache2 on ubuntu is special, and many materials on the Internet are introduced.
Httpd. conf in/etc/apache2 is the user configuration file, and apache2.conf is the basic configuration.
Php5.conf and php5.load under/etc/apache2/mod-available are php configuration and module loading files respectively. The content is as follows:
LoadModule php5_module/usr/lib/apache2/modules/libphp5.so (. load file)
AddType application/x-httpd-php. php. phtml. php3
AddType application/x-httpd-php-source. phps
(. Conf file)