-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Darryl,

On 4/21/20 12:03, Darryl Philip Baker wrote:
> We currently have an application running in Tomcat7 that is
> connected to Apache HTTPD via the mod_jk plugin. I have been asked
> to get a newer version of the same application running on the same
> machine using Tomcat9. I know I will need to use alternate ports
> and paths.

Do you want to run them in parallel, or do you just want to upgrade
Tomcat underneath your application? (Or do you want to have a
"staging" version in parallel with a plan to complete migration once
you have fully tested everything?)

> I am a bit overwhelmed trying to understand how to configure the
> second Tomcat and its workers so the connect to Apache correctly.
I'm going to make a few assumptions and then continue:

1. You want to run these two Tomcats in parallel, with the same
application, on the same machine

2. You are only using one network interface (or "all" network interfaces
)

3. You have a pretty simple AJP configuration mapping httpd -> Tomcat

4. You are using a single virtual host in httpd

This should be fairly straightforward.

First, you'll need to install your new version of Tomcat somewhere
and, probably, drop your WAR file into that new version's ""webapps"
directory. (Here's where I tell you that using a "split" CATALINA_HOME
and CATALINA_BASE can be your friend, but let's keep things simple for
now. After you are all done, go and read the ""advanced" section of
RUNNING.txt to see what I mean).

When you put your WAR file into "webapps", change its name to
something like "tc9staging.war". Just as long as it's not the same
name as the original. (This will come back up, later).

Second, edit your conf/server.xml and configure all the ports:

1. The "shutdown" port (default: 8005)
2. The HTTP port (default: 8080)
3. The AJP port (default: 8009)

Don't overthink these ports. Maybe just add "1" to each one for now?

You might want to configure disabling AJP entirely and using
mod_proxy_http to connect httpd -> Tomcat. For now, let's keep your
AJP connector for simplicity.

Third, launch Tomcat and make sure that (a) there are no obvious
errors in log/catalina.out and (b) your application seems to deploy
properly.

Fourth, connect httpd -> [new] Tomcat.

In httpd.conf (or one of the files it includes, perhaps), you should
have lines like this:

  JkMount /myapp

The text "" may be almost anything. That's the "worker name" and it's
usually defined usually in a file specified by JkWorkersFile. If you
don't have a "JkWorkersFile" directive anywhere, we'll have to dig a
little deeper.

In your jkworkers.properties file, all the workers are defined. We
will need to duplicate those to create new workers pointing to the new
Tomcat. Something like this:

[existing]
worker.list=workerX
worker.workerX.type=ajp13
worker.workerX.host=localhost
worker.workerX.port=8009

We'll add a new worker called tc9staging:

worker.list=tc9staging
worker.tc9staging.type=ajp13
worker.tc9staging.host=localhost
worker.tc9staging.port=8010

Note that the "worker.list" property is in dded repeated, and it is
indeed different than the previous one. That's okay: they are
cumulative and you won't lose the old config.

Now, back to httpd.conf. Duplicate your JkMounts for the new URL path
(remember when we chose the new name of the web application above?)

  JkMount /tc9staging tc9staging

Now restart httpd and you should be able to get to your old app here:

https://example.com/myapp

and the new app here:

https://example.com/tc9staging

*crosses fingers*

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl6fc7MACgkQHPApP6U8
pFj03A/+NAjm2oEhg05JtCgE0pkeC+EhodHazbvn77mEFAxTVBr8Sbr/6o4jQBvJ
oXMoOkqs2mQH+ZAFci3QmIhcjAVjG2JJxtPlmiKE+s4HX7bx/UuhjDEl6Tv0v3Cs
6ey1eP+KCIPAwzDmqroLMGrs+QPSaMNV3wGP8XL6q7z/RlzuPvrZ917b8c1pcEpM
BR2NsPikC4C9OBDzPLiHvdhE0key7Ua6QbDqJSVvXiPpiK2BJHWlhyRj6l9OZyc5
nlGgOA/GrHvqGAbOJ19vkhVffzpWpVDg6xLtJIMPfrzfFsf6TpsnPUoLql/IBBxo
oPvaKVDUVLLkzVO/xdoLeYkjJQdj13kfpabIMutKPZl3Z080c5jyHJEGj7Ryuk0h
1hd3ZAtu9Qyk1C0iV4W1YbipoK+f9/B8ZrmE075INz8yLkeFR3WM9pk7pgCYuEVH
33zj9+77riJ4eI72CJqbvkUYgSgd7mUX0x6NLgM85WpKDbehpPlcNrHBHaaSCrhu
FaYBGqR2oxXMortqk6AKQZ+Tlbu50ADA+HVGdBtYbhKWF/aV337fTwk9ivCYHpnz
2XpcrLlHFwNRvmnicssI+1Xf5uluaX3COZf7v1VZAsxTeFZXtr03IiadS1hdRpzL
FTH2DUb5QoOpG42Q2ljNQJjCprVgKcobI//7iHyQryRkgGmiXAI=
=Ke+7
-----END PGP SIGNATURE-----

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

Reply via email to