java Spring Batch - 集群环境 - 故障转移机制

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15676521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 20:28:28  来源:igfitidea点击:

Spring Batch - Clustered Environment - Failover mechanism

javaspringftpspring-batchfailover

提问by Sunil

Question: What is the failover strategy that spring batch supports best? Resource usage, failover mechanism have to be focussed on. Any suggestions?

问:spring batch支持最好的failover策略是什么?必须关注资源使用、故障转移机制。有什么建议?

Usecase - Spring batch has to be run to read a file(that will be put on the server by another application) from the server and process it.

用例 - 必须运行 Spring 批处理才能从服务器读取文件(将由另一个应用程序放在服务器上)并对其进行处理。

Environment is clustered. So, there could be multiple server instances that could trigger the batch jobs trying to read the same file on arrival.

环境是集群的。因此,可能有多个服务器实例可以触发批处理作业,尝试在到达时读取相同的文件。

My thoughts: Polling can be done to check the arrival of the file and call the spring batch job. Since it is clustered, we could use active/passive strategy to poll. The other types such as roundrobin or time slicing can also be used.

我的想法:可以通过轮询来检查文件到达并调用spring批处理作业。由于它是集群的,我们可以使用主动/被动策略进行轮询。也可以使用其他类型,例如轮询或时间切片。

Pardon me if I am not clear. I can explain if something is unclear.

如果我不清楚,请原谅我。如果有什么不清楚的,我可以解释。

采纳答案by cornel rebegea

As I understand from here

正如我从这里了解到的

http://static.springsource.org/spring-batch/reference/html/scalability.html

http://static.springsource.org/spring-batch/reference/html/scalability.html

the better approach would be to have just one poller and than distribute the job to the cluster through one of the mechanisms provided by spring Batch (I think the one named Remote Chunks is the best choice here).

更好的方法是只有一个轮询器,而不是通过 spring Batch 提供的一种机制将作业分发到集群(我认为名为 Remote Chunks 的机制是这里的最佳选择)。

I don't think you should worry about the clustering strategy as this is handled either by Spring Batch or by other clustering distribution mechanisms.

我认为您不必担心集群策略,因为这是由 Spring Batch 或其他集群分发机制处理的。