简体   繁体   中英

Spring boot scheduled cron jobs run 2 times when deployed more than one instance

I have four cron jobs in the application and they work some hours in the day. I deployed them in 6 different instance and I use shedLock to prevent overlapping but it wasn't enough. Because sometimes job delay and lock is removed, then job work 2 times again. How can I configure that if a cron job still working in the one instance, other instances don't start job till this one finish?

为什么不使用distribute executor?如果你部署在多个instance上,你必须管理和调度instance的状态,例如instance A在t1运行,instance B在t2运行,非常复杂。你可以部署在instance上或者选择distribute调度执行器,在所有分布式系统中,状态管理非常困难

尝试一次部署一个 Spring Boot Scheduled Cron 作业,以防止它们被部署多个实例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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