将新节点添加到mongodb中的复制集中,成为STARTUP

时间:2018-12-14 08:24:52

标签: mongodb replicaset

我是mongodb的新手, 将新节点添加到mongodb中的复制集中成为STARTUP时,我遇到问题:

在复制集的PRIMARY节点(host1:27017)上,我想添加新的2个SECONDARY节点,例如:

rs.add(“ host2:27017”)

rs.add(“ host3:27017”)

之后,我运行了以下语句:rs.status()然后我看到了结果:

members" : [
    {
        "_id" : 0,
        "name" : "host1:27017",
        "health" : 1,
        "state" : 2,
        "stateStr" : "SECONDARY",
        "uptime" : 3609,
        "optime" : {
            "ts" : Timestamp(1544774117, 1),
            "t" : NumberLong(17)
        },
        "optimeDate" : ISODate("2018-12-14T07:55:17Z"),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "infoMessage" : "could not find member to sync from",
        "configVersion" : 1135269,
        "self" : true,
        "lastHeartbeatMessage" : ""
    },
    {
        "_id" : 1,
        "name" : "host2:27017",
        "health" : 1,
        "state" : 0,
        "stateStr" : "STARTUP",
        "uptime" : 1411,
        "optime" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDurable" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
        "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
        "lastHeartbeat" : ISODate("2018-12-14T08:18:56.847Z"),
        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
        "pingMs" : NumberLong(0),
        "lastHeartbeatMessage" : "",
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "infoMessage" : "",
        "configVersion" : -2
    },
    {
        "_id" : 2,
        "name" : "host3:27017",
        "health" : 1,
        "state" : 0,
        "stateStr" : "STARTUP",
        "uptime" : 1411,
        "optime" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDurable" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
        "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
        "lastHeartbeat" : ISODate("2018-12-14T08:18:56.847Z"),
        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
        "pingMs" : NumberLong(0),
        "lastHeartbeatMessage" : "",
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "infoMessage" : "",
        "configVersion" : -2
    }
],

如您所见,host1变为“ SECONDARY”,host2和host3变为“ STARTUP” =>我不知道退休金,为什么? 谁能帮帮我:如何将host1更改为PRIMARY,将host2,host3更改为SECONDARY节点。 谢谢!

0 个答案:

没有答案