Quartz Scheduler Developer Guide : Advanced Features : Clustering
Clustering
Clustering currently works with the JDBC-Jobstore (JobStoreTX or JobStoreCMT) and the TerracottaJobStore. Features include load-balancing and job fail-over (if the JobDetail's "request recovery" flag is set to true).
Clustering With JobStoreTX or JobStoreCMT
Enable clustering by setting the org.quartz.jobStore.isClustered property to true. Each instance in the cluster should use the same copy of the quartz.properties file. Exceptions of this would be to use properties files that are identical, with the following allowable exceptions: Different thread pool size, and different value for the org.quartz.scheduler.instanceId property. Each node in the cluster must have a unique instanceId, which is easily done (without needing different properties files) by placing "AUTO" as the value of this property.
Important:  
Never run clustering on separate machines, unless their clocks are synchronized using some form of time-sync service or daemon that runs very regularly (the clocks must be within a second of each other). See http://www.boulder.nist.gov/timefreq/service/its.htm if you are unfamiliar with how to do this.
Important:  
Never fire-up a non-clustered instance against the same set of tables that any other instance is running against. You may get serious data corruption, and will experience erratic behavior.
Only one node will fire the job for each firing. For example, if the job has a repeating trigger that tells it to fire every 10 seconds, then at 12:00:00 exactly one node will run the job, and at 12:00:10 exactly one node will run the job, etc. It won't necessarily be the same node each time - it will more or less be random which node runs it. The load balancing mechanism is near-random for busy schedulers (lots of triggers) but favors the same node that just was just active for non-busy (e.g. one or two triggers) schedulers.
Clustering With TerracottaJobStore
Simply configure the scheduler to use TerracottaJobStore as described in TerracottaJobStore, and your scheduler will be set for clustering.
You may also want to consider implications of how you setup your Terracotta server, particularly configuration options that turn on features such as persistence, and running an array of Terracotta servers for HA.
The licensed edition of TerracottaJobStore provides advanced Quartz Where features, that allow for intelligent targeting of jobs to appropriate cluster nodes.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback