简体   繁体   English

失败:mongorestore 目标“转储”无效:统计转储:没有这样的文件或目录

[英]Failed: mongorestore target 'dump' invalid: stat dump: no such file or directory

I'm trying to mongorestore a mongodump-ed set of.bson files to a mongo database that lives within docker, on an Ubuntu instance to which I have SSH access only.我正在尝试将 mongodump 的 .bson 文件集存储到位于 docker 内的 mongo 数据库中,在 Ubuntu 实例上,我只能访问该实例。

I have a "db" folder, and within that I ran the "mongorestore" command which created the following structure:我有一个“db”文件夹,在其中我运行了“mongorestore”命令,该命令创建了以下结构:

├── db
│   ├── dump
│   │   └── <dump-name>

I now want to run the following command from the db directory:我现在想从 db 目录运行以下命令:

docker exec -it mongo_db_container mongorestore -d collection_name dump

but I am getting the following error:但我收到以下错误:

Failed: mongorestore target 'dump' invalid: stat dump: no such file or directory

I can "ls" and see that the folder and that structure exists, and that the.bson files live within the leaf-level folder.我可以“ls”并看到该文件夹和该结构存在,并且 .bson 文件位于叶级文件夹中。 I've run the same set of commands locally on my Windows machine, and all worked correctly.我在我的 Windows 机器上本地运行了相同的命令集,并且一切正常。 Is it possible it's some kind of permissions issue in Ubuntu?是否可能是 Ubuntu 中的某种权限问题? I've "sudo"-ed the command, but same issue.我已经“sudo”-ed 命令,但同样的问题。

Thanks for any help you can provide!感谢您的任何帮助,您可以提供!

Try following steps to debug further. 请尝试按照以下步骤进行进一步调试。

#>docker exec -it mongo_db_container sh

Once you have a terminal inside the container then try executing the command 在容器中拥有终端之后,请尝试执行命令

$>mongorestore -d collection_name dump

Let me know and see, if directories are in well structure here inside container and current user has permission to execute & write content on that directory. 让我知道,看看目录是否在容器内的结构正确,并且当前用户有权在该目录上执行和写入内容。

mongorestore mongodb://user:password@127.0.0.1:27017/ dump/ mongorestore mongodb://user:password@127.0.0.1:27017/dump/

Folder structure should be文件夹结构应该是

/dump/<databasename>
    <file>.json
    <file>.bson

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM