Failed: error connecting to db server: no reachable servers

4.5k views Asked by At

I'm trying to mongodump a remote EC2 instance of MongoDB from my local Ubuntu 14:

mongodump --host 12.345.678.90 --sslCAFile ~/aws/remoteinstance.pem

but I get the following error:

Failed: error connecting to db server: no reachable servers

I've read these documentations: Backup and restore with MongoDB tools, mongodump

I've also tried to use the --username options and put there my remote EC2 Ubuntu username:

mongodump --host 12.345.678.90 --sslCAFile ~/aws/remoteinstance.pem --username [email protected]

Then I was asked to enter a password, but since I don't have a password, I left it empty, and I got the same error message.

I've found many questions with the same title, but they were all about cases than people tried to connect to their local instance and got that error for some reason.

BTW I connect to both my EC2 instance and its MongoDB instance frequently, so I'm sure that I know the credentials and that the .pem file is correct.

Any ideas?

1

There are 1 answers

1
Taterhead On

According to the mongodump option docs, if you don't specify --ssl or --port, the by default mongodump tries to connect to the host you specify via TCP on port 27017.

Either try:

  1. adding --ssl to your mongodump options or
  2. alter your ec2 security group on each machine to allow TCP on port 27017.