Our (Spring) application contains several Schedulers
which become active during the night to change/update some data (from Database
) in Batch
.
This is all running fine, the problem is that our application will soon run in a clustered environment
.
What are the best options to prevent a scheduler
of instance A
and instance B
are doing the same work at the same time?
** UPDATE **
Clustered environment is setup as 'active-active'
.
Each node communicates with it's own database instance. Each database instance will replicate
data to the other instances.
DB-instances are not setup as 'master-slave'
but will run in a Galera cluster
where each instance executes insert-update-delete operations.
So each scheduler
should run only once on one instance. The other instances should not run the schedulers. So I need to find a way the a Scheduler of one instance runs, the same schedulers of the other instances should not run.
While clustered scheduled tasks can only be managed through PowerShell, they also show up in the Task Scheduler user interface under the Failover Clustering folder. Can I use any account other than the SYSTEM account?
To add the server-level property to disable/enable the scheduler on a node in cluster setup: Log in to the WebLogic Administrative Console. In left pane, click Environment, Servers. Click the name of the managed server in which you want to add the scheduler.disabled=true property. Click Configuration, Server start tab in the right pane.
In a clustered environment, there is no synchronization. Each Integration Server has a scheduler thread, and whichever server gets to it first will run a task. There is no intention to make a task stick to one node, nor does it make any attempt to evenly distribute the load.
At any given instance, the scheduler can be in one of the following statuses: If the scheduler is in the started status, then jobs can be scheduled and jobs that have already been scheduled will continue to run at the scheduled time. If the scheduler is in the stopped status, then all jobs are stopped.
Just for completeness: we ended up with persistent Quartz job scheduling
.
This post helped me a lot about persistent Quartz scheduling
with Spring
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With