Cleaning up the TASSTA database
What problems you can prevent
If your TASSTA databases grow too large, you may experience T.Lion performance issues, and recovery after a server failure takes an unacceptably long time. The time costs of upgrading and maintenance also increase dramatically.
The recommended best practice is to keep the size of each database under 3GB. In a T.Lion – T.Brother configuration, the maximum sizes of the databases of either node need to be further reduced to about 2GB.
Voice and video recordings contribute the most to the growth of a database. Another major contributor is geo-positions of users — these records are small but very numerous. If there is a lot of voice and video communication going on in your TASSTA network, configuring a short retention period is recommended.
What you need
The vclean.sh script is intended specifically for fixing the issues described above. The script should be available as part of your T.Lion server deployment and located in the /usr/local/tassta/tools directory on the server. If the script is missing, contact the Support team to obtain it.
You also need to know the basics of scheduling
How to proceed
Set up periodic database cleanups to avoid server performance degradation.
Before you begin, check the size of your TASSTA database. For that, take the following steps:
- Log in as root.
mysqlto enter the MySQL command line.
- Execute the following query:
SELECT table_schema "tassta", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;
The largest databases will probably be maptool, recorder and tassta.
Next, check how much disk space is in use on the partition where the databases are located. For that, you can use the
df command as follows:
See the necessary percentage value in the output. If your database sizes don't exceed the recommended 3GB, make a note of that percentage. If your databases are too large, make a correction to that value — estimate what the percentage would be if the database sizes were reduced to 3GB maximum. You will use the resulting percentage when you configure database cleanup parameters.
Next, you should decide on the retention policy for your data: how many days to keep data for. Your organization may have formal requirements in this regard.
After you have made these preparations, proceed to configure the cleanup parameters.
Adjusting cleanup parameters
The vclean.sh script exposes a number of configurable parameters. For the task at hand, the following parameters are most important:
|Parameter||Meaning||What value to set|
||Maximum percentage of total occupied disk space on the partition where the database is located.||If you have chosen a reference percentage (as suggested earlier), use this value here.|
||How many days' worth of data (from now) must be retained no matter what.||Set this to the number of days that is mandated by your retention policy.|
||Data that is newer than
||Specify any convenient number.|
Script run modes
You can run the vclean.sh script in two ways:
- Without parameters
In this case, you have to edit the parameter values directly in the script code. Locate the definitions of the parameters, modify them as necessary and save your changes.
Note: Removing data for multiple days requires multiple automatic iterations (from older to newer data) — one day's worth of obsolete data requires one iteration. Each iteration also checks if the
DEFAULT_CAPACITYcondition is met; when this value is achieved, the iterations stop.
- With two parameters: server ID followed by
/usr/local/tassta/tools/vclean.sh 2 30
Here, 2 is the ID of the TASSTA server for which you are performing the database cleanup, and 30 is the maximum age of retainable data. You can look up the server ID in T.Commander if you want to use this method.
Note: In this mode, all obsolete data is removed at once; this is not recommended if you have more that three days' worth of old data.
Set up a periodic schedule for database cleanups using
cron is not available on your server, install it as root:
apt-get install cron
To set a schedule, run
crontab -e and specify a job definition using
cron syntax for running the vclean.sh script, with or without parameters.. Examples:
- Run the script every day at one in the morning:
0 1 * * * /bin/bash /usr/local/tassta/tools/vclean.sh
- Run the script every 30 minutes:
*/30 * * * * /bin/bash /usr/local/tassta/tools/vclean.sh
Use a schedule that is convenient to you, preferably during non-business hours.
Cleanup can be resource-intensive, so frequent cleanups of small amounts of data can be better than big cleanups that are far apart.