mongodb system.profile does not exist

最近在做mongodb的慢查詢記錄,由於剛開始數據庫的數據很少,設置--profile=2

進入數據庫(test數據庫暫時爲空)

> use test
switched to db test
> db.getProfilingLevel()
2

> show collections
system.indexes
test

問題出現了:沒有system.profile這個文件,難道是我沒有插入數據,我重新插入數據後還是沒有system.profile這個文件。

> db.getProfilingStatus()
{ "was" : 2, "slowms" : 100 }

在網站上搜索這個的解決方法:

> use test
> db.createCollection("system.profile", {capped:true, size:100000})
> show collections

或者

>use test
>db.runCommand( {create:"system.profile", capped:true, size:100000} )

這樣的解決方法都是手動的創建這個文件;難道mongodb就不能自動生成這個文件嗎,還是我的配置有問題???!!!

今天有時間又設置了下--profile=1,啓動mongodb盡然沒有報錯,如果設置--profile=1 --slowms=0還是會提示“profile: warning ns local.system.profile does not exist”,只要設置slowms不爲0就沒有這個消息提示了;

但是設置成--profile=2 --slowms=0還是有問題

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章