...
Continue this 90 day cycle until the desired retention period is attained.
Recover Disk Space - Compact MongoDB
The old records have been removed, but the data base is still taking the same amount of storage. In order to recover the disk space we will need to issue that MongoDB 'compact' command that will rewrite and defrag the database. The safe approach is to shut down all daemons that are writing the the database prior to issues the 'compact' command.
Shutdown OMK Applications
Code Block |
---|
service opeventsd stop
service opflow stop
service opconfigd stop
service nmisd stop
service omkd stop |
Enter the mongo Shell and Compact opEvents Collections
Code Block |
---|
[root@DC4-opmantek02 cron.d]# mongo -u opUserRW -p op42flow42 admin
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017/admin
MongoDB server version: 3.4.9
> db.runCommand({compact: 'events'})
{ "ok" : 1 }
> db.runCommand({compact: 'rawlogs'})
{ "ok" : 1
> db.runCommand({compact: 'actionlog'})
{ "ok" : 1 }
> |