簡體   English   中英

MongoRestore 給我系統找不到文件

[英]MongoRestore is giving me the system cannot find the file

我正在嘗試將我的本地 mongodb 數據導出到 atlas 集群,並且我創建了一個轉儲,現在我正在使用該命令,

mongorestore --host Cluster0-shard-0/cluster0-shard-00-00-qwo7v.mongodb.net:27017,cluster0-shard-00-01-qwo7v.mongodb.net:27017,cluster0-shard-00-02-qwo7v.mongodb.net:27017 --ssl --username username --password <PASSWORD> --authenticationDatabase admin

嘗試恢復它,但讓我系統找不到指定的文件。 但是如果我輸入 mongorestore 那么它就可以工作,但它不會恢復到 atlas 雲服務器。 我究竟做錯了什么?

編輯:我使用的路徑是 C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\dump\\gfg 和 dump\\gfg 但它仍然無法正常工作。

MongoRestore.exe 的用法可以在這里找到。

獨立的 MongoDB

使用mongorestore時,需要提供需要恢復的文件/轉儲的位置

mongorestore --host=mongodb1.example.net --port=27017 --username=user --authenticationDatabase=admin /opt/backup/mongodump-2011-10-24

命令的最后一部分丟失了,它定義了需要恢復的數據的位置。

副本集

要在副本上恢復 MongoDB,您必須停止 mongod 並替換 mongodb 的文件。 請閱讀此處以在副本集上恢復數據庫。

對於從獨立恢復到副本,

mongorestore --host myReplSet/mongo0.example.com:27020,mongo1.example.com:27012 --db <dbname> <folder_location>

如果這仍然不起作用,請檢查路徑並確保其正確轉義(名稱中的空格)或引用。

帶引號和路徑的代碼:

mongorestore --host Cluster0-shard-0/cluster0-shard-00-00-qwo7v.mongodb.net:27017,cluster0-shard-00-01-qwo7v.mongodb.net:27017,cluster0-shard-00-02-qwo7v.mongodb.net:27017 --ssl --username username --password <PASSWORD> --authenticationDatabase admin "C:\Program Files\MongoDB\Server\4.2\bin\dump\gfg"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM