简体   繁体   English

使用 spring boot 将大量数据从一个集合复制到 Mongodb 中的另一个集合

[英]Copy of huge data from one collection to another collection in Mongodb using spring boot

We are writing a scheduler to take backup of data from one collection to another collection in Mongodb using spring boot.我们正在编写一个调度程序,以使用 Spring Boot 将数据从一个集合备份到 Mongodb 中的另一个集合。 The data can be 500K to 1Million docs.数据可以是 500K 到 100 万个文档。 Once the copy was completed we should delete the data from old collection.复制完成后,我们应该从旧集合中删除数据。 Currently we are using spring data pagination to get the chunks of data and saving to new collection and then deleting.目前我们正在使用 spring 数据分页来获取数据块并保存到新集合然后删除。

Is this approach fine or any optimistic approach is suggestible.这种方法是否可行,或者任何乐观的方法都值得推荐。

As you using spring data with pagination for this task, it means you utilizing container for process documents.当您为此任务使用带有分页的 spring 数据时,这意味着您将容器用于流程文档。

You can trigger set of system command(mongo export and after import delete data from source) from scheduler.您可以从调度程序触发一组系统命令(mongo 导出和导入后从源中删除数据)。

Example like..例如..

SystemCommandTasklet tasklet = new SystemCommandTasklet(); SystemCommandTasklet tasklet = new SystemCommandTasklet();

tasklet.setCommand(""); tasklet.setCommand("");
tasklet.setWorkingDirectory("/home/merlin"); tasklet.setWorkingDirectory("/home/merlin");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据从一个集合复制到另一个集合 - MongoDB - Copy data from one collection into another - MongoDB 如何将数据从一个集合复制到 MongoDB 中的另一个现有集合 - How to copy data from one collection to another existing collection in MongoDB Spring Data / MongoDB:一次性将一个文档从一个集合复制到另一个 - Spring Data / MongoDB: Copy a single document from one collection to another in one go 在spring boot中使用mongodb从两个集合中获取数据 - Get data from two collection using mongodb in spring boot 如何将一个MongoDB的集合复制到另一个? - How to copy a collection from one mongodb to another? 将一个集合中除一个之外的所有列数据复制到 mongodb 中的另一个集合中 - Copy all the column data of a collection except one into another collection in mongodb 如何使用 jensegers 将数据从一个 MongoDB 集合复制到另一个集合 - How can I copy data from one MongoDB collection to another using jenssegers 如何使用 pymongo 从 MongoDB 复制一个集合并粘贴到另一个空集合? - How can I copy one collection from MongoDB using pymongo and paste to another empty collection? 从一个mongodb集合中提取数据到另一个 - pulling data from one mongodb collection into another 从一个集合访问数据到另一个 MongoDB - Access data from one collection to another MongoDB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM