我正在尝试通过 docker 运行 mongorestore 以将数据库恢复到系统上的另一个 dockerized mongo:
sudo docker run --net=host -v $PWD:/home/mongo mongo /bin/bash -c "mongorestore -d venko /home/mongo/mongo_venko_20200326230306.archive"
Run Code Online (Sandbox Code Playgroud)
但我明白了
2020-03-27T00:17:32.645+0000 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
2020-03-27T00:17:32.645+0000 Failed: file /home/mongo/mongo_venko_20200326230306.archive does not have .bson extension
2020-03-27T00:17:32.645+0000 0 document(s) restored successfully. 0 document(s) failed to restore.
Run Code Online (Sandbox Code Playgroud)
来自mongorestore 错误的答案:不知道如何处理转储文件告诉我传递 -db 选项,但我确实通过了,所以我不知道该怎么做。
Con*_* DO 15
我必须使用--gzip和--archive这两个选项
mongorestore --uri="uri" --gzip --archive=/Path/to/archive/abc.gz
Run Code Online (Sandbox Code Playgroud)
小智 0
由于错误提到 mongorestore 查找 BSON 文件,而存档不是它正在查找的扩展名。
您可以执行以下操作:
要么使用:
mongorestore --gzip /home/mongo/mongo_venko_20200326230306.archive
或者,提取存档文件并使用:
mongorestore /home/mongo/mongo_venko_20200326230306/<文件名.bson>
| 归档时间: |
|
| 查看次数: |
3025 次 |
| 最近记录: |