MongoDB:Atlas 与 Mongo Tools 的连接问题

问题描述 投票:0回答:2

嘿,我正在学习如何使用 shell 命令来使用 Mongodb Atlas。

我可以通过 Mongo Shell 成功连接到我的 Atlas 集群。不幸的是我无法使用 Mongo Tools(mongoimport、mongoexport、mongostat)来做到这一点。

如果我执行这个命令:

mongostat --uri mongodb+srv://m001-student:m#####s@sandbox.####.###.mongodb.net

我收到:

error parsing command line options: error parsing uri: 
lookup sandbox.#####.mongodb.net on 127.0.0.53:53: cannot unmarshal DNS message

对于其他命令,同样的问题也会重复出现。我不知道这是否重要,但我在uni网络上使用Ubuntu 18.04。

我尝试寻找任何解决方案,但找不到任何有用的东西。按照here的建议更改resolv.conf除了切断我的网络连接之外没有实现任何目标:P

有人有什么想法吗?

mongodb ubuntu-18.04 mongodb-atlas
2个回答
0
投票

这更像是一种解决方法,而不是真正的答案,但我的解决方案是不使用 Atlas 网站提供的命令行工具,也不使用 srv 连接。

mongostat --host "sandbox-shard-####.gcp.mongodb.net:27017,
sandbox-shard-####.gcp.mongodb.net:27017,
sandbox-shard-#####.gcp.mongodb.net:27017" 
--authenticationDatabase admin --ssl --username ##### --password #####

为我工作。


0
投票

我也有同样的问题;解决方法是删除 +srv。

© www.soinside.com 2019 - 2024. All rights reserved.