IT IS HERE! Get Smashing Node.JS on Amazon Kindle today!
Show Posts
← Back to homepage

If MongoDB rs.status() displays the following error:

> rs.status()
	"startupStatus" : 4,
	"errmsg" : "all members and seeds must be reachable to initiate set",
	"ok" : 0

The first course of action is to look at the MongoDB logs. In my Amazon Linux installation, these are at /var/log/mongo/mongod.log.

$ tail -n 100 /var/log/mongo/mongod.log

You might find an entry like this:

(date) [rsStart] getaddrinfo("ip-10-0-1-94") failed: Name or service not known

Under certain configurations, your machine’s hostname might not actually be reachable. An easy solution is to make it so by adding the an entry to /etc/hosts:   ip-10-0-1-94

After restarting mongo, you’ll be able to run rs.config without problems with any IPs you want as members of the replica set.

Your thoughts?

About Guillermo Rauch:

CTO and co-founder of LearnBoost / Cloudup (acquired by Automattic in 2013). Argentine living in SF.