Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About using the same set of quartz tables for clustered and non-clustered schedulers

I have jobs that have to run in clustered mode and also jobs which need to run in every node. I need the non-clustered jobs also to be persistent and so I have created two scheduler one to run in clustered mode and the other to run in no-clustered mode ,both using the same set of quartz tables as the job store. Is there any problem with this design ? I see the following statement from Quartz Configuration reference(http://quartz-scheduler.org/documentation/quartz-2.1.x/configuration/ConfigJDBCJobStoreClustering)

Never start (scheduler.start()) a non-clustered instance against the same set of database tables that any other instance is running (start()ed) against. You may get serious data corruption, and will definitely experience erratic behavior But there is no explanation and I am not clear is that it really mean.Is there any alternative otherwise without creating another set of quartz tables.

like image 451
Byju Veedu Avatar asked Oct 15 '25 08:10

Byju Veedu


1 Answers

If you start two schedulers with different names, you can reuse the same tables without any problem. Jobs, triggers and all other Quartz entities are identified by compound primary key which includes scheduler name. This means clustered scheduler with use a different subset of records and never touch records of non-clustered one.

Another solution is to use a different tables set. Qurtz allows you to define a table prefix on scheduler basis.

The remark from the documentation is about situations where two non-clustered applications with the same scheduler name use the same database. Then they will badly interrupt each other and cause all sorts of issues.

like image 83
Tomasz Nurkiewicz Avatar answered Oct 18 '25 01:10

Tomasz Nurkiewicz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!