Решено:
В большинстве случаев это была ошибка, указывающая версию c. Обновление до mongodb-org@4.0.5 решило проблему, и машины подключились нормально. Я оставлю вопрос на всякий случай кому-то, кто сталкивается с той же проблемой.
Оригинальный вопрос:
У меня есть два сервера в наборе реплик с двумя участниками.
mx.aireclaim .com является ПЕРВИЧНЫМ, а vimax.aireclaim.com - ВТОРИЧНЫМ. После перезагрузки на mx.aireclaim.com я столкнулся с проблемой подключения на вторичной стороне. Я проверил брандмауэр и могу получить доступ к порту 27017 от одного компьютера к другому.
Я продолжаю получать эту ошибку в моем дополнительном устройстве:
Error in heartbeat (...) response status: NetworkInterfaceExceededTimeLimit:
Couldn't get a connection within the time limit
Есть ли что-то нечистое? ' м отсутствует? Я пытался синхронизировать дату на обеих машинах, отключая брандмауэры, многократные перезапуски и изменения конфигурации, но безрезультатно.
Вот настройки replicaset и rs.status ():
PRIMARY
aireclaimRs:PRIMARY> rs.config()
{
"_id" : "aireclaimRs",
"version" : 3,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 0,
"host" : "vimax.aireclaim.com:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 2,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 1,
"host" : "mx.aireclaim.com:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
}
],
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : -1,
"catchUpTakeoverDelayMillis" : 30000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("5be0f8105dfcbe069f5c8533")
}
}
aireclaimRs:PRIMARY> rs.status()
{
"set" : "aireclaimRs",
"date" : ISODate("2020-03-23T20:08:25.719Z"),
"myState" : 1,
"term" : NumberLong(20),
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"appliedOpTime" : {
"ts" : Timestamp(1584994100, 1),
"t" : NumberLong(20)
},
"durableOpTime" : {
"ts" : Timestamp(1584994100, 1),
"t" : NumberLong(20)
}
},
"members" : [
{
"_id" : 0,
"name" : "vimax.aireclaim.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 1595,
"optime" : {
"ts" : Timestamp(1584838063, 1),
"t" : NumberLong(11)
},
"optimeDurable" : {
"ts" : Timestamp(1584838063, 1),
"t" : NumberLong(11)
},
"optimeDate" : ISODate("2020-03-22T00:47:43Z"),
"optimeDurableDate" : ISODate("2020-03-22T00:47:43Z"),
"lastHeartbeat" : ISODate("2020-03-23T20:08:24.148Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : NumberLong(0),
"configVersion" : 3
},
{
"_id" : 1,
"name" : "mx.aireclaim.com:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 8376,
"optime" : {
"ts" : Timestamp(1584994100, 1),
"t" : NumberLong(20)
},
"optimeDate" : ISODate("2020-03-23T20:08:20Z"),
"electionTime" : Timestamp(1584992519, 1),
"electionDate" : ISODate("2020-03-23T19:41:59Z"),
"configVersion" : 3,
"self" : true
}
],
"ok" : 1,
"operationTime" : Timestamp(1584994100, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1584994100, 1),
"signature" : {
"hash" : BinData(0,"oGCz38lgYjsGTrWc3maAD2vyc6M="),
"keyId" : NumberLong("6765287379189104641")
}
}
}
ВТОРИЧНЫЙ
aireclaimRs:SECONDARY> rs.status()
{
"set" : "aireclaimRs",
"date" : ISODate("2020-03-23T19:56:37.132Z"),
"myState" : 2,
"term" : NumberLong(20),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"appliedOpTime" : {
"ts" : Timestamp(1584838063, 1),
"t" : NumberLong(11)
},
"durableOpTime" : {
"ts" : Timestamp(1584838063, 1),
"t" : NumberLong(11)
}
},
"members" : [
{
"_id" : 0,
"name" : "vimax.aireclaim.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 890,
"optime" : {
"ts" : Timestamp(1584838063, 1),
"t" : NumberLong(11)
},
"optimeDate" : ISODate("2020-03-22T00:47:43Z"),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"configVersion" : 3,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 1,
"name" : "mx.aireclaim.com: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("2020-03-23T19:56:31.106Z"),
"lastHeartbeatRecv" : ISODate("2020-03-23T19:56:36.034Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "Couldn't get a connection within the time limit",
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"configVersion" : -1
}
],
"ok" : 1,
"operationTime" : Timestamp(1584838063, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1584993390, 1),
"signature" : {
"hash" : BinData(0,"zINnjtBKXZ14gJrxrUbT2zyurqQ="),
"keyId" : NumberLong("6765287379189104641")
}
}
}
Вот что происходит в журналах:
Первичный
tail /var/log/mongodb/mongodb.log
2020-03-23T21:08:09.420+0100 I NETWORK [conn2630] end connection 144.76.84.5:50114 (2 connections now open)
2020-03-23T21:08:29.420+0100 I NETWORK [listener] connection accepted from 144.76.84.5:50118 #2631 (3 connections now open)
2020-03-23T21:08:29.420+0100 I NETWORK [conn2631] end connection 144.76.84.5:50118 (2 connections now open)
2020-03-23T21:08:49.420+0100 I NETWORK [listener] connection accepted from 144.76.84.5:50122 #2632 (3 connections now open)
2020-03-23T21:08:49.420+0100 I NETWORK [conn2632] end connection 144.76.84.5:50122 (2 connections now open)
2020-03-23T21:09:09.421+0100 I NETWORK [listener] connection accepted from 144.76.84.5:50126 #2633 (3 connections now open)
2020-03-23T21:09:09.421+0100 I NETWORK [conn2633] end connection 144.76.84.5:50126 (2 connections now open)
2020-03-23T21:09:18.717+0100 I NETWORK [conn2629] end connection 127.0.0.1:60316 (1 connection now open)
2020-03-23T21:09:29.421+0100 I NETWORK [listener] connection accepted from 144.76.84.5:50130 #2634 (2 connections now open)
2020-03-23T21:09:29.421+0100 I NETWORK [conn2634] end connection 144.76.84.5:50130 (1 connection now open)
Вторичный
tail /var/log/mongodb/mongod.log
2020-03-23T20:48:13.408+0100 I REPL [replexec-1] Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)
2020-03-23T20:48:17.592+0100 I REPL_HB [replexec-1] Error in heartbeat (requestId: 74) to mx.aireclaim.com:27017, response status: NetworkInterfaceExceededTimeLimit: Couldn't get a connection within the time limit
2020-03-23T20:48:19.658+0100 I REPL [rsBackgroundSync] waiting for 2 pings from other members before syncing
2020-03-23T20:48:24.791+0100 I REPL [replexec-1] Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)
2020-03-23T20:48:28.092+0100 I REPL_HB [replexec-1] Error in heartbeat (requestId: 76) to mx.aireclaim.com:27017, response status: NetworkInterfaceExceededTimeLimit: Couldn't get a connection within the time limit
2020-03-23T20:48:29.593+0100 I ASIO [NetworkInterfaceASIO-Replication-0] Failed to connect to mx.aireclaim.com:27017 - NetworkInterfaceExceededTimeLimit: Operation timed out
2020-03-23T20:48:29.593+0100 I ASIO [NetworkInterfaceASIO-Replication-0] Connecting to mx.aireclaim.com:27017
2020-03-23T20:48:34.661+0100 I REPL [rsBackgroundSync] waiting for 2 pings from other members before syncing
2020-03-23T20:48:35.839+0100 I REPL [replexec-1] Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)
2020-03-23T20:48:38.593+0100 I REPL_HB [replexec-1] Error in heartbeat (requestId: 77) to mx.aireclaim.com:27017, response status: NetworkInterfaceExceededTimeLimit: Couldn't get a connection within the time limit
Похоже, что первичный сервер принимает соединение, а затем завершает его.
Можно подумать, что между двумя компьютерами есть проблема с соединением, но я могу:
aireclaim@aireclaim-platform-server:~> mongo mx.aireclaim.com
MongoDB shell version v3.6.10
connecting to: mongodb://mx.aireclaim.com:27017/test?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("de193403-69ca-4f74-a6c5-ee384eb420d7") }
MongoDB server version: 3.6.3
aireclaimRs:PRIMARY>
и:
root@mx /home/aireclaim mongo vimax.aireclaim.com
MongoDB shell version v3.6.3
connecting to: mongodb://vimax.aireclaim.com:27017/test
MongoDB server version: 3.6.10
aireclaimRs:SECONDARY>
Также я могу проверить, что на обеих машинах открыт порт 27017, и что они настроены для работы на этих Ips.
На самом деле все как-то функционирует. Клиентам, которые попытались подключиться к репликационному набору, удается это сделать, но похоже, что вторичное устройство больше не реплицируется.
Любое понимание было бы находкой.