Database issues
Opsview in error state after switching to a different database vendor Copied
Changing the database vendor (such as from MariaDB to MySQL or vice versa) in an existing Opsview deployment is not supported. Any attempts will cause playbook execution for check-deploy.yml
and setup-everything.yml
to fail, and Opsview will enter an error state.
To restore Opsview and its databases to their previous state, do the following:
- In the
user_vars.yml
file, remove the specifiedopsview_database_package_vendor
andopsview_database_package_version
fields. - Rerun the deployment playbooks.
cd /opt/opsview/deploy
./bin/opsview-deploy lib/playbooks/check-deploy.yml
./bin/opsview-deploy lib/playbooks/setup-everything.yml
- If necessary, restore the database backup. First, identify the required backup file. Then, execute the following command to restore all databases on the server.
gunzip -c /path/to/databases.sql.gz | mysql -u root -p
The MySQL root user password can be found in the /opt/opsview/deploy/etc/user_secrets.yml
file.
Note
If you encounterERROR: Access to system schema 'mysql' is rejected
, refer to the Error when restoring the MySQL database troubleshooting section.
Once the restore is completed, Apply Changes to submit your database modifications.
Disable the MariaDB repository and remove its packages Copied
Warning
Before proceeding, ensure that your databases have been backed up to prevent data loss. For more information, see Back up Opsview databases and configuration.
Before upgrading to MariaDB 10.11 on a RHEL or OL system, you must disable the MariaDB repository as the upgrade process switches the package source to the OS repository.
Run the following commands on the systems that have the MariaDB database server and client packages installed.
- Disable the MariaDB repository.
dnf config-manager --set-disabled mariadb
- To verify that the MariaDB repository is disabled, run the following command. The output should indicate that the MariaDB repository is
disabled
.
dnf repolist --all
- Once disabled, remove the MariaDB packages associated with the repository. This will only remove the specified packages and not their dependencies.
rpm -e --nodeps MariaDB-server MariaDB-client MariaDB-common MariaDB-shared
Note
After removing the MariaDB packages, you might see the errorbackend database-access has no server available!
. This is expected and not a cause for concern. The next steps in Upgrade to MariaDB 10.11 will install the database server and allow you to restore your previously backed-up database.
Error when restoring the MySQL database Copied
MySQL 8 has security restrictions that prevent direct changes to system schemas such as mysql
. However, a workaround can be executed to remove the affected line that drops the mysql
database.
Run the following commands on your database host or your orchestrator, depending on where the database is located.
- Remove this line in your
databases.sql
file:
/*!40000 DROP DATABASE IF EXISTS `mysql`*/;
Or run the following sed
command:
sed -i 's/\/\*!40000 DROP DATABASE IF EXISTS `mysql`\*\/;/ /g' /path/to/databases.sql
- Restore the databases.
Note
The MySQL root user password can be found in the/opt/opsview/deploy/etc/user_secrets.yml
file.
mysql -u root -p < /path/to/databases.sql