Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Email

4.3. mongorestore

直接从dump回复备份

[root@netkiller www]# ls
backup  dump

[root@netkiller www]# mongorestore dump/		
		
# mongorestore -h 127.0.0.1 -u neo -p chen /tmp/test/
connected to: 127.0.0.1
Tue Sep  8 10:18:31.360 /tmp/test/system.users.bson
Tue Sep  8 10:18:31.360 	going into namespace [test.system.users]
Tue Sep  8 10:18:31.361 warning: Restoring to test.system.users without dropping. Restored data will be inserted without raising errors; check your server log
2 objects found
Tue Sep  8 10:18:31.361 	Creating index: { key: { _id: 1 }, ns: "test.system.users", name: "_id_" }
Tue Sep  8 10:18:31.406 	Creating index: { key: { user: 1, userSource: 1 }, unique: true, ns: "test.system.users", name: "user_1_userSource_1" }
Tue Sep  8 10:18:31.406 /tmp/test/img.chunks.bson
Tue Sep  8 10:18:31.406 	going into namespace [test.img.chunks]
Tue Sep  8 10:18:31.407 warning: Restoring to test.img.chunks without dropping. Restored data will be inserted without raising errors; check your server log
4 objects found
Tue Sep  8 10:18:31.409 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.img.chunks" }
Tue Sep  8 10:18:31.409 	Creating index: { name: "files_id_1_n_1", key: { files_id: 1, n: 1 }, unique: true, ns: "test.img.chunks" }
Tue Sep  8 10:18:31.409 /tmp/test/fs.files.bson
Tue Sep  8 10:18:31.409 	going into namespace [test.fs.files]
Tue Sep  8 10:18:31.410 warning: Restoring to test.fs.files without dropping. Restored data will be inserted without raising errors; check your server log
2 objects found
Tue Sep  8 10:18:31.410 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.fs.files" }
Tue Sep  8 10:18:31.410 /tmp/test/images.chunks.bson
Tue Sep  8 10:18:31.410 	going into namespace [test.images.chunks]
Tue Sep  8 10:18:31.411 warning: Restoring to test.images.chunks without dropping. Restored data will be inserted without raising errors; check your server log
12 objects found
Tue Sep  8 10:18:31.414 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.images.chunks" }
Tue Sep  8 10:18:31.414 	Creating index: { name: "files_id_1_n_1", key: { files_id: 1, n: 1 }, unique: true, ns: "test.images.chunks" }
Tue Sep  8 10:18:31.414 /tmp/test/images.files.bson
Tue Sep  8 10:18:31.414 	going into namespace [test.images.files]
Tue Sep  8 10:18:31.414 warning: Restoring to test.images.files without dropping. Restored data will be inserted without raising errors; check your server log
3 objects found
Tue Sep  8 10:18:31.415 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.images.files" }
Tue Sep  8 10:18:31.415 /tmp/test/fs.chunks.bson
Tue Sep  8 10:18:31.415 	going into namespace [test.fs.chunks]
Tue Sep  8 10:18:31.415 warning: Restoring to test.fs.chunks without dropping. Restored data will be inserted without raising errors; check your server log
2 objects found
Tue Sep  8 10:18:31.416 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.fs.chunks" }
Tue Sep  8 10:18:31.416 	Creating index: { name: "files_id_1_n_1", key: { files_id: 1, n: 1 }, unique: true, ns: "test.fs.chunks" }
Tue Sep  8 10:18:31.416 /tmp/test/img.files.bson
Tue Sep  8 10:18:31.416 	going into namespace [test.img.files]
Tue Sep  8 10:18:31.417 warning: Restoring to test.img.files without dropping. Restored data will be inserted without raising errors; check your server log
1 objects found
Tue Sep  8 10:18:31.417 	Creating index: { name: "_id_", key: { _id: 1 }, ns: "test.img.files" }
Tue Sep  8 10:18:31.417 /tmp/test/bios.bson
Tue Sep  8 10:18:31.417 	going into namespace [test.bios]
Tue Sep  8 10:18:31.417 warning: Restoring to test.bios without dropping. Restored data will be inserted without raising errors; check your server log
1 objects found
Tue Sep  8 10:18:31.417 	Creating index: { key: { _id: 1 }, ns: "test.bios", name: "_id_" }
		

恢复到指定数据库

# mongorestore -h 127.0.0.1 -d test123 /tmp/test
		
comments powered by Disqus