Skip to content

Database in Watcher

This section provides the instructions on how to maintain the database used by Watcher.

Install and primary settings

  • To install PostgreSQL, with root access in the console execute the command:
apt install postgresql
  • Create a PostgreSQL user and a database. Type two commands in the console one by one. First, create the user vsaas:
sudo -u postgres createuser -P vsaas
  • The system will prompt you to enter the password that will be used for the user vsaas:
    Enter password for new role: (come up with and enter the password of the Watcher main administrator)

  • Enter the password one more time:
    Enter it again: (re-enter the password)

  • Create the database vsaas_production with the created user vsaas as the owner:

sudo -u postgres createdb -O vsaas -e -E UTF8 -T template0 vsaas_production
  • System's response if the database was created successfully: CREATE DATABASE vsaas_production OWNER vsaas ENCODING 'UTF8' TEMPLATE template0

Edit the database line in the Flussonic configuration file /etc/flussonic/flussonic.conf:

database postgresql://vsaas:VSAAS_PASSWORD@localhost/vsaas_production;

Replace VSAAS_PASSWORD with the real password of the vsaas user that you created when installing PostgreSQL. You can edit text files with the text editor nano.


There are two ways to back up a database.

  • using the builtin utility:
/opt/flussonic/contrib/watcher backup create

Will be created following file:


To restore the backup use next command:

/opt/flussonic/contrib/watcher backup restore -d 20190215201434

Learn more information about Watcher utility look at the following article: watcher tool

  • PostgreSQL utility pg_dump:
pg_dump -h localhost -d vsaas_production -U vsaas > backup.sql

The system will ask for user vsaas password:

Restore from the file backup.sql:

sudo -u postgres psql vsaas_production < dump.sql

Migration from SQLite to PostgreSQL

The migration is necessary in Watcher 19.03 and higher. 1. Back up these files:


  1. Install the latest version of Flussonic Watcher with SQLite support (19.05). Run the following commands:

    apt update apt install flussonic-watcher=19.05 flussonic=19.05 flussonic-erlang=21.3.6 service flussonic restart

    Learn more about the update process 3. Make Backup

  2. Install PostgreSQL apt install postgresql-9.6

  3. Reload the Flussonic service:

    service flussonic restart 6. Restore data from the file that was created by the migration tool:

    /opt/flussonic/contrib/watcher backup restore -d 20190215201434 7. Open the Watcher web inrweface and check that everything works (the data is present).

Working with the database structure

Sometime it may be necessary to roll back to a previous version of Flussonic Watcher for that need change structure of the database:

Updating the Database Structure

Important! In first, most important make backup the database and write e-mail to the ``.

For backing up the database, you can use the Watcher tool.