如何在Quartz Scheduler中配置一个以上节点的集群? [英] How to configure clustering with more than one node in Quartz scheduler?

查看:720
本文介绍了如何在Quartz Scheduler中配置一个以上节点的集群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在基于maven的应用程序中将Quartz Scheduler与MySql用作JobStore,我想实现Quartz的集群功能,但是我不知道如何在集群中添加多个节点以及Quartz如何知道节点并管理它们?

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?

简而言之,我想了解Quartz的实际工作原理以及如何设置集群环境.

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

任何帮助将不胜感激.

谢谢

推荐答案

Quartz的实际工作方式

您必须在所有群集节点中配置Quartz(quartz.properties). Quartz将识别并使用此配置文件,前提是它位于类路径中.在所有节点上,配置文件必须相同(除了少数例外),并且包含:

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

第二点很重要,因为它将Quartz连接到数据库,有关作业的信息将在群集节点中存储和共享.例如,每次在一个节点上触发作业时,信息都会通过数据库传递给其他节点,其他节点不会再次触发相同的作业.

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.

如何设置集群环境

之前,您需要一个工作正常的App Server群集.确保在集群中正确配置了您的AS(tomcat,jboss等),然后按照上述说明在每个节点上配置Quartz.详细信息在Ashish提供的链接中.

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.

这篇关于如何在Quartz Scheduler中配置一个以上节点的集群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆