Cleaning up Rundeck database

Overivew

As a result of mistake of crontab setting for a job, Over 200 thousands of activity log was created. Somehow it’s not possible to delete project. Maybe it has too much activity and it takes too much time more than accepted.

In the following , There are procedure to delete whole MySQL database for rundeck and clean all jobs and activities so on.

Environments

OS : CentOS7
MySQL:Ver. 15.1
Rundeck:Ver. 3.0.13

Step1 : Backup of jobs

If you drop the MySQL database for rundeck all jobs are removed. So you have to export the important jobs for you beforehand.
The procedure is quite simple. You can select downloading a job as a XML format in the job management page. Please save it in any computer like your client one.

Step2 : Drop and Create database

Next, let’s drop the database objects for rundeck. This is a example the database name ‘rundeck’ was used for rundeck. Drop the database ‘rundeck’ and user ‘rundeckuser’ at MySQL

# Drop database and user existing for rundeck.
$ DROP DATABASE rundeck;
$ DROP USER rundeckuser@localhost;

#Create database and user again
$ CREATE DATABASE rundeck;
$ GRANT ALL ON rundeck.* to 'rundeckuser'@'localhost' identified by 'rundeckpassword'; 

In here, The name of database ,user and password is better to use same as before. Because if you change them you have to rewrite definition of them in a rundeck-config.properties file.

Step3 : Reboot Rundeck

Please reboot rundeck.

$ systemctl restart rundeckd

Step4 : Import jobs

After rebooting rundeck you can access the login page from the browser like crhome. If you didn’t change username and password you can login it by using same one as before.

Then you can find some projects as same as before but there are no jobs in there. So let’s import the jobs definition as XML format you save at Step1.

Procedure is just to select the upload of definition at the job management page.

You can refer from your client computer path. Please XML file format be enable for import maybe it’ default selected.

Summary

This method is simple and easy to understanding to clean up rundeck database. Please try it.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *