Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would a job scheduler like quartz work when you have multiple servers?

When you have multiple servers all running the same web application, how would you make sure multiple jobs don't get fired off (the same job)?

Would you have to use the database to monitor if the job was already run?

like image 235
Blankman Avatar asked Mar 06 '10 01:03

Blankman


2 Answers

I've solved this by only letting one of the servers run the scheduled jobs. If that job server goes down I reconfigure another server to start running jobs in its place. In my case the jobs are not all that critical so I can afford this type of "cold standby" solution.

There are however alternatives, Quartz can run with clustered schedulers and job stores. Read more here.

like image 152
Martin Avatar answered Sep 24 '22 19:09

Martin


See http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering . It appears that Quartz has a mechanism for this out of the box.

like image 31
mhvelplund Avatar answered Sep 23 '22 19:09

mhvelplund