问题:如何修复我的服务器并让它们恢复到正常的 ReplicaSet 并且没有错误消息?
我会提供大量赏金,但我的所有观点都在 SO 上 :(
问题细节
我在不同的服务器上运行 3 节点 MongoDB ReplicaSet(1 个主服务器、1 个从服务器、1 个仲裁服务器)。我正在尝试自动故障转移,以确保我的从服务器能够正常升级为主服务器。在我关闭主服务器并让从服务器接管主服务器后,我按照说明重新选举我的旧主服务器为主服务器(强制成员成为主要成员)从我的新 PRIMARY 运行:
> use admin
> db.auth("admin", "mypassword")
> config = rs.conf()
{
"_id" : "foo",
"version" : 1,
"members" : [
{
"_id" : 0,
"host" : "A",
},
{
"_id" : 1,
"host" : "B",
},
{
"_id" : 2,
"host" : "C",
}
]
}
> config.version++
> // the default priority is 1
> config.members[1].priority = 2
> rs.reconfig(config)
这引发了一个错误,因此我尝试了方法#2:
db.adminCommand({replSetStepDown:1000000, force:1})
这似乎弄坏了我的服务器,导致没有服务器提升为主服务器,并且我的旧主服务器和仲裁服务器开始收到以下错误:
Mon Aug 29 19:16:22 [rs Manager] replset msgReceivedNewConfig version: version: 2
Mon Aug 29 19:16:22 [rs Manager] replSet info saving a newer config version to local.system.replset
Mon Aug 29 19:16:22 [rs Manager] Server::doWork task:rs Manager exception:unauthorized db:local lock type:2 client:(NONE)
Mon Aug 29 19:16:22 [initandlisten] connection accepted from 192.168.139.50:28130 #476
Mon Aug 29 19:16:22 [initandlisten] connection accepted from 192.168.132.14:32014 #477
Mon Aug 29 19:16:23 [initandlisten] connection accepted from 192.168.139.50:28133 #478
Mon Aug 29 19:16:23 [initandlisten] connection accepted from 192.168.139.50:28136 #479
Mon Aug 29 19:16:23 [initandlisten] connection accepted from 192.168.132.14:32017 #480
Mon Aug 29 19:16:24 [initandlisten] connection accepted from 192.168.139.50:28139 #481
Mon Aug 29 19:16:24 [rs Manager] replset msgReceivedNewConfig version: version: 2
Mon Aug 29 19:16:24 [rs Manager] replSet info saving a newer config version to local.system.replset
Mon Aug 29 19:16:24 [rs Manager] Server::doWork task:rs Manager exception:unauthorized db:local lock type:2 client:(NONE)
Mon Aug 29 19:16:24 [rs Manager] replSet info not electing self, we are not freshest
Mon Aug 29 19:16:24 [initandlisten] connection accepted from 192.168.139.50:28142 #482
Mon Aug 29 19:16:24 [initandlisten] connection accepted from 192.168.132.14:32020 #483
Mon Aug 29 19:16:25 [initandlisten] connection accepted from 192.168.139.50:28145 #484
Mon Aug 29 19:16:25 [initandlisten] connection accepted from 192.168.139.50:28148 #485
Mon Aug 29 19:16:25 [initandlisten] connection accepted from 192.168.132.14:32023 #486
Mon Aug 29 19:16:26 [initandlisten] connection accepted from 192.168.139.50:28151 #487
经过谷歌搜索后,我发现这是 ReplicaSets 的一个错误:
- https://groups.google.com/group/mongodb-user/browse_thread/thread/8aad09f39d34370e?pli=1
- http://www.google.com/url?sa=D&q=https://jira.mongodb.org/browse/SERVER-2919
关于我的设置的一些信息:
- 我在 Mongo 1.8.1 上运行
- 我有
journal = true
- 我有
keyFile = /path/to/file
- 我已启用用户身份验证(这似乎是导致错误的原因)
- 我已启用防火墙,并为 mongod 打开了端口 27017-27019
- 切换之前一切正常
答案1
正如报告者在问题中更新的那样,这被报告为一个错误,并且已经在软件的较新版本中得到修复。
此处报告/修复错误:https://jira.mongodb.org/browse/SERVER-2919
该问题应标记为已回答/已关闭。