MongoDB 分片架构配置
> rs.initiate({ _id:"conf",members: [{_id:0, host:"127.0.0.1:27100"},{_id:1, host:"127.0.0.1:27101"}] } ){ "ok" : 1 }
conf:PRIMARY> rs.status()
{
"set" : "conf",
"date" : ISODate("2018-04-20T08:56:14.588Z"),
"myState" : 1,
"term" : NumberLong(1),
"configsvr" : true,
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"appliedOpTime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"durableOpTime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
}
},
"members" : [
{
"_id" : 0,
"name" : "127.0.0.1:27100",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 49,
"optime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2018-04-20T08:56:03Z"),
"infoMessage" : "could not find member to sync from",
"electionTime" : Timestamp(1524214561, 1),
"electionDate" : ISODate("2018-04-20T08:56:01Z"),
"configVersion" : 1,
"self" : true
},
{
"_id" : 1,
"name" : "127.0.0.1:27101",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 24,
"optime" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1524214563, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2018-04-20T08:56:03Z"),
"optimeDurableDate" : ISODate("2018-04-20T08:56:03Z"),
"lastHeartbeat" : ISODate("2018-04-20T08:56:13.193Z"),
"lastHeartbeatRecv" : ISODate("2018-04-20T08:56:13.673Z"),
"pingMs" : NumberLong(0),
"syncingTo" : "127.0.0.1:27100",
"configVersion" : 1
}
],
"ok" : 1
}
页:
[1]