MongoDB:如何禁用日志记录警告:ClientCursor::staticYield can';t解锁递归锁的b/c?
我得到了标题中的警告 警告:ClientCursor::staticYield无法解锁递归锁的b/c ns 在日志文件中记录了无数次(日志文件在一天内大小达到200 GB,使用此单一日志消息)。如中所述,我希望采用忽略消息的“解决方案” 我为阻止它所做的(无济于事)是:MongoDB:如何禁用日志记录警告:ClientCursor::staticYield can';t解锁递归锁的b/c?,mongodb,logging,debian,suppress-warnings,Mongodb,Logging,Debian,Suppress Warnings,我得到了标题中的警告 警告:ClientCursor::staticYield无法解锁递归锁的b/c ns 在日志文件中记录了无数次(日志文件在一天内大小达到200 GB,使用此单一日志消息)。如中所述,我希望采用忽略消息的“解决方案” 我为阻止它所做的(无济于事)是: 设置参数quiet=true 设置参数oplog=0 设置参数logpath=/dev/null(希望不再记录任何内容) 设置参数logappend=false 所有这些都是无用的-消息仍然会充斥日志文件 我现在使用的解决方
- 设置参数
quiet=true
- 设置参数
oplog=0
- 设置参数
(希望不再记录任何内容)logpath=/dev/null
- 设置参数
logappend=false
我在Debian 6.0上使用MongoDB 2.6.2,同时从
Perl
对其进行编程。最近,我自己也在研究这个错误,因为我看到每月从mongod.log
生成25Gb,并显示了类似的消息。但是,我注意到日志消息中包含了一个查询(我已将消息格式化为适合本文的格式,实际上都在一行中):
通过谷歌搜索发现,当查询无法使用任何索引时,最常出现此消息。我尝试在日志中的查询中使用.explain()
,结果确实显示使用了基本计数器
,但没有索引:
db.users.find( { Registered: false, Completed: 0 } ).sort( { Created: 1 } ).explain()
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 10453,
"nscanned" : 10453,
"nscannedObjectsAllPlans" : 10453,
"nscannedAllPlans" : 10453,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 1,
"nChunkSkips" : 0,
"millis" : 7,
"indexBounds" : {
},
"server" : "mongodb-live.eu-west-1a.10_1_2_213:27017"
}
为查询中的元素添加索引修复了该问题。日志不再生成,当我再次运行.explain()
时,它显示正在使用的索引:
{
"cursor" : "BtreeCursor Registered_1_Completed_1",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 0,
"nscanned" : 0,
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 1,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"Registered" : [
[
false,
false
]
],
"Completed" : [
[
0,
0
]
]
},
"server" : "mongodb-live.eu-west-1a.10_1_2_213:27017"
}
您可以尝试减少日志的冗长性。不知道您当前的日志详细程度。请参阅本页上的
systemLog.verbosity
:这不是您要寻找的答案,但如果这仍然是一个问题,您可以通过将logrotate设置为每小时(或更短时间)运行来解决此问题。
{
"cursor" : "BtreeCursor Registered_1_Completed_1",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 0,
"nscanned" : 0,
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 1,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"Registered" : [
[
false,
false
]
],
"Completed" : [
[
0,
0
]
]
},
"server" : "mongodb-live.eu-west-1a.10_1_2_213:27017"
}