AJP alternative to allow orderly hand-off between old Tomcat instance w/old warfile & new instance w/new warfile?
Is there any way to set up a single server with Apache and Tomcat that allows servlet requests to be passed to Tomcat as usual, but when the time comes to do a restart or redeployment,
start up a second instance with the new warfile
WAIT until it's actually ready to serve requests without the usual random errors and responses that seem to be the norm for the first few minutes of Tomcat's life after launch
cleanly switch new servlet requests from Tomcat#1 to Tomcat#2. Sessions aren't involved. It's fine if the connector just quits sending new requests to Tomcat #1, waits a few seconds, then disconnects Tomcat #1 entirely.
watch the logs, make sure Tomcat#2 (with the new code) is working
instantly switch back Tomcat#1 if something blows up, or shut down Tomcat #1 if Tomcat#2 is OK?
I've seen plenty of examples here and elsewhere, but they all seem to have one fatal flaw: the second instance starts handling requests about 30 seconds before Tomcat is really ready.
Is there maybe an AJP alternative that adds a bit of extra intelligence, like not introducing server #2 into the equation until it's really working, and possibly returning alternate content served by Apache itself if it discovers that no Tomcat instance appears to be working properly?
Also, note that (at this point, at least), I'm not trying to achieve loadbalancing or automatic failover. I'm just trying to find a way to seamlessly pull off a Tomcat restart without anybody noticing by leaving #1 running until #2 is ready to take its place. The whole process itself would be monitored 开发者_JAVA技巧and personally attended to.
精彩评论