Mongo DB 因 Ubuntu 18 CPU 峰值而崩溃

Mongo DB 因 Ubuntu 18 CPU 峰值而崩溃

更新:根据要求,我使用 18.04.2-Ubuntu 和 MongoDB 在此处输入图片描述 我有一个虚拟机,里面运行着几个 Node JS 项目和一个 Mongo DB 的本地实例。虚拟机只有 2 GB 的 RAM。我正在使用 Mongo DB 提供的免费监控来监控数据库

问题随机发生,Mongo DB 的 CPU 使用率很高,它超过了 2GB 内存并崩溃了。日志上的错误(附在末尾)指向 admin.$cmd,这在其他警告中出现过,但没有其他影响。这个问题可能一周内都不会发生,但突然在一天早上 6 点发生,当时没有人在呼叫服务器。我怀疑是一些内部 MongoDB 使用。 在此处输入图片描述 有没有人能告诉我为什么会出现 CPU 使用率峰值或如何避免?我可以随时升级虚拟机或使用 MongoDB atlas,但我没有意识到这种情况发生在几乎没有流量的虚拟机中

{"t":{"$date":"2023-01-11T07:32:53.117+00:00"},"s":"I",  "c":"COMMAND",  "id":23099,   "ctx":"PeriodicTaskRunner","msg":"Task finished","attr":{"taskName":"DBConnectionPool-cleaner","durationMillis":1437}}

{"t":{"$date":"2023-01-11T07:32:35.867+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"conn29","msg":"Slow query","attr":{"type":"command","ns":"admin.$cmd","command":{"ismaster":1,"$db":"admin"},"numYields":0,"reslen":304,"locks":{},"remote":"127.0.0.1:53792","protocol":"op_msg","durationMillis":43549}}

{"t":{"$date":"2023-01-11T07:31:52.574+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"LogicalSessionCacheReap","msg":"Slow query","attr":{"type":"command","ns":"config.transactions","command":{"find":"transactions","filter":{"lastWriteDate":{"$lt":{"$date":"2023-01-11T06:58:42.761Z"}}},"projection":{"_id":1},"sort":{"_id":1},"readConcern":{},"$db":"config"},"planSummary":"EOF","keysExamined":0,"docsExamined":0,"cursorExhausted":true,"numYields":0,"nreturned":0,"queryExecutionEngine":"classic","reslen":108,"locks":{"FeatureCompatibilityVersion":{"acquireCount":{"r":3}},"ReplicationStateTransition":{"acquireCount":{"w":1}},"Global":{"acquireCount":{"r":3}},"Mutex":{"acquireCount":{"r":2}}},"readConcern":{"provenance":"implicitDefault"},"storage":{},"protocol":"op_msg","durationMillis":109845}}

相关内容