文章目录 MongoDB 慢日志管理 1. 慢日志开启 2. 慢日志分析 1. 数据库查询 2. 数据库日志分析 3. pt-mongodb-query-digest分析 4. mlogfilter分析 MongoDB 慢日志管理 1. 慢日志开启 要识别慢查询,离不开MongoDB内置的剖析器。剖析功能默认是关闭的,需要先打开。在MongoDB Shell中,输入以下命令: # 示例1:开启test数据库的慢查询 > use test switched to db test > db.setProfilingLevel(2) { "was" : 1, "slowms" : 100, "ratelimit" :