Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't initiate replica set in Ubuntu

Whenever I type: rs.initiate(), I get the following error message:

{     "info2" : "no configuration explicitly specified -- making one",     "me" : "VMHOSTNAME:27017",     "ok" : 0,     "errmsg" : "No host described in new configuration 1 for replica set rs0 maps to this node",     "code" : 93 } 

I'm running under google-cloud-engine with latest MongoDB.

Any suggestions on how to solve this?

like image 963
Italo Maia Avatar asked Mar 03 '15 22:03

Italo Maia


People also ask

Which command is used to initiate a new replica set?

To start a new replica set, use the Mongo client function rs. initiate(). Use the command rs. conf() to inspect the replica set setup ().


1 Answers

You could try passing a parameter to the .initiate() command.

Like so:

rs.initiate({_id:"yourReplSetName", members: [{"_id":1, "host":"yourHost:yourPort"}]}) 

This did the trick for me.

like image 184
LeBird Avatar answered Oct 02 '22 14:10

LeBird