-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Richard,
On 5/5/16 3:29 PM, Decker, Richard M wrote: > I'm trying to configure & demo an Apache Tomcat [v8] cluster env, > that supports different apps functioning on different systems. > > Basically, I'm trying to setup an environment where an app can be > on only 1 or 2 (deployed or running) out of the 3 Tomcat systems > in the cluster. However, this does not seem to work for me, as I > can't get away from the 404s when Apache HTTPD goes to a random > (round robin) Tomcat system, that does not have the application > (running or deployed) on it. The one thing you forgot to post was your JkMounts from httpd.conf (or similar). Can you post those? I believe this can be entirely solved with a slightly more complicated configuration. > This happens with both new & cached sessions. I can bring an > entire Tomcat system down, and it works as designed, but not for > (stopped or undeployed) single applications. I'm really not sure > how Tomcat and Apache are supposed to communicate with each other > in this regard; so they know what apps are deployed/running on each > system. Is this even possible? Yep. You just need to tell your load-balancer about which applications can be found where. > According to the link below, it should work... > > http://tomcat.apache.org/tomcat-8.0-doc/config/cluster-manager.html > > > > The org.apache.catalina.ha.session.BackupManager also replicates > deltas but only to one backup node. The location of the backup > node is known to all nodes in the cluster. It also supports > heterogeneous deployments, so the manager knows at what locations > the web application is deployed. > > -------------------- Env - Top Down -------------------- > > [Load Balancer] - (Sticky Sessions) | [HTTPD1] - [HTTPD2] - (Load > Balanced, Sticky Sessions) | [Tomcat1] - [Tomcat2] - [Tomcat3] - > (BackupManager) Okay. > -------- Config -------- > > [HTTPD] worker.list=tomcattest, statustest > > worker.tomcat1.type=ajp13 worker.tomcat1.host=tomcat1 > worker.tomcat1.port=XXXX #worker.tomcat1.lbfactor=5 > > worker.tomcat2.type=ajp13 worker.tomcat2.host=tomcat2 > worker.tomcat2.port=XXXX #worker.tomcat2.lbfactor=5 > > worker.tomcat3.type=ajp13 worker.tomcat3.host=tomcat3 > worker.tomcat3.port=XXXX #worker.tomcat3.lbfactor=5 > > worker.tomcattest.type=lb > worker.tomcattest.balance_workers=tomcat1,tomcat2,tomcat3 > worker.tomcattest.sticky_session=True # lb methods: [R]equest, > [S]ession, [T]raffic, [B]usiness worker.tomcattest.method=R > worker.statustest.type=status If you define more than one lb worker, you can do this in a more nuanced way. For example: worker.tomcat1.host=tomcat1 worker.tomcat1.port=XXXX worker.tomcat2.host=tomcat2 worker.tomcat2.port=XXXX worker.tomcat3.host=tomcat3 worker.tomcat3.port=XXXX worker.app-a.type=lb worker.app-a.balance_workers=tomcat1,tomcat2 worker.app-a.sticky_session=True worker.app-a.type=lb worker.app-a.balance_workers=tomcat2,tomcat3 worker.app-a.sticky_session=True Then, in httpd.conf: JkMount /app-a/* app-a JkMount /app-b/* app-b You can just deploy the applications wherever you want them. Now, how do you deploy them everywhere but then allow one of them to be taken out of service without taking-down the whole Tomcat instance? There are several ways of doing that which I'll summarize, here. Let's start a new thread if you want to ask about how to do this in further detail. 1. Deploy a ROOT application on each Tomcat node that will return a "failure" status whenever you request /app-a/* or /app-b/* (etc.). Maybe the ROOT web application ALWAYS returns an error status. 2. Use the mod_jk status worker to set the activation status of one of the Tomcat nodes to "DIS" (disabled). This will send requests without a session identifier to other nodes in the balancer. Set it to "STO" and it will cause *all* requests to be sent to other nodes. The first method is more fault-tolerant and lazy, since you don't have to tell mod_jk when nodes will be going down. The second method is a little more work, but it also means that you can drain nodes before scheduled maintenance, which is nice. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlcrukwACgkQ9CaO5/Lv0PA1QwCgroEfkUXGfhJnGVWu4PlWES4v mqAAnA3+F9TGgC1jLbGD7SOh5/4JkJAS =KvPU -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org