如何删除WiredTigerStat.XX.XX文件?

时间:2016-08-10 11:34:40

标签: mongodb wiredtiger

/ var / lib / mongodb /中有很多WiredTigerStat.XX.XX文件。 我可以删除它们吗?

mongo.conf:

  systemLog:
  path: /var/log/mongodb/mongod.log
  destination: file
  net:
  bindIp: 127.0.0.1
  security:
  authorization: enabled
  storage:
  dbPath: /var/lib/mongodb
  journal:
  enabled: true
  engine: wiredTiger
  # wiredTiger:
  # engineConfig:
  # statisticsLogDelaySecs: 30
  operationProfiling:
  mode: slowOp

1 个答案:

答案 0 :(得分:0)

是。我们在生产中这样做。我们有一个PowerShell脚本......(是的,在Windows上运行......)

[datetime]$killDate = $(Get-Date).AddDays(-1)
[string]$dbPath = $(Get-Content "C:\Program Files\MongoDB\Server\3.2\bin\Primary_Dev.cfg" | sls dbPath:)
[string]$dbPathNoWhitespace = $dbPath.Trim(' ')
[string]$dbPathValue = $dbPathNoWhitespace.Split(' ')[1]
if (-not Test-Path $dbPathValue) { throw "finding logs path didn't work in kill-MongoWiredTigerLogsWithFire.ps1" }

cd $dbPathValue

$(gci WiredTigerStat* | where LastWriteTime -lt $killDate).FullName | % {
  rm $_ -force
}