Greetings!
I'm still relatively new to
Tomcat configuration and have search for an answer, but cannot find anything specific, so please let me know if there is a resource for the following.
We have a read/write users (MySQL) database and a read-only backup database (also MySQL). We use the read-only as a failover if we lose connection to the primary to maintain operations. I have successfully configured my Tomcat (6.0.35) with a DataSourceRealm to connect to the primary database by adding the boilerplate in the server.xml file and the specific connection information to a container in it's context.xml
I know I can manually change the context.xml to point to the backup database and restart the server if need be, but is there a way to automate this failover switch?
We currently write a zero-length file to a particular directory every (X) minutes to indicate the heartbeat of the primary (and backup) database servers. I can imagine writing something (in an extended Realm Class, perhaps or "further up" the Tomcat chain?) that checks on these heartbeat files, but I'm not sure how to tell Tomcat to switch over to the backup and restart itself, if this is even possible.
Any input is much appreciated!
-kevin.