MongoDB学习系列7: mongorestore

上一节我们已经取到了数据,这里讲如何使用mongorestore命令来导入数据。

语法:

./mongorestore -h 127.0.0.1:端口 -d 数据库实例名-c 集合名 --drop /usr/local/sbt/data/XXX/sharings.bson

参数不是固定的,根据自己需要,我这里只是导入一个集合。

执行过程如下:

Fri Dec 27 11:50:24.078 		Progress: 4507361930/5029730809	89%	(bytes)
Fri Dec 27 11:50:27.031 		Progress: 4534619731/5029730809	90%	(bytes)
Fri Dec 27 11:50:30.137 		Progress: 4560073891/5029730809	90%	(bytes)
Fri Dec 27 11:50:33.035 		Progress: 4585322288/5029730809	91%	(bytes)
Fri Dec 27 11:50:36.019 		Progress: 4619317204/5029730809	91%	(bytes)
Fri Dec 27 11:50:39.067 		Progress: 4656310092/5029730809	92%	(bytes)
Fri Dec 27 11:50:42.004 		Progress: 4690448084/5029730809	93%	(bytes)
Fri Dec 27 11:50:45.013 		Progress: 4724361478/5029730809	93%	(bytes)
Fri Dec 27 11:50:48.060 		Progress: 4757708700/5029730809	94%	(bytes)
Fri Dec 27 11:50:51.008 		Progress: 4790518328/5029730809	95%	(bytes)
Fri Dec 27 11:50:54.024 		Progress: 4823413018/5029730809	95%	(bytes)
Fri Dec 27 11:50:57.113 		Progress: 4851241050/5029730809	96%	(bytes)
Fri Dec 27 11:51:00.024 		Progress: 4873223916/5029730809	96%	(bytes)
Fri Dec 27 11:51:03.013 		Progress: 4895920524/5029730809	97%	(bytes)
Fri Dec 27 11:51:06.033 		Progress: 4916388796/5029730809	97%	(bytes)
Fri Dec 27 11:51:09.073 		Progress: 4950203745/5029730809	98%	(bytes)
Fri Dec 27 11:51:12.021 		Progress: 4981510693/5029730809	99%	(bytes)
Fri Dec 27 11:51:15.008 		Progress: 5014510813/5029730809	99%	(bytes)
14438822 objects found
Fri Dec 27 11:51:16.390 	Creating index: { key: { _id: 1 }, ns: "tuijian.sharings", name: "_id_" }
Fri Dec 27 11:51:16.824 	Creating index: { key: { Id: 1, on: 1, c@: 1 }, ns: "tuijian.sharings", name: "Id_1_on_1_c@_1" }
Fri Dec 27 11:53:55.346 	Creating index: { key: { cat: 1, pkg: 1 }, ns: "tuijian.sharings", name: "cat_1_pkg_1" }


网上很多教程 :http://blog.csdn.net/shirdrn/article/details/7105539



你可能感兴趣的:(mongodb,mongodb,mongorestore)