我试图 mongodump 我的数据库:
sudo mongodump -v --dbpath /var/lib/mongodb --out ~/backups/mongodb_dump/
但是每个集合都有有趣的输出(很冗长),有一些有趣的行:
Tue Dec 3 06:32:32 [tools] query my_db.my_collection nreturned:101 reslen:43408 0ms
Tue Dec 3 06:32:32 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:8565 reslen:4194597 77ms
Tue Dec 3 06:32:32 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:8053 reslen:4194704 75ms
Tue Dec 3 06:32:32 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:7936 reslen:4194704 82ms
Tue Dec 3 06:32:32 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:7932 reslen:4194524 83ms
Tue Dec 3 06:32:32 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:9201 reslen:4194491 201ms
Tue Dec 3 06:32:33 [tools] getmore my_db.my_collection cursorid:7364310293552401077 nreturned:7253 reslen:3078796 544ms
49041 objects
Tue Dec 3 06:32:33 [tools] skipping collection: my_db.my_collection.$_id_
flickr-app-development-production.download_stats to /home/user/backups/mongodb_dump/my_db/my_collection.bson
这是什么意思:skipping collection: my_db.my_collection.$_id_
,为什么是id字段?这是否意味着某些数据没有被转储,或者备份中没有 ID(所以在恢复数据库时,将分配新的 ID?)
奇怪的是mongo show dbs
返回的大小my_db
约为 1Gb,但.bson
文件的整体大小只有 150Mb?