Moving a database

In order to move the database to an infrastructure server, the following process must be followed:

Stopping Opsview Copied

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 Copied

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 --add-drop-database --opt --databases opsview runtime odw dashboard notifications | gzip -c > databases.sql.gz

Backup access control Copied

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, replacing the parameters as required. The host and port can be ommitted if running a local database:

/opt/opsview/coreutils/bin/db_mysql -t -h DBHOST -P DBPORT -u DBUSERNAME -p DBPASSWORD > opsview_access.sql 

Reporting Copied

If you are migrating the jasperserver database that is used for the reporting module then export the database access controls as below, replacing the parameters as required:

/opt/opsview/jasper/bin/db_mysql -t -u DBUSERNAME -p DBPASSWORD > opsview_access_jasper.sql

Update the deployment configuration file Copied

Add the database configuration to opsview_deploy.yml. From /opt/opsview/deploy/etc, update the opsview_deploy.yaml.

For example:

# 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

    user: admin

which should be underneath and indented to line up with the ip: line.

For system upgraded from Opsview Monitor 5.4.2 Copied

From /opt/opsview/deploy/etc, comment out the following from user_upgrade_vars.yml.

#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 Copied

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 Copied

The file, 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
["Opsview On-premises"] ["User Guide"]

Was this topic helpful?