李斯特 发表于 2018-10-28 08:27:45

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,>  
> show collections
  

  或者
  

  
>use test

  
>db.runCommand( {create:"system.profile", capped:true,>  

  这样的解决方法都是手动的创建这个文件;难道mongodb就不能自动生成这个文件吗,还是我的配置有问题???!!!
  今天有时间又设置了下--profile=1,启动mongodb尽然没有报错,如果设置--profile=1 --slowms=0还是会提示“profile: warning ns local.system.profile does not exist”,只要设置slowms不为0就没有这个消息提示了;
  但是设置成--profile=2 --slowms=0还是有问题


页: [1]
查看完整版本: mongodb system.profile does not exist