今天,我想测试这两个参数“概要”和“慢速”。以下是我的案例:
配置文件为1,慢值为200。
更新这两个参数“概要”和“慢速”
轮廓为2,慢值为200。
当参数"profile“为2时,为什么日志文件和system.profile没有相关信息?谢谢!
发布于 2012-09-12 14:14:25
所有缓慢的查询都会写入mongod。默认的slowms值是100 is。
MongoDB 剖析级别允许将附加信息写入数据库的system.profile上限集合。
分析级别为:
0 - off
1 - write slow operations
to the system.profile collection
2 - write all operations to the system.profile collection如果将分析级别作为命令行或配置文件参数传递,它们会影响所有数据库的默认值。您还可以使用db.setProfilingLevel(..)和db.getProfilingLevel(..)在mongo shell中设置或获取每个数据库的分析级别。
所以对于你的第一次测试:
这是预期的结果,将分析设置为1,慢于200 is:
对于你的第二次测试:
- your slow query is being logged to both
- the second query isn't slow, but will be still logged to the system.profile as profiling level 2
注意,在分析级别为2的情况下,您将在system.profile中收集更多的条目。find()的默认顺序是从最早的到最新的,所以如果您想查看给定集合的最新查询,则需要按反向自然顺序排序。
例如,要在people数据库中查找对test集合的最后一个查询,可以在test.people命名空间上搜索类似于:
db.system.profile.find({'ns':'test.people'}).sort({$natural:-1}).limit(1)https://stackoverflow.com/questions/12380666
复制相似问题