我开发了一个应用程序,我们必须从一个大表中处理超过500万条记录 . 我们使用了spring批量远程分区,它工作正常 .
我现在必须使用相同的工作并调整它来为多个表创建分区 . 每个分区都有表名和最小和最大记录,因此slave知道从哪个表读取数据和准备文件 .
我的问题是,如果是的话可以做到这一点然后在github那里有任何样本 .
谢谢
是的,这可以做到 . 您需要实现自己的 Partitioner 来处理为每个表/行范围创建 ExecutionContexts 的逻辑 .
Partitioner
ExecutionContexts
一对好的资源:
Partitioner 接口文档:http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/partition/support/Partitioner.html
Spring Batch的缩放和并行处理章节7.4节http://docs.spring.io/spring-batch/trunk/reference/html/scalability.html
我对Spring Batch视频的介绍涵盖了分区:https://www.youtube.com/watch?v=CYTj5YT7CZU和相关的Github存储库:https://github.com/mminella/Spring-Batch-Talk-2.0
1 回答
是的,这可以做到 . 您需要实现自己的
Partitioner
来处理为每个表/行范围创建ExecutionContexts
的逻辑 .一对好的资源:
Partitioner
接口文档:http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/partition/support/Partitioner.htmlSpring Batch的缩放和并行处理章节7.4节http://docs.spring.io/spring-batch/trunk/reference/html/scalability.html
我对Spring Batch视频的介绍涵盖了分区:https://www.youtube.com/watch?v=CYTj5YT7CZU和相关的Github存储库:https://github.com/mminella/Spring-Batch-Talk-2.0