Using the quartz job scheduler in a clustered environment

Clustering can be implemented with the Quartz scheduler in this application release automation tool, provided a JDBC Jobstore is used (the Jobstore class must be JobStoreTX or JobStoreCMT), with all the nodes of the cluster using the same database.

Please note that: Generally, all nodes should be on a single machine. It is possible to run clustering on separate machines, but problems will be experienced unless their clocks are synchronised to within a second of one another.

Non-clustered and clustered instances should not be run against the same database concurrently, nor should multiple non-clustered instances be run concurrently. It is recommended that each instance in the cluster uses the same copy of the quartz.properties file. If different files are used, the only allowable differences are the size of the thread pool, and the setting of the instanceId (see below).

Within a cluster, each job will be fired once, by a single node. The node used is random, thus creating a load-balancing capability. Once a job has been acquired by a node, other nodes are locked out to prevent duplication. Likewise, fail-over is incorpoarted into the design and should occur automatically.

In creating a clustered configuration the key properties to set are:

org.quartz.jobStore.isClustered must be set to 'true',

each org.quartz.scheduler.instanceId must be unique (which is best accomplished by setting to 'AUTO').

Example configuration

A sample Spring configuration example is included (commented out) in the Web Applications config file:

<WEB_APP_ROOT>/WEB-INF/applicationContext.xml