[mongo@redhatB tf]$ mongodump -h 127.0.0.1 -d skytf -o skytf.dmpconnected to: 127.0.0.1 Sat Nov 1717:11:19 DATABASE: skytf to skytf.dmp/skytf Sat Nov 1717:11:19 skytf.test_1 to skytf.dmp/skytf/test_1.bson Sat Nov 1717:11:19 doing snapshot query Sat Nov 1717:11:191 objects Sat Nov 1717:11:19 Metadata for skytf.test_1 to skytf.dmp/skytf/test_1.metadata.json Sat Nov 1717:11:19 skytf.things to skytf.dmp/skytf/things.bson Sat Nov 1717:11:19 doing snapshot query Sat Nov 1717:11:1930 objects Sat Nov 1717:11:19 Metadata for skytf.things to skytf.dmp/skytf/things.metadata.json Sat Nov 1717:11:19 skytf.things_1 to skytf.dmp/skytf/things_1.bson Sat Nov 1717:11:19 doing snapshot query Sat Nov 1717:11:1930 objects Sat Nov 1717:11:19 Metadata for skytf.things_1 to skytf.dmp/skytf/things_1.metadata.json Sat Nov 1717:11:19 skytf.test_2 to skytf.dmp/skytf/test_2.bson Sat Nov 1717:11:19 doing snapshot query Sat Nov 1717:11:194 objects Sat Nov 1717:11:19 Metadata for skytf.test_2 to skytf.dmp/skytf/test_2.metadata.json
[mongo@redhatB tf]$ mongodump -h 127.0.0.1 -d skytf -c things -o things.dmp connected to: 127.0.0.1 Sat Nov 1717:12:20 DATABASE: skytf to things.dmp/skytf Sat Nov 1717:12:20 skytf.things to things.dmp/skytf/things.bson Sat Nov 1717:12:20 doing snapshot query Sat Nov 1717:12:2030 objects Sat Nov 1717:12:20 Metadata for skytf.things to things.dmp/skytf/things.metadata.json
[mongo@redhatB tf]$ mongodump -h 127.0.0.1 -o all.dmp connected to: 127.0.0.1 Sat Nov 1717:17:04 all dbs Sat Nov 1717:17:04 DATABASE: skytf to all.dmp/skytf Sat Nov 1717:17:04 skytf.test_1 to all.dmp/skytf/test_1.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:041 objects Sat Nov 1717:17:04 Metadata for skytf.test_1 to all.dmp/skytf/test_1.metadata.json Sat Nov 1717:17:04 skytf.things to all.dmp/skytf/things.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:0430 objects Sat Nov 1717:17:04 Metadata for skytf.things to all.dmp/skytf/things.metadata.json Sat Nov 1717:17:04 skytf.things_1 to all.dmp/skytf/things_1.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:0430 objects Sat Nov 1717:17:04 Metadata for skytf.things_1 to all.dmp/skytf/things_1.metadata.json Sat Nov 1717:17:04 skytf.test_2 to all.dmp/skytf/test_2.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:044 objects Sat Nov 1717:17:04 Metadata for skytf.test_2 to all.dmp/skytf/test_2.metadata.json Sat Nov 1717:17:04 DATABASE: test to all.dmp/test Sat Nov 1717:17:04 test.test_2 to all.dmp/test/test_2.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:044 objects Sat Nov 1717:17:04 Metadata for test.test_2 to all.dmp/test/test_2.metadata.json Sat Nov 1717:17:04 test.things to all.dmp/test/things.bson Sat Nov 1717:17:04 doing snapshot query Sat Nov 1717:17:0430 objects Sat Nov 1717:17:04 Metadata for test.things to all.dmp/test/things.metadata.json
备注:mongodump 如果不指定 -d 参数,刚会备份整个 MongoDB 实例。
3.1 查看目录
[mongo@redhatB tf]$ ll all.dmp/
total 8.0K
drwxrwxr-x. 2 mongo mongo 4.0K Nov 17 17:17 skytf
drwxrwxr-x. 2 mongo mongo 4.0K Nov 17 17:17 test