我正在尝试收集关于我的Applciation发生在mongodb上的所有查询.所以我将分析级别设置为2,以便它将记录所有查询.作为架构的一部分,只要用户登录,mongodb就会发生连续的更新.
但我观察到的是,system.profile
计数正在减少,不知道为什么
> db.system.profile.count()
322
> db.system.profile.count()
351
> db.system.profile.count()
202
> db.system.profile.count()
136
> db.system.profile.count()
233
Run Code Online (Sandbox Code Playgroud)
为什么在我的情况下,查询被覆盖?
我是否有可能记录我的应用程序发生的所有区别查询.
我需要这个,因为我可以删除/添加我的一个集合上的一些索引.
Ori*_*Dar 21
system.profile是一个上限集合,默认大小为1MB,因此文档会在自然(相对于插入时间戳)的基础上进行清除,以便为较新的文档腾出空间.
为了增加system.profile集合(比如10 MB)的大小,请执行以下操作:
1)停止探查器: db.setProfilingLevel(0)
2)Drop system.profile: db.system.profile.drop()
3)手动创建一个更大的system.profile集合: db.createCollection( "system.profile", { capped: true, size: 1024 * 1024 * 10 } )
4)再次启用分析
平均而言,如果一个1MB的集合安装在200-300个文档周围,则新设置将适合大约2,000-3,000个文档.根据需要增加system.profile大小.
归档时间: |
|
查看次数: |
2464 次 |
最近记录: |