Apache
The Apache HTTP Server Project is a collaborative software development effort aimed at creating a robust, commercial-grade, feature ful, and freely-available source code implementation of an HTTP (Web) server. The project is jointly managed by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop the server and its related documentation. This project is part of the Apache Software Foundation. In addition, hundreds of users have contributed ideas, code, and documentation to the project. This file is intended to briefly describe the history of the Apache HTTP Server and recognize the many contributors.
Tomcat
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and Java Server Pages specifications are developed under the Java Community Process.
Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project.
The Apache HTTP Server Project is a collaborative software development effort aimed at creating a robust, commercial-grade, feature ful, and freely-available source code implementation of an HTTP (Web) server. The project is jointly managed by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop the server and its related documentation. This project is part of the Apache Software Foundation. In addition, hundreds of users have contributed ideas, code, and documentation to the project. This file is intended to briefly describe the history of the Apache HTTP Server and recognize the many contributors.
Tomcat
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and Java Server Pages specifications are developed under the Java Community Process.
Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project.
Download the required software
- Apache 2.x Binaries
- Tomcat 6.x Binaries
- The JK module
Installing of Apache and Tomcat please refer previous posting of installing of Apache and Tomcat
load the mod_jk.so module
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties JkLogFile logs/mod_jk.log JkLogLevel info
below DOcument Root
JkMount /*.jsp loadbalancer JkMount /servlet/* loadbalancer
And create worker.properties file in /etc/httpd/conf/ directory
# # workers.properties # # In Unix, we use forward slashes: ps=/ # list the workers by name worker.list=tomcat1, tomcat2, loadbalancer # ------------------------ # First tomcat server # ------------------------ worker.tomcat1.port=8019 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 # Specify the size of the open connection cache. #worker.tomcat1.cachesize # # Specifies the load balance factor when used with # a load balancing worker. # Note: # ----> lbfactor must be > 0 # ----> Low lbfactor means less work done by the worker. worker.tomcat1.lbfactor=100 # ------------------------ # Second tomcat server # ------------------------ worker.tomcat2.port=8029 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 # Specify the size of the open connection cache. #worker.tomcat2.cachesize # # Specifies the load balance factor when used with # a load balancing worker. # Note: # ----> lbfactor must be > 0 # ----> Low lbfactor means less work done by the worker. worker.tomcat2.lbfactor=100 # ------------------------ # Load Balancer worker # ------------------------ # # The loadbalancer (type lb) worker performs weighted round-robin # load balancing with sticky sessions. # Note: # ----> If a worker dies, the load balancer will check its state # once in a while. Until then all work is redirected to peer # worker. worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tomcat1, tomcat2 # # END workers.properties #
and goto the tomcat server1 and edit the file /opt/tomcat1/conf/server.xml
edit line
to
to
and goto the tomcat server2 and edit the file /opt/tomcat2/conf/server.xml
to
to
In apache server
NameVirtualHost *ServerName localhost1 JkMount /*.jsp tomcat1 JkMount /servlet/* tomcat1 ServerName localhost2 JkMount /*.jsp tomcat2 JkMount /servlet/* tomcat2
And save the files and restart the both tomcat1 and tomcat2 server and apache start
and in browser
http://localhost
apache index.html will dispaly
and http://localhost/index.jsp
request go to server1 and continue if will server load heavy
it will redirect to server2 or in case of fail over