mongos无法登录,敲回车卡死 环境描述
mongos无法登录,敲回车卡死 环境描述
1、版本信息
# mongod.mongos.root
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:30000/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("25c70cc7-7784-476f-9b30-4bdb31082c7a") }
MongoDB server version: 4.4.6
type "help" for help
mongos>
2、故障现象
模拟故障前
# mongod.mongos.root
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:30000/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("25c70cc7-7784-476f-9b30-4bdb31082c7a") }
MongoDB server version: 4.4.6
type "help" for help
mongos> show dbs
admin 0.000GB
config 0.003GB
mongos>
#date
Tue Sep 28 11:11:42 CST 2021
修改系统时间超过当前时间180天
#date -s "2022-05-01 14:05:00"
Sun May 1 14:05:00 CST 2022
[root@mongodb-81 ~]# date
Sun May 1 14:06:33 CST 2022

就一直卡在这里,和生产环境的现象一致。查看日志,mongos的日志中出现大量的"DBException"信 息。
我这里的命令不中断,看看是否会自动在切换后能恢复正常。
{"t":{"$date":"2022-05-01T14:15:04.042+08:00"},"s":"I", "c":"CONNPOOL", "id":22566, "ctx":"ShardRegistry","msg":"Ending connection due to bad connection status","attr":{"hostAndPort":"172.28.21.81:20000","error":"ClusterTimeFailsRateLimiter: New cluster time, 1682924950, is too far from this node's wall clock time, 1651385704.","numOpenConns":0}}
解决方法:
[root@mongodb-82 ~]# /home/mongodb/mongodb/bin/mongo --port 20000 --shell /home/mongodb/mongodb/conf/.user.root.cnf
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:20000/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("8a475712-a490-4167-b6a3-bb17b7ca1ddc") }
MongoDB server version: 4.4.6
type "help" for help
---
The server generated these startup warnings when booting:
2021-09-24T18:36:41.568+08:00: Soft rlimits too low
2021-09-24T18:36:41.568+08:00: currentValue: 1024
2021-09-24T18:36:41.568+08:00: recommendedMinimum: 64000
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
configs:PRIMARY> rs.stepDown()
{
"ok" : 1,
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("7fffffff000000000000000c")
},
"lastCommittedOpTime" : Timestamp(1682924950, 2)
}
configs:SECONDARY>
前面卡主的窗口现在也释放了,自行恢复。
补充说明
经过测试,这里假如把时间修改到过去,再次修改到很远的未来,都无法正常登录,一样的卡主。 所以,每隔不到3个月,即在expiresAt到期前,仅需切换一下config主节点即可(重启服务也可以)。就会 生成一个新的,并延期3-6个月的使用期间。
管理员默认是无法直接操作这个,需要单独授权。

浙公网安备 33010602011771号