unfettered unfettered - 1 month ago 18
Java Question

How to orchestrate a clustered Quartz job

Say I have a

BackendApp
that deploys as a WAR and is deployed to multiple nodes. I deploy it to multiple nodes for high availability. The app uses Quartz to schedule certain jobs being kicked off. Let's say one of these jobs should only be ran once a day.

If I have the app deployed to 5 nodes, it will get ran 5 times a day, once on each node.

Do any mechanisms exist to orchestrate certain jobs things that should only run once in a distributed/clustered environment, and not by each app instance in the cluster?

I did find this article but it seems to be a solution that is limited to one node:


Never run clustering on separate machines, unless their clocks are synchronized using some form of time-sync service...

Answer

You can use a JDBC store and set clustered to true, make sure all the nodes are on the same database and make sure all the machine have a time-sync service.

http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJobStoreTX