MongoDB,在 .agz 文件上使用 mongorestore

MongoDB,在 .agz 文件上使用 mongorestore

我正在使用 MongoDB 3.6,但无法理解如何在 .agz 文件上使用 mongorestore。如果我指定以下内容,则会收到一条错误消息Failed: error connecting to db server: no reachable servers

mongorestore --gzip --archive=<filename>.agz --db test

当我使用下面的命令,指定实际的 mongod 实例时,我没有收到任何错误,并且实际上看到了状态preparing collections to restore from,但是在实际的 mongod 实例中我没有看到任何内容

mongorestore --gzip --archive=<filename>.agz --db test -u <username> -p <password> --authenticationDatabase 'admin' --port 27000 --host <hostname>

我应该做什么呢?

答案1

我解决了我的问题.....我上面列出的第二个命令(使用用户名和密码)有效,只是我输入了错误的db名字。

我认为它可以是db您想要的任何名称,并且它会在您要恢复到的新实例中创建它,但我意识到它db必须与您使用该mongodump命令的实例中的名称相匹配

相关内容