5

/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
4

1 回答 1

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
}
于 2017-07-19T20:04:16.013 回答