mongorestore

 ##################################################################

 

一、版本对应:mongorestore版本要和mongodump版本一致,否则容易出问题:

 

 

mongorestore恢复某个数据库的所有集合:

/home/work/mongod/bin/mongorestore --authenticationDatabase admin --host 10.10.10.10 --port 28008 --username mongo_dba  --password 123456 --db gall   /home/work/mongodb/mongodb_backup/gall

 

 

 

mongorestore恢复某个集合数据:

/home/work/mongodb/3.6.17/bin/mongorestore --authenticationDatabase ai_open --host 10.10.10.10 --port 27017 --username apple --password 123456 

--db db_name --collection table_name ./bak/ai_open_caps/ai_caps_skill_info.bson

 

 

 恢复指定归档文件:

注意:--archive参数与文件名称之间要有=连接,用空格连接则会一直卡在那里:
注意:mongodump备份的时候,也需要加上参数--archive=filename
mongorestore  --authenticationDatabase admin   --host xxx --port  27001 --username root--password 123456 --archive=20210128_archive.bin 

 

 

 

 

 

 

 

 

 

##################################

posted @ 2020-10-22 16:38  igoodful  阅读(151)  评论(0编辑  收藏  举报