分布式环境中的 Springquartz/cron 作业
我有大约 5 台服务器。我想在每台机器上运行相同的 Spring/Tomcat 应用程序。
我还需要每十分钟执行一次特定任务。它应该只在其中一台机器上运行。我需要某种选举协议或其他类似的解决方案。
Spring 或 Quartz 是否有任何类型的内置分布式 cron 解决方案,或者我需要自己实现一些东西?
I have a fleet of about 5 servers. I want to run an identical Spring/Tomcat app on each machine.
I also need a particular task to be executed every ten minutes. It should only run on one of the machines. I need some sort of election protocol or other similar solution.
Does Spring or Quartz have any sort of built-in distributed cron solution, or do I need to implement something myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Hazelcast 有一个分布式执行器框架,您可以使用它来使用 JDK Executor 框架运行作业(顺便说一句,它可能比可怕的 Quartz 更容易测试......也许)。它有多种操作模式,包括让它“随机”选择一个节点来执行您的作业。
有关更多详细信息,请参阅文档
Hazelcast has a distributed executor framework which you can use to run jobs using the JDK Executor framework (which, by the way, is possibly more testable than horrid Quartz... maybe). It has a number of modes of operation, including having it pick a single node "at random" to execute your job on.
See the documentation for more details