codegourmet

savory code and other culinary highlights

Mongorestore: No Reachable Servers

| Comments

When using mongodb’s mongorestore commandline tool, it failed with the message

1
Failed: no reachable servers

Strangely enough, it was working on my computer, but failed on my colleague’s.

Symptoms

This only happened when restoring from localhost. The /etc/hosts file was set up correctly. Both our mongodb versions were at 3.0.6.

1
2
mongorestore my_database_dump/
=> Failed: no reachable servers.

Solution

A quick solution is to add the host to the mongorestore command:

1
mongorestore --host=127.0.0.1 my_database_dump/

Discussion

I found a bug description concerning sockets: https://jira.mongodb.org/browse/TOOLS-620, but I’m not sure if this is the reason in this case.

On my computer the /etc/mongod.conf is showing bind_ip = 127.0.0.1 - I’m not sure if the system where it failed has the same setting implemented. We will look into this.

Happy Coding! – codegourmet

Comments