Quartz scheduler clustering

quartz-scheduler

I have a 2 node HA server. Node 1 is active and node 2 is standby.

I have made one application and used the quartz api to do clustering. I have made all the tables in the db.

Now do i need to run the module in both the nodes or jst node 1 so that when the node 1 goes down the application automatically starts in node 2.

The trigger and the job name should be same or different while running the module in both the nodes?

Quartz.properties:

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool

org.quartz.threadPool.threadCount = 10

org.quartz.threadPool.threadPriority = 5

org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true

— Using RAMJobStore

— if using RAMJobStore, please be sure that you comment out

— org.quartz.jobStore.tablePrefix, org.quartz.jobStore.driverDelegateClass, org.quartz.jobStore.dataSource

-org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

— Using JobStoreTX

— Be sure to run the appropriate script(under docs/dbTables) first to create database/tables

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX

— Using DriverDelegate

org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate

–New conf for Clustering

org.quartz.jobStore.isClustered = true

org.quartz.jobStore.clusterCheckinInterval = 20000

org.quartz.scheduler.instanceId = AUTO

org.quartz.scheduler.instanceId = AUTO

org.quartz.scheduler.instanceName = MyClusteredScheduler

— Configuring JDBCJobStore with the Table Prefix

org.quartz.jobStore.tablePrefix = QRTZ_

— Using datasource

org.quartz.jobStore.dataSource = qzDS

— Define the datasource to use

org.quartz.dataSource.qzDS.driver = oracle.jdbc.driver.OracleDriver

org.quartz.dataSource.qzDS.URL = jdbc:oracle:thin:@10.172.16.147:1521:emadb0

org.quartz.dataSource.qzDS.user = BLuser

org.quartz.dataSource.qzDS.password = BLuser

org.quartz.dataSource.qzDS.maxConnections = 30

———————–

Best Answer

According to : http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering

in particular :

Clustering currently only works with the JDBC-Jobstore (JobStoreTX or JobStoreCMT), and essentially works by having each node of the cluster share the same database.

Load-balancing occurs automatically, with each node of the cluster firing jobs as quickly as it can. When a trigger's firing time occurs, the first node to acquire it (by placing a lock on it) is the node that will fire it.

You should start all your nodes, the fastest will trigger the job, the others will know about it.

Related Topic