You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kelly, Terence" <kt...@exch.hpl.hp.com> on 2003/03/13 18:48:04 UTC

three tiers on three machines: Apache, Tomcat, DB

Does anyone have experience running Tomcat
sandwiched between Apache and a database like
MySQL or PostgreSQL, with each component
running on a separate host?

I've been looking at a few "how-to" documents
that I found via Google with instructions on
making Apache talk to Tomcat via JK2.  However
these documents assume everything is running
on the same host and I haven't even succeeded
in building the requisite components with the
components on different hosts.

I want Apache on one machine, Tomcat (running
the sample "PetStore" application) on a second
machine, and a DB like MySQL or PostgreSQL on
a third.

I know a chap who did something very similar
a year or two ago using mod_jk, which is now
deprecated, but he's not familiar with the new
mod_jk2.  Has anyone on this list done anything
like I describe above?  Tips would be much
appreciated.  Thanks in advance for any advice
you can provide!

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


Re: three tiers on three machines: Apache, Tomcat, DB

Posted by Mark Eggers <it...@yahoo.com>.
Terence,

I've never done this, and I don't have three machines
to test this on.  However, this is how I would
approach things:

#
# workers2.properties
# replace <hostname> with your host name for Tomcat
# replace <ip_address> with your host ip address for 
# Tomcat
#
[channel.socket:<hostname>:8009]
port = 8009
host = <ip_address>

# define the worker
[ajp13:<hostname>:8009]
channel=channel.socket:<hostname>:8009

# map a URI
[uri:/examples/*.jsp]
worker=ajp13:<hostname>:8009

#
# jk2.properties
#
# Socket configuration
#
handler.list=request,container,channelSocket

#
# socket configuration
#
channelSocket.port=8009
channelSocket.address=<ip_address>
channelSocket.maxPort=port+10

<!-- JNDI stuff
see the following in the documentation and replace
localhost with the name or ip address of your database
server.  This should get remote database connections
up and running

http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html

-->

There are a few issues that I'm not sure about.  One
is how to get the URIs correct when a request is
forwarded from your Apache host to the Tomcat host. 
Does this happen automatically, or do you need to do
some URI rewriting?

Also, lacing static and dynamic pages together might
get interesting.  I would imagine that you would need
to create the same site structure on both machines so
that html, images, css files, jsp files, and servlets
can 'find' each other.

Just some thoughts - hope this gets you started.

/mde/
just my two cents . . . .

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

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