Moving a database
In order to move the database to an infrastructure server, the following process must be followed:
You will need to stop Opsview Monitor to achieve a consistent snapshot of the database and, as such, in the example below, we show you how to stop Opsview Monitor.
Stop Opsview for a consistent snapshot of the database.
/opt/opsview/watchdog/bin/opsview-monit stop all
Backup your databases
Here, we assume that you are undertaking a full database export. You may, of course, use any other application to back up your MySQL databases. You should be aware that if the new database server is located on a different architecture, that is, 32- or 64-bit, then you will need to export your database, as shown in the example below:
Run the below command as root making sure to include any extra databases you may have (for example, include jasperserver if it exists). This will create a full database export:
mysqldump -u root -p --default-character-set=utf8mb4 --add-drop-database --opt --databases opsview runtime odw dashboard notifications | sed 's/character_set_client = utf8 /character_set_client = utf8mb4 /' | gzip -c > databases.sql.gz
Backup access control
You should also set up access controls with your new database server so that the Opsview Monitor master is allowed to connect. So, from the Opsview Monitor master run the command shown below:
Set up access controls to allow the Opsview Monitor master to connect.
/opt/opsview/coreutils/bin/db_mysql -t > opsview_access.sql
If you are migrating the jasperserver database that is used for the reporting module then export the database access controls.
/opt/opsview/jasper/bin/db_mysql -t > opsview_access_jasper.sql
Update the deployment configuration file
Add the database configuration to
/opt/opsview/deploy/etc, update the
# add the following lines: database_hosts: opsview-uk-db: ip: 10.2.14.190
If you use a different administration user user than
root for the database, you can specify that using
which should be underneath and indented to line up with the
For system upgraded from Opsview Monitor 5.4.2
/opt/opsview/deploy/etc, comment out the following from
#opsview_database_backend_nodes: #- opsview-old-uk-master:
Run the following commands:
cd /opt/opsview/deploy/ ./bin/opsview-deploy lib/playbooks/check-deploy.yml ./bin/opsview-deploy lib/playbooks/setup-hosts.yml ./bin/opsview-deploy lib/playbooks/setup-infrastructure.yml
Restore your databases
On your new server, restore the databases, as shown in the example below. You should also verify that your character set for the new databases are the same, as your previous version, since you may experience issues when upgrading.
On your new server restore your databases.
gunzip -c databases.sql.gz | mysql -u root -p
Restore access control
opsview_access.sql, now contains all the necessary access credentials, which should be transferred to the new database and imported as follows:
mysql -u root -p < opsview_access.sql
If migrating the reporting jasperserver database:
mysql -u root -p < opsview_access_jasper.sql
For additional security, you may want to restrict access to the Opsview Monitor master only.
Run the following commands:
host1:~# cd /opt/opsview/deploy/ # install and configure the opsview host1:/opt/opsview/deploy# ./bin/opsview-deploy lib/playbooks/setup-opsview.yml