记一次mongo异常

数据库 2021-02-05 1906

最近,mongodb总是运行没多久,就自己挂了,分析日志

2021-02-04T23:51:27.966+0800 I COMMAND  [ftdc] serverStatus was very slow: { after basic: 36, after asserts: 172, after backgroundFlushing: 210, after connections: 299, after dur: 323, after extra_info: 341, after globalLock: 361, after locks: 410, after logicalSessionRecordCache: 486, after network: 583, after opLatencies: 635, after opcounters: 635, after opcountersRepl: 635, after repl: 645, after security: 655, after storageEngine: 710, after tcmalloc: 779, after transactions: 779, after wiredTiger: 1079, at end: 1376 }
2021-02-04T23:51:28.068+0800 I COMMAND  [conn6] command admin.$cmd command: isMaster { ismaster: true, $db: "admin" } numYields:0 reslen:208 locks:{} protocol:op_msg 145ms
2021-02-04T23:53:11.507+0800 I COMMAND  [PeriodicTaskRunner] task: DBConnectionPool-cleaner took: 573ms
2021-02-04T23:53:22.000+0800 I COMMAND  [PeriodicTaskRunner] task: DBConnectionPool-cleaner took: 218ms
2021-02-04T23:53:54.305+0800 I COMMAND  [ftdc] serverStatus was very slow: { after basic: 263, after asserts: 1476, after backgroundFlushing: 3723, after connections: 6376, after dur: 8000, after extra_info: 10704, after globalLock: 13709, after locks: 23814, after logicalSessionRecordCache: 26198, after network: 29817, after opLatencies: 31758, after opcounters: 34945, after opcountersRepl: 37605, after repl: 40085, after security: 40500, after storageEngine: 41019, after tcmalloc: 43268, after transactions: 44271, after wiredTiger: 67868, at end: 72734 }
2021-02-04T23:54:18.550+0800 I COMMAND  [conn2] command admin.$cmd command: isMaster { ismaster: 1, $db: "admin", $readPreference: { mode: "primary" } } numYields:0 reslen:208 locks:{} protocol:op_msg 2109ms
2021-02-04T23:54:43.545+0800 I COMMAND  [conn1] command admin.$cmd command: isMaster { ismaster: 1, $db: "admin", $readPreference: { mode: "primary" } } numYields:0 reslen:208 locks:{} protocol:op_msg 2158ms
2021-02-04T23:54:51.145+0800 I COMMAND  [ftdc] serverStatus was very slow: { after basic: 1149, after asserts: 1149, after backgroundFlushing: 1149, after connections: 1236, after dur: 1359, after extra_info: 2799, after globalLock: 3742, after locks: 4910, after logicalSessionRecordCache: 5888, after network: 6534, after opLatencies: 7014, after opcounters: 7757, after opcountersRepl: 8251, after repl: 8518, after security: 8694, after storageEngine: 9811, after tcmalloc: 10677, after transactions: 10928, after wiredTiger: 30676, at end: 38630 }

出现了serverStatus was very slow,搜索了日志文件中出现的次数,好家伙,有135次,这只是几天的日志!

拿着标题,来到stackoverflow,得到如下结果:

这表明您的mongodb需要更多的RAM,而不是配置的RAM。我可以想到两种解决问题的方法:

增加RAM
如果运行Docker容器(https://docs.docker.com/config/containers/resource_constraints/),则增加Docker的RAM资源
关闭其他消耗RAM的应用程序,例如Web浏览器或邮件客户端
优化查询以适合您的资源:https : //docs.mongodb.com/manual/core/query-optimization/
有关更多信息,请阅读:https : //groups.google.com/g/mongodb-user/c/Y-B_XShEquE

哈哈,服务器内存剩余12%,还跑mongo,redis,mysql和一个文件服务器,1g2M果然还是不太ok啊!

标签:数据库

文章评论

评论列表

已有0条评论