简体   繁体   English

Quartz Java在多台机器上运行作业

[英]Quartz Java Run Jobs in Multiple Machines

I have many jobs with Quartz Schedule and I execute in my java app. 我在Quartz Schedule中有很多工作,并且在我的Java应用程序中执行。 (one event on my webapp active a job to run) (我的Web应用程序上的一个事件激活了一项要运行的工作)

My webapp runs in 4 machines with two instances each, so: 我的webapp在4台机器上运行,每台机器有两个实例,因此:

how can i make sure that the same job does not run 2 times on 2 different machines? 我如何确保同一作业不会在2台不同的计算机上运行2次?

and how i make sure tha there are no problems with persistence in the database? 以及如何确保数据库的持久性没有问题?

You can configure Quartz clustering with JDBC-JobStore. 您可以使用JDBC-JobStore配置Quartz集群。 Basically all your instances should share the same database, and Quartz will ensure that only one instance will run a specific job. 基本上,所有实例都应该共享同一个数据库,Quartz将确保只有一个实例可以运行特定的作业。 More info can be found here 更多信息可以在这里找到

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM