Skip to content

Database Backup in Watcher

Create a database backup:

  • Regularly according to the schedule. In case of an unexpected failure, you can quickly restore the system.
  • To migrate the Watcher database to a new server. Make a backup on the old server and deploy it on the new one.
  • Before making significant changes to the configuration. If the change causes a service failure, you can roll it back.
  • Before updating Watcher. If something goes wrong during the update, the data in the backup will remain intact.

Creating a Backup

You can create a database backup using the watcher utility:

/opt/flussonic/contrib/watcher backup create

After executing the command, a message will appear on the screen:

Create backup watcher database, please waiting...
Backup success to file /var/lib/flussonic-watcher/backups/watcher_dump_20240711_100517.bak.gz

Caution

It is highly recommended to set up regular automatic database backups.

Restoring from a Backup

To restore from a backup, run the command:

/opt/flussonic/contrib/watcher backup restore

By default, the utility will take the latest backup. Confirm by entering y.

Using the latest dump: watcher_dump_20240711_101404.bak.gz
Or specify a specific dump. Usage: /opt/flussonic/contrib/watcher backup restore watcher_dump_20240711_101404.bak.gz
File creation date: 2024-07-11 10:14:04
Are you ready to restore the dump? During this time, the services will be stopped (y/n)

Example of Scheduling Regular Backups

The simplest way to set up regular backups is to use the cron tool. Execute the following in the command line:

crontab -e

On the first run, the system will prompt you to choose an editor to open the cron configuration file. We recommend using nano, which is first in the list:

Choose 1-4 [1]: 1

Add a line at the end of the file, for example:

0 5 * * * /opt/flussonic/contrib/watcher backup create

This rule will backup the database every day at 5:00 AM. To set a different frequency, edit the parameters at the beginning of the command. For more details, see here.

After editing, press Ctrl+O to save, and then Ctrl+X to exit the editor.

Make a Copy to an External Server

It is good practice to store backups on a separate server, otherwise backups are not protected from:

  • System disk failure
  • File system corruption

We do not offer a ready-made solution for synchronizing files with an external disk. Choose a solution that will be most convenient in your case. If you need help, our support service will consult you.