天天看點

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      

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