首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用Mongo Shell连接到MongoDB地图集集群

无法使用Mongo Shell连接到MongoDB地图集集群
EN

Stack Overflow用户
提问于 2017-11-21 01:07:42
回答 6查看 11K关注 0票数 19

我在MongoDB地图集上设置了一个集群,并将自己设置为管理员,但我在从shell连接到集群时遇到了问题。在Atlas上,我单击了connect按钮,单击了connect with Mongo Shell,下载了最新的Mongo Shell,并复制了连接到集群的命令:

代码语言:javascript
复制
mongo "mongodb://testcluster-shard-00-00-acqhf.mongodb.net:27017,testcluster-shard-00-01-acqhf.mongodb.net:27017,testcluster-shard-00-02-acqhf.mongodb.net:27017/test?replicaSet=TestCluster-shard-0" --authenticationDatabase admin --ssl --username <USERNAME> --password <PASSWORD>

当我运行这个命令时,我得到了流:

代码语言:javascript
复制
MongoDB shell version v3.4.10
connecting to: mongodb://testcluster-shard-00-00-
acqhf.mongodb.net:27017,testcluster-shard-00-01-
acqhf.mongodb.net:27017,testcluster-shard-00-02-
acqhf.mongodb.net:27017/test?replicaSet=TestCluster-shard-0
2017-11-20T11:58:31.883-0500 I NETWORK  [thread1] Starting new replica set monitor for TestCluster-shard-0/testcluster-shard-00-00-
acqhf.mongodb.net:27017,testcluster-shard-00-01-
acqhf.mongodb.net:27017,testcluster-shard-00-02-acqhf.mongodb.net:27017
2017-11-20T11:58:32.119-0500 I NETWORK  [thread1] Successfully connected to testcluster-shard-00-01-acqhf.mongodb.net:27017 (1 connections now open to testcluster-shard-00-01-acqhf.mongodb.net:27017 with a 5 second timeout)
2017-11-20T11:58:32.131-0500 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to testcluster-shard-00-00-acqhf.mongodb.net:27017 (1 connections now open to testcluster-shard-00-00-acqhf.mongodb.net:27017 with a 5 second timeout)
MongoDB server version: 3.4.10
2017-11-20T11:58:32.407-0500 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to testcluster-shard-00-02-acqhf.mongodb.net:27017 (1 connections now open to testcluster-shard-00-02-acqhf.mongodb.net:27017 with a 5 second timeout)
2017-11-20T11:58:32.497-0500 I NETWORK  [thread1] Marking host testcluster-shard-00-01-acqhf.mongodb.net:27017 as failed :: caused by :: Location8000: can't authenticate against replica set node testcluster-shard-00-01-acqhf.mongodb.net:27017: bad auth Authentication failed.
2017-11-20T11:58:32.639-0500 I NETWORK  [thread1] Successfully connected to testcluster-shard-00-02-acqhf.mongodb.net:27017 (1 connections now open to testcluster-shard-00-02-acqhf.mongodb.net:27017 with a 0 second timeout)
2017-11-20T11:58:32.756-0500 I NETWORK  [thread1] Marking host testcluster-shard-00-02-acqhf.mongodb.net:27017 as failed :: caused by :: Location8000: can't authenticate against replica set node testcluster-shard-00-02-acqhf.mongodb.net:27017: bad auth Authentication failed.
2017-11-20T11:58:32.899-0500 I NETWORK  [thread1] Successfully connected to testcluster-shard-00-00-acqhf.mongodb.net:27017 (1 connections now open to testcluster-shard-00-00-acqhf.mongodb.net:27017 with a 0 second timeout)
2017-11-20T11:58:32.995-0500 I NETWORK  [thread1] Marking host testcluster-shard-00-00-acqhf.mongodb.net:27017 as failed :: caused by :: Location8000: can't authenticate against replica set node testcluster-shard-00-00-acqhf.mongodb.net:27017: bad auth Authentication failed.
2017-11-20T11:58:33.100-0500 I NETWORK  [thread1] Marking host testcluster-shard-00-01-acqhf.mongodb.net:27017 as failed :: caused by :: Location8000: can't authenticate against replica set node testcluster-shard-00-01-acqhf.mongodb.net:27017: bad auth Authentication failed.
2017-11-20T11:58:33.101-0500 E QUERY    [thread1] Error: can't authenticate against replica set node testcluster-shard-00-01-acqhf.mongodb.net:27017: bad auth Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1461:20
@(auth):6:1
@(auth):1:2
exception: login failed

我将和替换为我的用户名和密码,但我仍然无法连接。我需要在后台运行mongod吗?如果没有,我需要做什么才能成功连接?谢谢。

EN

回答 6

Stack Overflow用户

发布于 2017-11-21 02:01:36

我必须使用不同的用户名和密码创建一个新用户,当我使用这些新凭据运行命令时,我可以连接。

票数 20
EN

Stack Overflow用户

发布于 2018-08-09 14:58:09

我的问题是,我最近才在Atlas UI中设置/更改了密码-他们需要一分钟左右的时间来部署任何更改,甚至重置密码等。我可以在等待部署更改后登录

票数 3
EN

Stack Overflow用户

发布于 2019-09-25 21:29:02

和别人一样,不喜欢我的pw。从命令行运行得很好,但从Compass就不行了。检查故障排除页面https://docs.atlas.mongodb.com/troubleshoot-connection/#special-characters-in-connection-string-password。我的pw中有一些特殊的字符。我试着摆脱它们,然后返回并将我的密码重置为没有特殊字符的简单密码-花了一分钟时间,但后来我很容易连接上。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47397394

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档