Mongoimport: Failed: error connecting to db server: no reachable servers

713 views
Skip to first unread message

antonio.b...@gmail.com

unread,
Feb 4, 2019, 5:56:59 PM2/4/19
to mongodb-user
Hello guys,

can you help me with this issue?
I am following the course M103.
In the last lab I would import a json file.
When I can try to run the command below:

mongoimport --host localhost:27000 --port 27000 --username m103-application-user --password m103-application-pass --db applicationData --collection products --file /dataset/products.json

I recieved this error:

2019-02-04T22:16:33.686+0000    [........................] applicationData.products     0B/87.9MB (0.0%)
2019-02-04T22:16:34.188+0000    [........................] applicationData.products     0B/87.9MB (0.0%)
2019-02-04T22:16:34.188+0000    Failed: error connecting to db server: no reachable servers
2019-02-04T22:16:34.188+0000    imported 0 documents


Can you help me?



Regards,
Antonio.

Oleg Toropov

unread,
Feb 4, 2019, 6:33:50 PM2/4/19
to mongod...@googlegroups.com
mongod should be started!

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/7922f0bc-a9d7-474b-bcc3-4b93397cc5ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
//
// Oleg V.Toropov, MCP | oleg.t...@gmail.com
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//

Oleg Toropov

unread,
Feb 4, 2019, 6:36:56 PM2/4/19
to mongod...@googlegroups.com
Also
mongoimport --host localhost --port 27000
I am not sure if it is important, but you do not need ":27000" in the host name if you use --port

Bob Cochran

unread,
Feb 4, 2019, 6:41:16 PM2/4/19
to mongod...@googlegroups.com
Well...first of all, Did you really start your mongodb server? Do you know for sure that it is running? You can test that by launching the mongo shell: 

open a terminal window 

Type 

mongo

It should print some text and give you a > prompt. 

If that works, are you positive that your server is really listening in port 27000? The default is port 27017. The mongoimport utility knows enough to try port 27017 if you don’t specify a port number. So try connecting without the —port parameter. 

Thanks so much

Bob
--
Message has been deleted

antonio.b...@gmail.com

unread,
Feb 5, 2019, 4:49:05 PM2/5/19
to mongodb-user
Hi Guys,

thanks a lot for your response.
mongod running and I am sure of the port 27000 (it is request to tutorial\lab).

I run the command with many param, but I still receive the same issue:

mongoimport -h localhost:27000 --port 27000 -u "m103-application-user" -p "m103-application-pass" --authenticationDatabase "applicationData" --db applicationData --collection "products" products.json

Failed: error connecting to db server: no reachable servers


any suggestions ?


A.

antonio.b...@gmail.com

unread,
Feb 5, 2019, 4:56:45 PM2/5/19
to mongodb-user
hi,

i have just triend, but I have an different issue:

Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.



A.

antonio.b...@gmail.com

unread,
Feb 5, 2019, 5:07:47 PM2/5/19
to mongodb-user
my config file

storage:
  dbPath: "/var/mongodb/db/"
systemLog:
  path: "/var/mongodb/db/mongod.log"
  destination: "file"
  logAppend: true
net:
  bindIp : "localhost,192.168.xxx.xxx"
  port: 27000
processManagement:
   fork: true
operationProfiling:
   mode: slowOp
   slowOpThresholdMs: 50

Antonio

unread,
Feb 5, 2019, 5:16:57 PM2/5/19
to mongodb-user
Hi guys,

thanks a lot for the support, I have understood my issue.
The problem was: --authenticationDatabase "admin"

before

mongoimport -h localhost --port 27000 -u "m103-application-user" -p "m103-application-pass" --authenticationDatabase "applicationData" --db applicationData --collection "products" products.json

after

mongoimport -h localhost --port 27000 -u "m103-application-user" -p "m103-application-pass" --authenticationDatabase "admin" --db applicationData --collection "products" products.json


Thanks,
A.
Reply all
Reply to author
Forward
0 new messages