tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: How to setup mod_jk to work with an Instance of CATALINA_BASE
Date Tue, 23 Dec 2014 10:09:24 GMT
Nikolas Nikolaou wrote:
>  Hi. I've managed to connect the default  CATALINA_HOME  tomcat 8.0.15 with apache2 using
mod_jk but I can't find Info on how to connect to an Instance of CATALINA_BASE. What changes
would I need to make to the workers file as to the location of tomcat_home.

Hi.
You may be looking at this from the wrong side, and that may be why you are getting confused.

mod_jk is a connector, which allows to "connect" *one* front-end instance of Apache httpd,

with *one or multiple* back-end tomcat instances (which in mod_jk terminology, are called

"workers").
If one Apache2 front-end connects to multiple back-end Tomcat instances, then mod_jk can 
act not only as a connector, but it can also act :
- as a switch, by forwarding requests to different Tomcats based on the request URLs
- as a load-balancer, by forwarding requests to different Tomcats based on some 
load-balancing algorithm
- or as both

Schematically :

Browser <-- HTTP --> Apache2 + mod_jk <-- AJP --> Tomcat1 + webapps
                                   |--<-- AJP --> Tomcat2 + webapps
                                   |--<-- AJP --> Tomcat3 + webapps
                                    etc..
each of the above Tomcat's, would be known to mod_jk as a "worker", e.g.
Tomcat1 = worker1
Tomcat2 = worker2
Tomcat3 = worker3
etc..

mod_jk "talks to" a specific Tomcat worker using TCP/IP.
For that, mod_jk needs to know the IP address/port of that Tomcat worker, on which it is 
listening for such requests (a).
Vice-versa, to accept requests from mod_jk and respond to them, each Tomcat instance needs

an "AJP Connector", set up to listen on a specific IP address/port combination (b).

(a) is configured in the Apache2/mod_jk "workers.properties" file, which is unique and 
belongs to the unique mod_jk module in Apache2.
The syntax of the workers.properties file is explained here :
http://tomcat.apache.org/connectors-doc/generic_howto/workers.html
In this file, there should be one "worker" defined, for each back-end Tomcat instance you

wish to communicate with.

(b) is configured in each of the running Tomcat instances specifically, by a configuration

snippet like <Connector protocol="AJP.."
The syntax of this is explained here :
http://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html

To allow mod_jk to communicate with a given running Tomcat instance, there must be a match

between
- the IP (or DNS name) and port that you indicate for a "worker-x" (a running Tomcat 
instance) in the (single) Apache2 workers.properties file
- and the "listening IP/port" that you indicate in the AJP <Connector> entry in the

configuration of that Tomcat instance (in the "server.xml" configuration file that is in 
that Tomcat's CATALINA_BASE directory.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message