Database backup while server is running?

Hi,
I’m maintaining a sonarqube server currently running version 9.9.2 inside a docker container.

We have a regular backup job scheduled that stops the server, then backs up the postgresql database and then starts the server again. Due to the sonarqube restart, all the users sessions get closed and people need to login again which is a little inconvenient.

So I was wondering whether it’s safe to start the postgresql dump while the server is running, potentially with some analysis going on? Don’t want to risk to create an inconsistent database dump.

The related documentation https://docs.sonarsource.com/sonarqube/latest/instance-administration/backup-and-restore/ doesn’t loose too many words on the backup process.

Hi,

It’s safest to take a backup while SonarQube isn’t running. You do risk data inconsistencies otherwise.

If you take the backup with an analysis report is being processed, you could capture your snapshot while a project is “mid-stream” with some parts updated from the latest analysis & others not.

Now, you might be able to take your backup when there are no reports being processed. That significantly lessens the potential for inconsistencies, but there’s still a chance.

Let’s say my project is failing its Quality Gate because of an issue. Through the UI, I mark it false positive. What happens next is that a background process is triggered that updates

  • issue measures (Open issue count -=1, False Positive issue count +=1,…)
  • Quality Gate status

So there’s a risk of hitting this mid-stream too.

 
HTH,
Ann

If I remember correctly, @ganncamp and @jsinge, we did some work in SonarQube v8.9 LTS to make hot backups possible (we even put it in the release announcement)!

So my take is that a hot backup is not risky.

1 Like

Hi,

Thanks for the reminder @Colin!

I’m the one who wrote that announcement, but SonarQube 8.9 was so long ago! :sweat_smile:

With your prompting, I did some digging in Jira. I’m not finding anything specific there about what the backup procedure should be, so it looks like this should just work.

Sorry for the confusion.

 
Ann

That’s good news, thanks!

1 Like

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