我正试图通过apachemesos和marathon构建一个可伸缩的replicaset。因此,我创建了一个docker文件,其中包含mongodb3.0.7和一个node.js应用程序,该应用程序将自己注册到 eventSubscriptions
马拉松的api,意思是它对马拉松的事件做出React。
这些都是由应用程序过滤的,例如在第一个节点启动时触发replicaset init,在下一个节点也启动时向replicaset添加成员。
初始化工作正常,但当我尝试将下一个节点添加到replicaset时,mongodb报告了一个错误:
2015-10-22T08:52:58.639+0000 I REPL [conn18] replSetReconfig admin command received from client
2015-10-22T08:52:58.641+0000 W NETWORK [conn18] Failed to connect to 192.168.200.167:31069, reason: errno:111 Connection refused
2015-10-22T08:52:58.641+0000 I REPL [conn18] replSetReconfig config object with 2 members parses ok
2015-10-22T08:52:58.641+0000 W NETWORK [ReplExecNetThread-0] Failed to connect to 192.168.200.167:31069, reason: errno:111 Connection refused
2015-10-22T08:52:58.691+0000 W REPL [ReplicationExecutor] Failed to complete heartbeat request to 192.168.200.167:31069; Location18915 Failed attempt to connect to 192.168.200.167:31069; couldn't connect to server 192.168.200.167:31069 (192.168.200.167), connection attempt failed
2015-10-22T08:52:58.691+0000 E REPL [conn18] replSetReconfig failed; NodeNotFound Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 192.168.200.168:31970; the following nodes did not respond affirmatively: 192.168.200.167:31069 failed with Failed attempt to connect to 192.168.200.167:31069; couldn't connect to server 192.168.200.167:31069 (192.168.200.167), connection attempt failed
我尝试验证连接是否有效,并且我可以成功连接到给定的连接信息:
$mongo --host 192.168.200.167 --port 31069
MongoDB shell version: 3.0.7
connecting to: 192.168.200.167:31069/test
Server has startup warnings:
2015-10-22T08:52:59.212+0000 I CONTROL [initandlisten]**WARNING: You are running this process as the root user, which is not recommended.
>
所以,对我来说,连接似乎就在那里。接下来,我检查了为重新配置replicaset而创建的新replicaset配置是否有效:
{
"_id": "rs0",
"version": 2,
"members": [
{
"_id": 0,
"host": "192.168.200.168:31970",
"arbiterOnly": false,
"buildIndexes": true,
"hidden": false,
"priority": 1,
"tags": {},
"slaveDelay": 0,
"votes": 1
},
{
"_id": 1,
"host": "192.168.200.167:31069"
}
],
"settings": {
"chainingAllowed": true,
"heartbeatTimeoutSecs": 30,
"getLastErrorModes": {},
"getLastErrorDefaults": {
"w": 1,
"wtimeout": 0
}
}
}
此配置通过发出
db.admin().command({replSetReconfig: myConfig}, function(error, newConfigResult) { ... });
此配置在mongodb日志中触发上述错误,在node.js应用程序日志中触发以下错误:
{
"name": "MongoError",
"message": "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 192.168.200.168:31970; the following nodes did not respond affirmatively: 192.168.200.167:31069 failed with Failed attempt to connect to 192.168.200.167:31069; couldn't connect to server 192.168.200.167:31069 (192.168.200.167), connection attempt failed",
"ok": 0,
"errmsg": "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 192.168.200.168:31970; the following nodes did not respond affirmatively: 192.168.200.167:31069 failed with Failed attempt to connect to 192.168.200.167:31069; couldn't connect to server 192.168.200.167:31069 (192.168.200.167), connection attempt failed",
"code": 74
}
现在,如果我使用这个配置并直接在主服务器的mongodbshell上通过
db.runCommand({replSetReconfig: myConfigFromAbove});
它也可以。。。有人知道真正的问题是什么吗?提前多谢了!
暂无答案!
目前还没有任何答案,快来回答吧!