How to configure clustering with more than one node in Quartz scheduler?

我怕爱的太早我们不能终老 提交于 2019-12-11 21:26:58

问题


I am using Quartz scheduler with MySql as JobStore in a maven based application and I want to implement the clustering feature of Quartz but I don't have any idea how to add multiple nodes in the cluster and how Quartz knows about the nodes and manages them?

In short I want to understand How Quartz actually works and how to setup clustering environment.

Any help will be highly appreciated.

Thanks


回答1:


How Quartz actually works

You have to configure Quartz (quartz.properties) in all your cluster nodes. Quartz will recognize and use this config file provided it is somewhere in the classpath. The configuration file must be identical (except a few exceptions) on all the nodes, and contain:

  • the property org.quartz.jobStore.isClustered = true
  • a JDBC JobStore config, cf http://quartz-scheduler.org/documentation/quartz-2.1.x/configuration/ConfigJobStoreTX

The 2nd point is important because it connects Quartz to a database where the information about the jobs will be stored and shared in your cluster nodes. For example, every time a job is fired on a node, the information is passed to the other nodes via the database, and other nodes won't fire the same job again.

How to setup clustering environment

You need a working cluster of your App Server before. Make sure your AS (tomcat, jboss, etc) is properly configured in a cluster, then configure Quartz on each node as explained above. Details are in the link provided by Ashish.



来源:https://stackoverflow.com/questions/19557173/how-to-configure-clustering-with-more-than-one-node-in-quartz-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!