How do I reduce the size of an RTM database?
If your RTM database is running out of free space on the hard disk, it may be because the retention period of the database is configured incorrectly. The following procedure allows you to reduce the size of the RTM database.
Procedure
-
Use the RTM data purge
script.
- If necessary move some files to another disk to make some free space on the hard
disk.
rm -rf /tmp/*
- Go to Console > Configuration > RTM Settings. Click the Maint tab.
- Modify the Database Maintenance Time to the nearest convenient time to start the RTM data purge process.
- Decrease the following parameters accordingly:
- Detail Job Data Retention Period
- Summary Job Data Retention Period
- Daily Statistics Retention Period
- Set Optimization Schedule to Daily.
- Click Save to save your changes.
- If the preceding step failed to work, manually start the RTM data purge
process using the following commands:
cd cacti/plugins/grid/ php -e poller_grid.php -fm
- If necessary move some files to another disk to make some free space on the hard
disk.
-
If step 1
failed to reduce the size of RTM database,
manually purge the cacti tables one by one in the order of the size of each cacti table.
- Make some free space first. If necessary move some files to another disk to make more free
space
rm -rf /tmp/*
- Take down the original size of cacti table files
ls -l /var/lib/mysql/cacti/<table name>.*
For example:ls -l /var/lib/mysql/cacti/grid_job_daily_stats.*
- Run the following statements on MySQL
database
select min(<column of attribute timestamp>), max(<column of attribute timestamp>) from <table name>; delete from <table name> where <column of attribute timestamp> < timestamp '<date>'; -- you decide the date accordingly commit; optimize table <table name>; commit;
For example:select min(date_recorded), max(date_recorded) from grid_job_daily_stats; delete from grid_job_daily_stats where date_recorded < timestamp '<>date', - you decide the date, say '2013-8-12'; commit; optimize table grid_job_daily_stats; commit;
- Check if the size of cacti table files reduces. For
example:
ls -l /var/lib/mysql/cacti/grid_job_daily_stats.*
- Make some free space first. If necessary move some files to another disk to make more free
space