有没有什么快速的方法导出 mongodb 的数据?

2015-11-29 18:18:24 +08:00
 pancts

用自带的工具导出 json 或者 csv 都太慢了

cpu 和内存都没怎么变化两天才导出 30g 数据

大概需要导出五千万条,请问有什么办法么

4702 次点击
所在节点    MongoDB
8 条回复
fractal314
2015-11-29 19:56:08 +08:00
多找几台机子,自己写个脚本试试呢?
matthewz
2015-11-29 20:46:08 +08:00
Unfortunately, It's a feature of MongoDB

copy the files in your database directory itself (default /data/db) rather than using mongodump/mongoresotre. If you can shut down your database for periods of time, this is best. Otherwise, you have to use file system snapshots or similar. See this for more the official mongo blurb: http://docs.mongodb.org/manual/core/backups/
TJT
2015-11-29 21:17:25 +08:00
多进程和分布式
zzlyzq
2015-11-30 00:16:52 +08:00
如果是 replica set 模式,可以搞出来一个 secondary 然后移花接木
pancts
2015-11-30 11:03:36 +08:00
@TJT 单线程都会溢出。。可能是翻页的问题 还需要优化
pancts
2015-11-30 11:04:25 +08:00
@fractal314 分布式嘛。。资金短缺。。
pancts
2015-11-30 11:04:55 +08:00
pancts
2015-11-30 11:05:08 +08:00
@zzlyzq 目前只有这个办法了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/239833

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX