Location40657: Last known master host cannot be reached

Hi ,

I have created my cluster and able to connect but while trying to load data set getting below error . can you please help on this?

PS C:\Users\harsh\M001\loadMovieDetailsDataset> dir

Directory: C:\Users\harsh\M001\loadMovieDetailsDataset

Mode LastWriteTime Length Name


-a---- 01-01-2020 00:00 1381666 loadMovieDetailsDataset.js

PS C:\Users\harsh\M001\loadMovieDetailsDataset> mongo “mongodb+srv://sandbox-5evyi.mongodb.net/test” --username m001-student
MongoDB shell version v4.2.6
Enter password:
connecting to: mongodb://sandbox-shard-00-01-5evyi.mongodb.net:27017,sandbox-shard-00-02-5evyi.mongodb.net:27017,sandbox-shard-00-00-5evyi.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Sandbox-shard-0&ssl=true
2020-05-17T14:39:14.986+0530 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-01-5evyi.mongodb.net:27017,sandbox-shard-00-02-5evyi.mongodb.net:27017,sandbox-shard-00-00-5evyi.mongodb.net:27017
2020-05-17T14:39:14.986+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-01-5evyi.mongodb.net:27017
2020-05-17T14:39:14.987+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-00-5evyi.mongodb.net:27017
2020-05-17T14:39:14.987+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-02-5evyi.mongodb.net:27017
2020-05-17T14:39:15.728+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Sandbox-shard-0 is Sandbox-shard-0/sandbox-shard-00-00-5evyi.mongodb.net:27017,sandbox-shard-00-01-5evyi.mongodb.net:27017,sandbox-shard-00-02-5evyi.mongodb.net:27017
Implicit session: session { “id” : UUID(“5bb51df7-60ca-4106-9b23-d7c175068718”) }
MongoDB server version: 4.2.6
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise Sandbox-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
2020-05-17T14:39:47.275+0530 I NETWORK [js] DBClientConnection failed to receive message from sandbox-shard-00-01-5evyi.mongodb.net:27017 - HostUnreachable: Connection closed by peer
2020-05-17T14:39:47.275+0530 E QUERY [js] uncaught exception: Error: error doing query: failed: network error while attempting to run command ‘drop’ on host ‘sandbox-shard-00-01-5evyi.mongodb.net:27017’ :
DB.prototype.runCommand@src/mongo/shell/db.js:169:19
DBCollection.prototype.drop@src/mongo/shell/collection.js:692:11
@loadMovieDetailsDataset.js:2:1
@(shell):1:1
2020-05-17T14:39:47.275+0530 E QUERY [js] Error: error loading js file: loadMovieDetailsDataset.js :
@(shell):1:1
2020-05-17T14:39:47.276+0530 I NETWORK [js] Marking host sandbox-shard-00-01-5evyi.mongodb.net:27017 as failed :: caused by :: Location40657: Last known master host cannot be reached

Thanks,
Shreeharsha

May be your session was inactive for too long and expired
Please exit and try to connect again and then load

Hi Ramachandra,

i have tried that also from 2 days same issue…i deleted the cluster and created new tried but error is still same. not sure where i am missing…

Thanks,
Shreeharsha

Please provide the URI of your new cluster so that we can test.

Hi Steevej,

Thanks… Please find below information

mongo “mongodb+srv://test-5evyi.mongodb.net/test” --username shree

password : harsha

I can connect to above cluster without any issues
What error you are getting now with new test cluster you created
Did you try to pass the --password in the connect string

Same as @Ramachandra_37567, I was able to connect with both mongo shell and Compass.

i am able to connect but the issue is coming while load a database…

PS C:\Users\harsh\M001\loadMovieDetailsDataset> dir

Directory: C:\Users\harsh\M001\loadMovieDetailsDataset

Mode LastWriteTime Length Name


-a---- 01-01-2020 00:00 1381666 loadMovieDetailsDataset.js

PS C:\Users\harsh\M001\loadMovieDetailsDataset> mongo “mongodb+srv://test-5evyi.mongodb.net/test” --username shree --password harsha
MongoDB shell version v4.2.6
connecting to: mongodb://test-shard-00-02-5evyi.mongodb.net:27017,test-shard-00-00-5evyi.mongodb.net:27017,test-shard-00-01-5evyi.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=test-shard-0&ssl=true
2020-05-17T19:51:03.868+0530 I NETWORK [js] Starting new replica set monitor for test-shard-0/test-shard-00-02-5evyi.mongodb.net:27017,test-shard-00-00-5evyi.mongodb.net:27017,test-shard-00-01-5evyi.mongodb.net:27017
2020-05-17T19:51:03.875+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-01-5evyi.mongodb.net:27017
2020-05-17T19:51:03.876+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-02-5evyi.mongodb.net:27017
2020-05-17T19:51:03.878+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-00-5evyi.mongodb.net:27017
2020-05-17T19:51:06.027+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for test-shard-0 is test-shard-0/test-shard-00-00-5evyi.mongodb.net:27017,test-shard-00-01-5evyi.mongodb.net:27017,test-shard-00-02-5evyi.mongodb.net:27017
Implicit session: session { “id” : UUID(“058d869e-1bc9-4235-b4f9-c7e3079ea650”) }
MongoDB server version: 4.2.6
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise test-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
2020-05-17T19:51:21.850+0530 I NETWORK [js] DBClientConnection failed to receive message from test-shard-00-02-5evyi.mongodb.net:27017 - HostUnreachable: Connection closed by peer
2020-05-17T19:51:21.851+0530 E QUERY [js] uncaught exception: Error: error doing query: failed: network error while attempting to run command ‘drop’ on host ‘test-shard-00-02-5evyi.mongodb.net:27017’ :
DB.prototype.runCommand@src/mongo/shell/db.js:169:19
DBCollection.prototype.drop@src/mongo/shell/collection.js:692:11
@loadMovieDetailsDataset.js:2:1
@(shell):1:1
2020-05-17T19:51:21.853+0530 E QUERY [js] Error: error loading js file: loadMovieDetailsDataset.js :
@(shell):1:1
2020-05-17T19:51:21.860+0530 I NETWORK [js] Marking host test-shard-00-02-5evyi.mongodb.net:27017 as failed :: caused by :: Location40657: Last known master host cannot be reached
2020-05-17T19:51:21.870+0530 I CONNPOOL [js] dropping unhealthy pooled connection to test-shard-00-02-5evyi.mongodb.net:27017
2020-05-17T19:51:21.873+0530 I CONNPOOL [js] dropping unhealthy pooled connection to test-shard-00-01-5evyi.mongodb.net:27017
2020-05-17T19:51:21.875+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-02-5evyi.mongodb.net:27017
2020-05-17T19:51:21.876+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-01-5evyi.mongodb.net:27017
2020-05-17T19:51:21.877+0530 I CONNPOOL [js] dropping unhealthy pooled connection to test-shard-00-00-5evyi.mongodb.net:27017
2020-05-17T19:51:21.878+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to test-shard-00-00-5evyi.mongodb.net:27017

I suspect you have a very slow network. Is there any way you can do that from another location?

Can you share the first few lines loadMovieDetailsDataset.js? May be the file is corrupted.

Sure Steeve…

Please find the below information on that load file

db = db.getSiblingDB(“video”);
db.movieDetails.drop();
db.movieDetails.insertMany([
{“title”:“Once Upon a Time in the West”,“year”:1968,“rated”:“PG-13”,“runtime”:175,“countries”:[“Italy”,“USA”,“Spain”],“genres”:[“Western”],“director”:“Sergio Leone”,“writers”:[“Sergio Donati”,“Sergio Leone”,“Dario Argento”,“Bernardo Bertolucci”,“Sergio Leone”],“actors”:[“Claudia Cardinale”,“Henry Fonda”,“Jason Robards”,“Charles Bronson”],“plot”:“Epic story of a mysterious stranger with a harmonica who joins forces with a notorious desperado to protect a beautiful widow from a ruthless assassin working for the railroad.”,“poster”:“http://ia.media-imdb.com/images/M/MV5BMTEyODQzNDkzNjVeQTJeQWpwZ15BbWU4MDgyODk1NDEx._V1_SX300.jpg",“imdb”:{“id”:“tt0064116”,“rating”:8.6,“votes”:201283},“tomato”:{“meter”:98,“image”:“certified”,“rating”:9,“reviews”:54,“fresh”:53,“consensus”:"A landmark Sergio Leone spaghetti western masterpiece featuring a classic Morricone score.”,“userMeter”:95,“userRating”:4.3,“userReviews”:64006},“metacritic”:80,“awards”:{“wins”:4,“nominations”:5,“text”:“4 wins \u0026 5 nominations.”},“type”:“movie”},

Hi @Shree_Harsha,

As @steevej-1495 mentioned, It looks like a network issue to me as well.

Is it possible for you to connect using any other network ?

~ Shubham