标签:roo json 权限 com building dump info tin site
1、查看test数据库数据[root@ops-site mongodb_backup]# mongodump -h 10.3.152.78 -u test2 -p abc123 -d test -o .
2019-07-16T23:09:17.902+0800 writing test.runoob to test/runoob.bson
2019-07-16T23:09:17.912+0800 writing test.system.indexes to test/system.indexes.bson
2019-07-16T23:09:17.917+0800 writing test.runoob metadata to test/runoob.metadata.json
2019-07-16T23:09:17.918+0800 done dumping test.runoob (1 document)
[root@ops-site ~]# mongorestore -h 10.3.152.78 -u test2 -p "abc123" -d test /app/backup/mongodb_backup/test/
2019-07-16T23:16:09.928+0800 building a list of collections to restore from /app/backup/mongodb_backup/test/ dir
2019-07-16T23:16:09.938+0800 reading metadata file from /app/backup/mongodb_backup/test/runoob.metadata.json
2019-07-16T23:16:09.938+0800 restoring test.runoob from file /app/backup/mongodb_backup/test/runoob.bson
2019-07-16T23:16:11.055+0800 restoring indexes for collection test.runoob from metadata
2019-07-16T23:16:11.056+0800 finished restoring test.runoob (1 document)
2019-07-16T23:16:11.056+0800 done
备注:
mongorestore: 还原的命令
-h: 需还原的主机
-u:还原该数据库的用户,必须要对该test数据库有读写的权限才行
-p:用户的密码
-d:需要还原的数据库
/app/backup/mongodb_backup/test/:备份位置所在路径
标签:roo json 权限 com building dump info tin site
原文地址:https://blog.51cto.com/12965094/2420874