5

The are a lot of WiredTigerStat.XX.XX files in the /var/lib/mongodb/. Can I just remove them?

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
Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
gronik
  • 51
  • 2

1 Answers1

0

Yes. We are doing this in production. We have a PowerShell script...(yes, running on 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
}
Chaim Eliyah
  • 2,743
  • 4
  • 24
  • 37