简体   繁体   English

集群Quartz调度器配置

[英]Clustered Quartz scheduler configuration

I'm working on an application that uses Quartz for scheduling Jobs. 我正在使用Quartz计划Jobs的应用程序。 The Jobs to be scheduled are created programmatically by reading a properties file. 通过读取属性文件以编程方式创建要调度的作业。 My question is: if I have a cluster of several nodes which of these should create schedules programmatically? 我的问题是:如果我有几个节点的集群,这些节点中的哪个应该以编程方式创建时间表? Only one of these? 其中只有一个? Or maybe all? 还是全部?

i have used quartz in a web app, where users, among other things, could create quartz jobs that performed certain tasks. 我在网络应用程序中使用了石英,用户可以在其中创建执行某些任务的石英作业。

We have had no problems on that app provided that at least the job names are different for each job. 只要至少每个工作的工作名称都不同,我们在该应用程序上就没有问题。 You can also have different group names, and if i remember correctly the jobgroup+jobname combination forms a job key. 您也可以使用不同的组名,如果我没记错的话,jobgroup + jobname组合会形成一个工作密钥。

Anyway we had no problem with creating an running the jobs from different nodes, but quartz at the time(some 6 months ago, i do not believe this has changed but i am not sure) did not offer the possibility to stop jobs in the cluster, it only could stop jobs on the node the stop command was executed on. 无论如何,我们都没有从不同节点创建运行作业的问题,但是当时是石英(大约6个月前,我不相信这种情况已经改变,但我不确定)没有提供停止集群中作业的可能性,它只能在执行停止命令的节点上停止作业。

If instead you just want to create a fixed number of jobs when the application starts you better delegate that job to one of the nodes, as the jobs name/group will be read from the same properties file for each node, and conflicts will arise. 相反,如果您只是想在应用程序启动时创建固定数量的作业,则最好将该作业委托给一个节点,因为将从每个节点的相同属性文件中读取作业名称/组,并且会发生冲突。

Have you tried creating them on all of them? 您是否尝试过在所有对象上创建它们? I think you would get some conflict because of duplicate names. 我认为由于名称重复,您会遇到一些冲突。 So I think one of the members should create the schedules during startup. 因此,我认为其中一位成员应在启动期间创建时间表。

You should only have one system scheduling jobs for the cluster if they are predefined in properties like you say. 如果在您说的属性中预定义了群集的系统调度作业,则应该只有一个。 If all of the systems did it you would needlessly recreate the jobs and maybe put them in a weird state if every server made or deleted the same jobs and triggers. 如果所有系统都做到了,那么如果每个服务器都制作或删除相同的作业和触发器,则您将不必要地重新创建作业,并可能使它们处于怪异状态。

You could simply only deploy the properties for the jobs to one server and then only one server would try to create them. 您可以仅将作业的属性部署到一台服务器,然后只有一台服务器将尝试创建它们。

You could make a separate app that has the purpose of scheduling the jobs and only run it once. 您可以制作一个单独的应用程序,其目的是安排作业,并且只运行一次。

If these are web servers you could make a simple secured REST API that triggers the scheduling process. 如果这些是Web服务器,则可以制作一个简单的安全REST API来触发调度过程。 Then you could write an automated script to access the API and kick off the scheduling of jobs as part of a deployment or whenever else you desired. 然后,您可以编写自动化脚本来访问API,并在部署过程中或其他需要的时候启动作业调度。 If you have multiple servers behind a load balancer it should go to only one server and schedule the jobs which quartz would save to the database backed jobstore. 如果您在负载均衡器后面有多个服务器,则应仅访问一台服务器,并计划将石英保存到数据库支持的作业存储中的作业。 The other nodes in the cluster would receive them the next time they update from the database. 集群中的其他节点在下次从数据库更新时会收到它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 集群Quartz Scheduler无法正确触发? - Clustered Quartz Scheduler not firing correctly? Quartz Scheduler /多个(非群集)调度程序实例 - Quartz Scheduler / Multiple (Non Clustered) Scheduler Instances Spring Boot Quartz 调度器配置 - Spring Boot Quartz Scheduler Configuration Quartz 调度程序在集群模式下的所有节点上触发 cron 作业 - Quartz Scheduler firing cron job on all nodes in clustered mode 集群(多实例)石英调度程序中断 API 无法有效工作 - Clustered(Multiple Instances) Quartz scheduler Interrupt API not working effectively Java Quartz Scheduler错误或我的配置有问题 - Java Quartz Scheduler Bug or issue with my configuration 非集群的Quartz Scheduler:在应用程序启动时实例化和启动Scheduler ...对于多台机器来说这安全吗? - Non-clustered Quartz Scheduler: Instantiating and starting scheduler on application startup… is this safe for multiple machines? 石英群集调度程序中的触发API是否会在同一本地计算机或群集中的任何计算机上触发作业? - Does trigger API in quartz clustered scheduler triggers job in the same local machine or any machine in the cluster? 石英和弹簧 - 聚集但不持久? - Quartz & Spring - Clustered but NOT Persistent? 在集群环境中使用Quartz - Using Quartz in a clustered environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM