MongoDB 副本集未在 6 个成员中有 4 个处于 UP 状态时选择 PRIMARY

MongoDB 副本集未在 6 个成员中有 4 个处于 UP 状态时选择 PRIMARY

我在 Scaleway 上运行了 6 个实例,在 ARM 服务器上运行了 3 个,在虚拟 Ubuntu 服务器上运行了 3 个。

mongodb1 ARM (mongodb 3.4.9)
mongodb2 ARM (mongodb 3.4.9)
mongodb3 ARM (mongodb 3.4.9)
mongodb4 VPS (mongodb 3.4.15)
mongodb5 VPS (mongodb 3.4.15)
mongodb6 VPS (mongodb 3.4.15)

这 6 个实例正在运行 mongodb 并加入副本集。

很多时候,ARM 实例会由于未知或隐含的原因而关闭或硬重启。

当我在正常运行的服务器上连接到 mongodb 时,我发现它们都是 SECONDARY,并且没有一个被选为私有。难道不应该这样才能让系统继续运行吗?

我还启动并运行了一个实例,使 6 个成员中有 4 个处于 UP 状态,仍然没有变化。

在我启动副本集的第 5 个成员后,使 6 个成员中有 5 个处于 UP 状态,最终选出一个节点作为主节点

以下是 rs.status() 的输出:

"members" : [
            {
                    "_id" : 0,
                    "name" : "mongodb1:27017",
                    "health" : 0,
                    "state" : 8,
                    "stateStr" : "(not reachable/healthy)",
                    "uptime" : 0,
                    "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-08-14T07:29:56.945Z"),
                    "lastHeartbeatRecv" : ISODate("2018-08-11T08:20:39.905Z"),
                    "pingMs" : NumberLong(0),
                    "lastHeartbeatMessage" : "Connection refused",
                    "configVersion" : -1
            },
            {
                    "_id" : 1,
                    "name" : "mongodb2:27017",
                    "health" : 0,
                    "state" : 8,
                    "stateStr" : "(not reachable/healthy)",
                    "uptime" : 0,
                    "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-08-14T07:29:56.944Z"),
                    "lastHeartbeatRecv" : ISODate("2018-08-11T08:20:39.912Z"),
                    "pingMs" : NumberLong(0),
                    "lastHeartbeatMessage" : "Connection refused",
                    "configVersion" : -1
            },
            {
                    "_id" : 2,
                    "name" : "mongodb3:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 966,
                    "optime" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDurable" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDate" : ISODate("2018-08-11T08:20:34Z"),
                    "optimeDurableDate" : ISODate("2018-08-11T08:20:34Z"),
                    "lastHeartbeat" : ISODate("2018-08-14T07:30:00.654Z"),
                    "lastHeartbeatRecv" : ISODate("2018-08-14T07:29:59.814Z"),
                    "pingMs" : NumberLong(1),
                    "configVersion" : 6
            },
            {
                    "_id" : 3,
                    "name" : "mongodb4:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 1814348,
                    "optime" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDurable" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDate" : ISODate("2018-08-11T08:20:34Z"),
                    "optimeDurableDate" : ISODate("2018-08-11T08:20:34Z"),
                    "lastHeartbeat" : ISODate("2018-08-14T07:29:58.088Z"),
                    "lastHeartbeatRecv" : ISODate("2018-08-14T07:30:00.186Z"),
                    "pingMs" : NumberLong(1),
                    "configVersion" : 6
            },
            {
                    "_id" : 4,
                    "name" : "mongodb5:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 4316484,
                    "optime" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDate" : ISODate("2018-08-11T08:20:34Z"),
                    "infoMessage" : "could not find member to sync from",
                    "configVersion" : 6,
                    "self" : true
            },
            {
                    "_id" : 5,
                    "name" : "mongodb6:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 1639135,
                    "optime" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDurable" : {
                            "ts" : Timestamp(1533975634, 1),
                            "t" : NumberLong(14)
                    },
                    "optimeDate" : ISODate("2018-08-11T08:20:34Z"),
                    "optimeDurableDate" : ISODate("2018-08-11T08:20:34Z"),
                    "lastHeartbeat" : ISODate("2018-08-14T07:29:59.990Z"),
                    "lastHeartbeatRecv" : ISODate("2018-08-14T07:29:56.473Z"),
                    "pingMs" : NumberLong(1),
                    "configVersion" : 6
            }
    ],
    "ok" : 1

相关内容