Mongo Error “couldn’t initiate : can’t find self in the replset config”

 

Problem

When trying to create a new Mongo DB replica set, the error appears: “couldn’t initiate : can’t find self in the replset config”

> rs.initiate(config);
{ "errmsg" : "couldn't initiate : can't find self in the replset config", "ok" : 0 } 


Error Resolution

Mongo DB, when initialising a new replica set, performs checks to see if it can resolve the name and address of each host. It does this against the local /etc/hosts file.

Therefore, check that the hostname is actually cited:

/etc/hosts
127.0.0.1  hostname
10.64.78.3 mongomaster.example.com mongomaster

and if not, add a local /etc/hosts entry.

  2 Responses to “Mongo Error “couldn’t initiate : can’t find self in the replset config””

  1. It worked for me.

  2. Excellent…Worked like a charm

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>