我总是遇到在mongod.cfg中添加配置的问题。
现在我想根据this suggestion启用operationProfiling: 用于指定慢速操作的阈值
systemLog:
destination: file
path: C:\Mongo\log\mongod.log
logAppend: true
storage:
journal:
enabled: true
dbPath: C:\Mongo\db
operationProfiling:
mode: 2
slowOpThresholdMs: 500
slowOpSampleRate: 1.0
但是当我想从服务启动mongodb时我得到了错误:
Error1053:The service did not response to the start or control request in a timely fashion
cfg文件错误?实际上没有
operationProfiling:
mode: 2
slowOpThresholdMs: 500
slowOpSampleRate: 1.0
服务已启动,但是当我添加此配置时出现错误。
******编辑******
我正在使用mongodb 3.6
答案 0 :(得分:1)
Mode是一个字符串值,默认为关闭,因此您需要打开,如下所示: 模式:开启
答案 1 :(得分:0)
我希望它可以工作,请尝试以下操作:
operationProfiling:
mode: slowOp (Different modes: off, slowOp, all)
slowOpThresholdMs: 500
slowOpSampleRate: 1.0
请在URL下面浏览以获取有关(MongoDB docs)的更多信息
答案 2 :(得分:0)
好吧,operationProfiling.mode仅支持字符串值。默认情况下,模式是关闭的。其他两个选项是slowOp和全部。就我而言,我使用“全部”。 就您而言,应该是
operationProfiling:
mode: "all"
slowOpThresholdMs: 500
slowOpSampleRate: 1.0
有关更多信息,请点击链接 https://docs.mongodb.com/manual/reference/configuration-options/#operationProfiling.mode