You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Konstantin Kolinko (Confluence)" <no...@apache.org> on 2019/11/24 00:20:09 UTC
[CONF] Apache Tomcat > ClusteringOverview
There's **1 new edit** on this page
---
|
---
| | [](https://cwiki.apache.org/confluence/display/TOMCAT/ClusteringOverview?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"page icon")
---
[ClusteringOverview](https://cwiki.apache.org/confluence/display/TOMCAT/ClusteringOverview?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"ClusteringOverview")
| | | | |  | | Konstantin
Kolinko edited this page
---
|
| | Here's the version comment
---
|
---
| | |  | | Konstantin
Kolinko edited at [12:13
AM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103098638)
---
| | | Add a permalink. Fix formatting. Convert links to https.
---
|
| | Here's what changed:
---
|
_Permalink_ to this page: [
https://cwiki.apache.org/confluence/x/DiklBg](https://cwiki.apache.org/confluence/x/DiklBg)
# From Zero to Clustered - an Overview
...
Also, there is a lot of misleading, incomplete, and just flat wrong
information concerning Tomcat floating around on the Internet. You might get
accurate information elsewhere, but from what I've seen this is not very
likely. The authoritative source for information is always:
http[https://tomcat.apache.org/](https://tomcat.apache.org/)
## Linux in General
You'll find that Linux is a different beast than Windows (even Windows 7). In
particular file permissions, file ownerships, and SELinux present quite a
different security model than the typical Windows installation. It's best to
be aware of this from the start.
...
If you're setting up a development platform, then just create a directory and
unpack multiple Tomcat servers in that directory. This will make dealing with
permissions easier, which is an important consideration when integrating
Tomcat servers with IDEs such as Eclipse or NetBeans.
## Apache HTTPD
Rather than building your own Apache HTTPD, I recommend that you get and
install the distribution package for Apache HTTPD. This will place files in
line with the rest of your system, and it will also have a serviceable default
configuration.
...
Now stop the Tomcat server with shutdown.sh and set up the manager
application. This involves editing the tomcat-users.xml file found in the conf
directory. Instructions for editing that file (for Tomcat 7) can be found
here:
http[https://tomcat.apache.org/tomcat-7.0-doc/manager-
howto.html#Configuring_Manager_Application_Access](https://tomcat.apache.org/tomcat-7.0-doc/manager-
howto.html#Configuring_Manager_Application_Access)
Once it's running and you can access the manager application, then associate
the installation with your IDE (if you're setting up a development
environment). Now you can develop, debug, test, and deploy from within your
IDE without running into permission issues.
|
 Warning
---
Unlike Apache HTTPD, most people on the mailing list do NOT recommend that you
use the Linux distribution packaged versions of Tomcat. In general people have
found that these are much more difficult to work with than just getting a
stock Tomcat from http
[https://tomcat.apache.org/](https://tomcat.apache.org/)
## mod_jk build
While other people have had difficulty (search the mailing list) building
mod_jk on various platforms, I've never had much trouble. The steps are quite
simple, provided you have the appropriate packages installed on your system.
1.  Wiki Markup
Download
the
source
from
http
[https://tomcat.apache.org/download-
connectors.cgi](https://tomcat.apache.org/download-connectors.cgi)
2\.
2. Unpack it into a directory 3\.
3. cd to \`[tomcat-connectors-1.xx`\`]/native` 4\.
4. Read
`BUILDING.txt`
\\\
Following `BUILDING.txt`:
1. `./configure --with-apxs=/usr/sbin/apxs` 2\.
2. `make` 3\.
3. su to root 4\.
4. cd back to where you were 5\.
5. `make install`
This will put everything in the right place.
## mod_jk configuration
...
Recent
...
versions
...
of
...
mod_jk
...
come
...
with
...
some
...
very
...
nice
...
and
...
well-commented
...
examples.
...
They
...
can
...
be
...
found
...
in
...
`[tomcat-connectors-1.xx`
...
`]/conf`.
...
Read
...
them,
...
follow
...
them,
...
use
...
them.
The defaults have been chosen to work in most general use cases.
...
See the following for documentation on worker name versus jvmRoute attribute:
http[https://tomcat.apache.org/tomcat-7.0-doc/cluster-
howto.html#Cluster_Basics](https://tomcat.apache.org/tomcat-7.0-doc/cluster-
howto.html#Cluster_Basics)
See the following for mod_jk loadbalancer configuration:
http[https://tomcat.apache.org/connectors-
doc/reference/workers.html](https://tomcat.apache.org/connectors-
doc/reference/workers.html)
### Another Tomcat
While the easiest way to get started with clustering is just to unpack another
copy of Tomcat in another directory, it's probably far more useful to use the
concept of CATALINA_HOME and CATALINA_BASE. See RUNNING.txt in the Tomcat
directory for details.
...
1. Change the SHUTDOWN port to not conflict with the first Tomcat 2\.
2. Change the HTTP/1.1 port to not conflict with the first Tomcat (useful for testing) 3\.
3. Change the AJP/1.3 port to match that configured in workers.properties 4\.
4. Change the jvmRoute attribute of the Engine element to match the correct worker name 5\.
5. Configure the manager application (useful for testing)
...
The basic clustering documentation can be found here:
http[https://tomcat.apache.org/tomcat-7.0-doc/cluster-
howto.html](https://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html)
It's long, involved, and needs to be read carefully. However, as a first pass
the following will work.
1. Make sure that each Tomcat has a unique jvmRoute in the Engine element (see above) 2\.
2. Make sure that the jvmRoute matches the correct worker name (see above) 3\.
3. Make sure that each Tomcat has a unique shutdown port (see above) 4\.
4. Make sure that each Tomcat has a unique AJP/1.3 port (see above) 5\.
5. Make sure that each AJP/1.3 port matches the correctly named worker in workers.properties (see above) 6\.
6. Make sure that each HTTP/1.1 port is unique (nice for manager access) 7\.
7. Copy the example configuration from [https:](https://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html)
...
1. [//tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html](https://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html)
...
1. to inside the Host element in each server.xml, but omit (for now) the Deployer element. The cluster configuration can be placed inside the Host or Engine element. However, the Farm Deployer element will only work if the cluster configuration is inside the Host element.
2. Start up your Tomcat servers. If everything is set up correctly, cluster notifications will appear in the logs.
It's also useful to have the access log enabled for your Tomcat servers. You
can then tell which Tomcat is receiving the request from Apache HTTPD.
...
1. Stock Apache HTTPD installation (and verify) 2\.
2. Stock Apache Tomcat installation (and verify) 3\.
3. mod_jk installation (and verify) 4\.
4. Second Apache Tomcat installation (and verify) 5\.
5. Cluster
| | | [Go to page
history](https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=103098638&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db "Go to page
history")
---
---
| [View
page](https://cwiki.apache.org/confluence/display/TOMCAT/ClusteringOverview?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view)
---
| | [Stop watching
space](https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=TOMCAT&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=stop-
watching&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4c3JmOjhhYTk4MDk1NjlkNDIzY2QwMTZhMDQxMzMwNmYwMGRiIiwicXNoIjoiMjI2NGUzOTE1MGJlOWVmZDU3NzA0Yjc1MTcwNjEzMWVkYWE1ODk4NGJlNzMzZDM4ZDI0MGU4ZTNjYWY0NTg2YiIsImlzcyI6ImNvbmZsdWVuY2Vfbm90aWZpY2F0aW9uc0FSRUgtWFVEMS1QT1FHLUNTQU8iLCJleHAiOjE1NzUxNTk2MDgsImlhdCI6MTU3NDU1NDgwOH0.Y23P7fi6ZN_nvX9QLgQ81FF6Fd6VadO5gE-
Px-CDfeQ) | •
---|---
[Manage
notifications](https://cwiki.apache.org/confluence/users/editmyemailsettings.action?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574554808925&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=manage)
---
| 
---
This message was sent by Atlassian Confluence 6.15.8

---