Restoring QuestDB backup

63 views Asked by At

Was going through backup and restore doc for QuestDB here: https://questdb.io/docs/operations/backup/

Is restoring a database backup a manual process as I can't always have a backup dir mounted from docker otherwise it completely ignores my current DB dir. If yes, then can't I simply replace the current DB dir when I want to restore my backup instead of mounting a different directory to docker manually?

1

There are 1 answers

0
Alex des Pelagos On

Yes.

Restoring a backup is essentially replacing db directory with the backed-up directory.

https://questdb.io/docs/reference/sql/backup/#restoring-from-a-backup

So if I have my db root at

/var/data/questdb

And my backup root configured as in /var/data/questdb/conf/server.conf

# output root directory for backups
cairo.sql.backup.root=/var/data/questdb/backup

When I run

backup database

it creates new directory with the date under backup root configured:

/var/data/questdb/backup$ ll
total 0
drwxrwxr-x@ 4 alpel  staff   128B Oct 18 10:31 2023-10-18
drwxrwxr-x@ 7 alpel  staff   224B Oct 18 10:31 tmp

So to restore the backup I can simply overwrite /var/data/questdb/db with /var/data/questdb/backup/2023-10-18/db

With the latest version of QuestDB SNAPSHOT is the preferable way to do backups.