Backup and restore

Can someone help me understand the backup and restore documentation page? Backup and Restore | SonarQube Docs

According to the backup section, there isn’t a built-in way to backup everything in sonarqube. It relies on using the database’s own backup mechanism, right?

Why do I need to delete the $SQ_HOME/data/es7 directory? If SQ is deployed in kubernetes, do I need to enter the container and delete this directory?

Thanks

Hi @zacktzeng ,

yes this is correct. a normal SQL dump should be everything you need in order to restore a sonarqube instance. just make sure to test your backup from time to time but this is just an advice to not create schrödingers backup :wink:

this advise is more for consistency sake. ES in sonarqube works a little bit like a cache and if you restore a database without clearing this “cache” you would encounter inconsistencies, so it is better to delete them and let sonarqube recreate them from the data inside the restored database.

in k8s you could simply delete the pvc and let it be recreated during pod startup from the template if you have persistency enabled. if you don’t have it enabled in the first place this deletion of the ES data is already done with every startup of the pod

hope that helps :slight_smile:

2 Likes

Thanks for the answer. It was very clear and to the point!!

I have one more question. In order to restore absolutely everything, is the linked database the only I need to have a copy of? Assuming my repositories live in gitlab, I wouldn’t need to make copies of sonar scanner property files right?

This is a different component. The scanner configuration is important for the scanner but not needed in order to restore a server. If you want to backup your scanner configuration that would make sense but looking at the bigger picture here, a backup of your source code would make sense in general right?

Yeah make sense. I guess the sonarqube backup should happen around the database and sonar scan backup should happen around the repo management service. Thanks!!

Before the thread is closed I want to ask this: is there a way to tell the database provider to backup data within certain time windows? If there is no simple way, backing up everything is fine as well.

This is probably a question to your database provider :sweat_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.