go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Side notes for mod_jk installation 64-bit
 
Subject: Side notes for mod_jk installation 64-bit
Author: AwsEC2
In response to: Integrate Apache httpd with Tomcat plus failover
Posted on: 08/30/2012 02:43:24 PM

1) Always get the latest version

$ cd /home/ec2-user
$ mkdir mod_jk
$ cd mod_jk
$ curl http://apache.osuosl.org/tomcat/tomcat-connectors/jk/
tomcat-connectors-1.2.37-src.tar.gz > tomcat-connectors-1.2.37-src.tar.gz
$ tar xzf tomcat-connectors-1.2.37-src.tar.gz
$ cd tomcat-connectors-1.2.37-src/native
$ ./configure --with-apxs=/usr/sbin/apxs
$ make
$ sudo make install



2) $ make may return 'make not found'

You may have to install first by
# yum install make



3) The install may change the location depending on your OS

For 32-bit: /usr/lib/httpd/modules/mod_jk.so
For 64-bit: /usr/lib64/httpd/modules/mod_jk.so



4) Accordingly, a working httpd.conf
# vi /etc/httpd/conf/httpd.conf

# Load mod_jk module
LoadModule    jk_module  /usr/lib64/httpd/modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties

# Where to put jk shared memory
JkShmFile     /var/log/httpd/mod_jk.shm

# Where to put jk logs
JkLogFile     /var/log/httpd/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

<VirtualHost *:80>
  ServerName example1.com
  ServerAlias www.example1.com
  DocumentRoot /home/ec2-user/example1.com/html
  SuexecUserGroup ec2-user ec2-user

  <Directory /home/ec2-user/example1.com/html>
    Options Indexes Includes FollowSymLinks
    AllowOverride All
  </Directory>

# Send servlet for context /examples to worker named worker1
  JkMount  /examples/servlets/* worker1

# Send JSPs  for context /examples to worker named worker1
  JkMount  /examples/*.jsp worker1

</VirtualHost>


# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]


 

> On 11/02/2011 07:12:46 PM Linux wrote:



                        -------              ----------
   www.exmaple1.com ---|       |            |          |
                       |       |  mod_jk    |  tomcat  |
                       | httpd |------------|(primary) |
   www.exmaple2.com ---|       |         |  |          |
                       |_______|         |  |__________|
                                         |
                                         |   ----------
                                         |  |          | 
                                         |  |  tomcat  |
                                         |--|(failover)|
                                            |          |
                                            |__________|



A load balancer is a worker that does not directly communicate with Tomcat. Instead it is responsible for the management of several "real" workers, called members or sub workers of the load balancer.

A practical example given here is to use loadbalancer to provide high-availability service with a failover tomcat server.

  # The dvanced router LB worker
  worker.list=router
  worker.router.type=lb
  worker.router.balance_workers=worker1,worker2

  # Define the first member worker
  worker.worker1.type=ajp13
  worker.worker1.host=myhost1
  worker.worker1.port=8009
  # Define preferred failover node for worker1
  worker.worker1.redirect=worker2

  # Define the second member worker
  worker.worker2.type=ajp13
  worker.worker2.host=myhost2
  worker.worker2.port=8009
  # Disable worker2 for all requests except failover
  worker.worker2.activation=disabled


The redirect flag on worker1 tells the load balancer to redirect the requests to worker2 in case that worker1 has a problem. In all other cases worker2 will not receive any requests, thus acting like a hot standby.





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.