mongodump vs mongoexport:哪个更好?
mongodump vs mongoexport: which is better?
我想导出非常大的集合并将它们导入到另一台服务器的另一个数据库中。我发现至少有两种方法:mongoexport 和 mongodump.
我搜索了以前关于这个问题的帖子,但是我没有找到关于 speed 和 size[=18 的完整 comparison/benchmark =] 使用这两种方式导出文件!
如有经验分享,将不胜感激
正如最近提到的documentation
Avoid using mongoimport and mongoexport for full instance production backups. They do not reliably preserve all rich BSON data types, because JSON can only represent a subset of the types supported by BSON. Use mongodump and mongorestore as described in MongoDB Backup Methods for this kind of functionality.
由于需要恢复大数据,优先使用dump。
mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.
mongodump is a utility for creating a binary export of the contents of a database. mongodump can export data from either mongod or mongos instances; i.e. can export data from standalone, replica set, and sharded cluster deployments.
一个重要的区别是 mongodump 比 mongoexport 用于备份目的更快。 Mongodump 将数据存储为二进制文件,而 mongoexport 将数据存储为 JSON 或 CSV。
我想导出非常大的集合并将它们导入到另一台服务器的另一个数据库中。我发现至少有两种方法:mongoexport 和 mongodump.
我搜索了以前关于这个问题的帖子,但是我没有找到关于 speed 和 size[=18 的完整 comparison/benchmark =] 使用这两种方式导出文件! 如有经验分享,将不胜感激
正如最近提到的documentation
Avoid using mongoimport and mongoexport for full instance production backups. They do not reliably preserve all rich BSON data types, because JSON can only represent a subset of the types supported by BSON. Use mongodump and mongorestore as described in MongoDB Backup Methods for this kind of functionality.
由于需要恢复大数据,优先使用dump。
mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.
mongodump is a utility for creating a binary export of the contents of a database. mongodump can export data from either mongod or mongos instances; i.e. can export data from standalone, replica set, and sharded cluster deployments.
一个重要的区别是 mongodump 比 mongoexport 用于备份目的更快。 Mongodump 将数据存储为二进制文件,而 mongoexport 将数据存储为 JSON 或 CSV。