Article Contents
Overview
At times it may be necessary to reduce the disk space that your MySQL DataStore consumes on your monitoring station. The process of reducing your DataStore size follows the general steps that are outlined in this article.
Step 1 - Trim out Performance Data that You No Longer Need
In order to shrink your DataStore you will need to remove some portions of your historical performance data. Removing performance data will not shrink the DataStore but it will free up space within the DataStore tablespace, this will stop the DataStore from growing until all of the space used for the trimmed data has been filled with new performance data.
There are a few different ways to trim out historical performance data from your DataStore. The most simplistic method is to change your up.time archive policy to the number of months that you would like to maintain but you can also run manual SQL commands to remove very specific sets of data. For assistance trimming specific performance data please contact support, to trim out performance data using the archive policy use the steps below.
When up.time restarts, it should start archiving data. The archived files will be placed in the directory <uptime_dir>/archives. Once the archiving process is completed, the entry Finished Archiving should appear in the file <uptime_dir>/logs/uptime.log.
Step 2 - Export your Configuration and Performance Data
Trimming out performance data from your DataStore does not shrink the size of your DataStore on disk alone. You must also export your configuration and performance data after you have trimmed it down. Then, you can rebuild the DataStore and reduce its size.
To export your configuration and performance information, first stop the uptime_core or Data Collector service, so that up.time isn't actively writing to the database: Starting (or restarting ) and Stopping up.time
Now run the following command to export the database contents:
> cd <uptime_dir>mysql\bin > mysqldump -uuptime -puptime -P3308 --protocol=tcp uptime > export.txt |
The command above dumps your up.time DataStore information into a simple text file named export.txt. This file will be very large, so plan for this command to take some time to complete. The settings used below are based on a default up.time installation. Check your uptime.conf file for the settings that are specific to your installation.
Step 3 - Rebuild your DataStore
After exporting your configuration and performance data, you must delete and rebuild your DataStore. When the DataStore is rebuilt based on your trimmed performance data it will consume only the smaller amount of space, successfully shrinking the size of the DataStore on disk.
To rebuild your DataStore, perform the following steps. This process will remove all up.time data from the DataStore. Be sure that you have completed step 2 above to backup your configuration before performing these steps.
On Linux systems:
> mysql -uuptime -puptime -P3308 --protocol=tcp mysql> use uptime; mysql> drop database uptime; mysql> exit; > /etc/init.d/uptime_datastore stop |
On Windows systems:
> mysql -uuptime -puptime -P3308 --protocol=tcp mysql> use uptime; mysql> drop database uptime; mysql> exit; > net stop "up.time Data Store" |
Delete the following files from your DataStore directory:
ibdata1 ib_logfile0 ib_logfile1 |
On Linux systems:
> /etc/init.d/uptime_datastore start > mysql -uuptime -puptime -P3308 --protocol=tcp mysql> create database uptime; mysql> exit; > mysql -uuptime -puptime -P3308 --protocol=tcp -A -N -f uptime < export.txt |
On Windows systems:
> net start "up.time Data Store" > mysql -uuptime -puptime -P3308 --protocol=tcp mysql> create database uptime; mysql> exit; > mysql -uuptime -puptime -P3308 --protocol=tcp -A -N -f uptime < export.txt |
Run the following commands to restart the remaining up.time processes:
On Linux systems:
/etc/init.d/uptime_core start /etc/init.d/uptime_httpd start /etc/init.d/uptime_controller start |
On Windows systems:
> net start "up.time Data Collector" > net start "up.time Web Server" > net start "up.time Controller" |