MonogoDB副本集状态不会从启动更改为辅助

MonogoDB副本集状态不会从启动更改为辅助

本文介绍了MonogoDB副本集状态不会从启动更改为辅助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个具有3个节点(vm正在运行CentOS)的MongoDB副本集。一个节点成为主节点,另外2个节点卡在启动中。当这两个节点将从启动状态更改为辅助状态时。

I have setup a MongoDB replica set with 3 nodes(vm's running CentOS). One node became Primary other 2 stuck in Startup. When these 2 nodes will change their states from startup to secondary.

aryabhata:PRIMARY> rs.status()
{
    "set" : "aryabhata",
    "date" : ISODate("2016-04-30T08:10:45.173Z"),
    "myState" : 1,
    "members" : [
            {
                    "_id" : 0,
                    "name" : "localhost.localdomain:27017",
                    "health" : 1,
                    "state" : 1,
                    "stateStr" : "PRIMARY",
                    "uptime" : 69091,
                    "optime" : Timestamp(1461935462, 1),
                    "optimeDate" : ISODate("2016-04-29T13:11:02Z"),
                    "electionTime" : Timestamp(1461934754, 1),
                    "electionDate" : ISODate("2016-04-29T12:59:14Z"),
                    "configVersion" : 459192,
                    "self" : true
            },
            {
                    "_id" : 1,
                    "name" : "repset1.com:27017",
                    "health" : 1,
                    "state" : 0,
                    "stateStr" : "STARTUP",
                    "uptime" : 92,
                    "optime" : Timestamp(0, 0),
                    "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                    "lastHeartbeat" : ISODate("2016-04-30T08:10:44.485Z"),
                    "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                    "pingMs" : 0,
                    "configVersion" : -2
            },
            {
                    "_id" : 2,
                    "name" : "repset2.com:27017",
                    "health" : 1,
                    "state" : 0,
                    "stateStr" : "STARTUP",
                    "uptime" : 68382,
                    "lastHeartbeat" : ISODate("2016-04-30T08:10:43.974Z"),
                    "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                    "pingMs" : 0,
                    "configVersion" : -2
            }
    ],
    "ok" : 1
}


推荐答案

从主服务器检查您是否能够连接到辅助服务器

From primary check whether you are able to connect to secondary

mongo --host repset1.com --port 27017

当上述一项失败时

检查bind_ip(应为0.0.0.0,mongodb.conf中的更改为127.0.0.1):

Check bind_ip (should be 0.0.0.0, change in mongodb.conf is it's 127.0.0.1):

netstat -plunt | grep :27017 | grep LISTEN

查看次要文件的日志文件,为什么它们会卡住。他们是否收到配置详细信息?

Look at the log-files of secondaries, why they are stuck. Did they receive the configuration details?

尝试重新配置,请参见

Try to reconfigure, see mongo replicaset reconfigure

这篇关于MonogoDB副本集状态不会从启动更改为辅助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 08:58