About Database Backup and Restore

This page covers how to back up and restore individual GroundWork 8 databases. The GroundWork 8 databases contain your data, and you may want to extract that data for your own purposes, or to move it to another server for testing or development reasons. We sometimes use copies of databases to share example configurations, test solutions for support cases, and other ad-hoc work with data and analysis. These procedures are provided so that you can do so as needed. 

These procedures use the gwadmin account to perform the backup and restore processes. This is a privileged account in GroundWork 8 and the authentication information is hidden in a secure file in the container file system. The default credential is just gwadmin. If you do decide you need to change this password, please Submit a Ticket.

The backup procedure will produce a backup file on the host, owned by root. The backup file can be renamed to suit. Backup files should be stored (manually moved) outside the volatile /tmp directory. To be restored, the backup files will need to be copied back into the /tmp directory.

Supported Databases

Database NameDatabase Description

archive_gwcollagedb

This is a long-term database that keeps event history for all devices.

dalekstore

Portal users, roles, security, sign-on.

elastic

This database (if used) has log file entries for all the GroundWork applications and is useful for historical purposes, but not essential. 

gwcollagedb

GroundWork Foundation data integration backend, runtime database.

influxdb

This is the storage of all performance data for monitoring done with GroundWork methods.

jasperserver

If used, a Custom Reports configuration database.

monarch

Nagios configuration built on PostgreSQL relational database.

nedi

Network Discovery (NeDi) device information.

nedi_nodes

Network Discovery (NeDi) asset tracking information for Linux and Windows hosts.

noma

GroundWork Messenger notification manager configuration and methods information.

report_db

Summary database for custom reports (if used).

slareport

This database includes downtime, BSM, and SLA compliance data.

Database Backup

  1. Change to the gw8 directory:

    cd gw8
    CODE
  2. The monitoring system doesn't need to be down to create an individual database backup, but you might want to have it be down to ensure a completely consistent state on restore. To optionally take GroundWork down:

    docker-compose down
    CODE
  3. To backup a single database from a running or stopped GroundWork system, the resulting file name is of the form e.g., monarch/tmp/dockergw8-backup-monarch-20200420205424.sql.gz:

    • From a Running GroundWork system, run the following commands, specifying the database to back up (listed above), and enter the gwadmin password when prompted.

      For the specification of the SERVER_NAME, this is optional (it is only required to name the backup files).
      TAG=$(grep '^TAG=' .env | sed 's/^TAG=//')
      SERVER_NAME=$(hostname -f)
      docker run -it --rm \
          --network=default \
          -v /var/run/docker.sock:/var/run/docker.sock \
          -v ${HOME}/.docker:/root/.docker \
          -v /tmp:/tmp/tmp \
          --name gw8 groundworkdevelopment/gw8:${TAG} \
          /src/docker_cmd.sh backupDatabase <database> [-s $SERVER_NAME]
    • From a Stopped GroundWork system, run the following commands, specifying the database to back up (listed above), and enter the gwadmin password when prompted. 

      TAG=$(grep '^TAG=' .env | sed 's/^TAG=//')
      SERVER_NAME=$(hostname -f)
      docker run -it --rm \
          -v /var/run/docker.sock:/var/run/docker.sock \
          -v ${HOME}/.docker:/root/.docker \
          -v /tmp:/tmp/tmp \
          --name gw8 groundworkdevelopment/gw8:${TAG} \
          /src/docker_cmd.sh backupDatabase <database> [-s $SERVER_NAME]

      If you brought it down, bring GroundWork up:

      docker-compose up -d
      CODE

Database Restore

  1. First make sure you have a running install of a version of GroundWork Monitor that is compatible with your backupIf backups made from previous versions are restored, migrations will have to be run again by reinstalling the more recent version.
  2. To restore, place the backup file you want to restore in the /tmp directory on the host (this is where the container loads it from), symlinks are not supported:
    • Change to the gw8 directory:

      cd gw8
      CODE
    • To restore, GroundWork must be stopped. Take GroundWork down:

      docker-compose down
      CODE
  3. Set up and run the restore from the gw8 container with the following command, and enter the gwadmin password when prompted:

    TAG=$(grep '^TAG=' .env | sed 's/^TAG=//')
    docker run -it --rm \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -v ${HOME}/.docker:/root/.docker \
        -v /tmp:/tmp/tmp \
        --name gw8 groundworkdevelopment/gw8:${TAG} \
        /src/docker_cmd.sh restoreDatabase <database> <database backup file path>
    CODE
  4. Bring GroundWork up:

    docker-compose up -d
    CODE

Related Resources