[SERVER-4418]  rs.initiate(); failed Created: 02/Dec/11  Updated: 12/May/14  Resolved: 02/Dec/11

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.0.1
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Leonid Mikityanskiy Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: replicaset
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 2.6.18-274.3.1.el5 RH5 x86_64


Attachments: Text File init_failed.txt     Text File mongod.conf     Text File mongod.log    
Issue Links:
Related
related to SERVER-13858 couldn't initiate : can't find self i... Closed
Participants:

 Description   

init step failed to run.

cat /etc/mongod.conf
~~
...
replSet = PRODrs
~~
~~
> rs.status();
{
"startupStatus" : 3,
"info" : "run rs.initiate(...) if not yet done for the set",
"errmsg" : "can't get local.system.replset config from self or any seed (EMPTYCONFIG)",
"ok" : 0
}
> rs.initiate();
{
"info2" : "no configuration explicitly specified – making one",
"me" : "sd1pxx06lx.sakdirect.com:27017",
"errmsg" : "couldn't initiate : can't find self in the replset config",
"ok" : 0
}
~~



 Comments   
Comment by Kristina Chodorow (Inactive) [ 02/Dec/11 ]

No problem!

Comment by Leonid Mikityanskiy [ 02/Dec/11 ]

Kristina,
it works.
~~~
PRIMARY> > rs.status();
{
"set" : "PRODrs",
"date" : ISODate("2011-12-02T17:06:52Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "sd1pxx06lx:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"optime" :

{ "t" : 1322845524000, "i" : 1 }

,
"optimeDate" : ISODate("2011-12-02T17:05:24Z"),
"self" : true
},
{
"_id" : 1,
"name" : "sd1pxx05lx:27017",
"health" : 1,
"state" : 3,
"stateStr" : "RECOVERING",
"uptime" : 66,
"optime" :

{ "t" : 0, "i" : 0 }

,
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"lastHeartbeat" : ISODate("2011-12-02T17:06:52Z"),
"pingMs" : 0
},
{
"_id" : 2,
"name" : "sd1pxx04lx:27017",
"health" : 1,
"state" : 3,
"stateStr" : "RECOVERING",
"uptime" : 78,
"optime" :

{ "t" : 0, "i" : 0 }

,
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"lastHeartbeat" : ISODate("2011-12-02T17:06:52Z"),
"pingMs" : 0
}
],
"ok" : 1
}
PRIMARY> db.isMaster();
{
"setName" : "PRODrs",
"ismaster" : true,
"secondary" : false,
"hosts" : [
"sd1pxx06lx:27017",
"sd1pxx04lx:27017",
"sd1pxx05lx:27017"
],
"primary" : "sd1pxx06lx:27017",
"me" : "sd1pxx06lx:27017",
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
PRIMARY>
~~~
Thanks for you help.
Leonid M.

Comment by Kristina Chodorow (Inactive) [ 02/Dec/11 ]

Put each one in the list:

> rs.initiate({_id: "PRODrs", members: [{_id: 0, host: "sd1pxx05lx:27017" }, {_id: 1, host: "sd1pxx04lx:27017"}]})

Comment by Leonid Mikityanskiy [ 02/Dec/11 ]

Kristina,
If I have more then one server to be a port of the replica set
(sd1pxx05lx ,sd1pxx04lx)
How rs.initiate(....) sould look like?
Thanks for you help.
Leonid M.

Comment by Kristina Chodorow (Inactive) [ 02/Dec/11 ]

Running rs.initiate() with no parameters attempts to auto-detect the hostname. It detected that your hostname was sd1pxx06lx.sakdirect.com, which it could not resolve (from the log: getaddrinfo("sd1pxx06lx.sakdirect.com") failed: Name or service not known). I'd suggest passing rs.initiate() a config with the hostname you want to use, e.g.,

> rs.initiate({ _id: "PRODrs", members: [ { _id: 0, host: "something.resolvable:27017" } ] })

Generated at Thu Feb 08 03:05:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.