简体   繁体   中英

Error: can't connect to new replica set master

I have been trying to connect my node js application to mongo db atlas but i keep getting this error

`MongoDB shell version v4.2.5
connecting to: mongodb://cluster0-shard-00-02-kmhdr.mongodb.net:27017,cluster0-shard-00-00-kmhdr.mongodb.net:27017,cluster0-shard-00-01-kmhdr.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2020-04-12T18:35:54.356-0700 I  NETWORK  [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-02-kmhdr.mongodb.net:27017,cluster0-shard-00-00-kmhdr.mongodb.net:27017,cluster0-shard-00-01-kmhdr.mongodb.net:27017
2020-04-12T18:35:54.358-0700 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-02-kmhdr.mongodb.net:27017
2020-04-12T18:35:54.359-0700 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-kmhdr.mongodb.net:27017
2020-04-12T18:35:54.359-0700 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-00-kmhdr.mongodb.net:27017
2020-04-12T18:35:56.232-0700 I  NETWORK  [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Cluster0-shard-0 is Cluster0-shard-0/cluster0-shard-00-00-kmhdr.mongodb.net:27017,cluster0-shard-00-01-kmhdr.mongodb.net:27017,cluster0-shard-00-02-kmhdr.mongodb.net:27017
2020-04-12T18:35:58.988-0700 I  NETWORK  [js] Marking host cluster0-shard-00-02-kmhdr.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-02-kmhdr.mongodb.net:27017], err: AuthenticationFailed: bad auth Authentication failed.


*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.


2020-04-12T18:35:58.991-0700 E  QUERY    [js] Error: can't connect to new replica set master [cluster0-shard-00-02-kmhdr.mongodb.net:27017], err: AuthenticationFailed: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-04-12T18:35:59.025-0700 F  -        [main] exception: connect failed
2020-04-12T18:35:59.026-0700 E  -        [main] exiting with code 1

Please help me resolve this issue. Thanks

I had similar issue.

That's how i solved this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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