Converting to MySQL or MariaDB

I wish to reconfigure my icinga installation to use a MySQL/Maria DB is this possible or is a complete reinstall required?

Hi,

which components of Icinga are installed, and do you intend to migrate historial data from PostgreSQL?

Cheers,
Michael

I dont need to migrate any historical data, when you say components I assume you mean something like director etc?

Yep, Icinga 2, Icinga Web 2, specific modules like Director or anything else which currently has a database involved.

That being said, you need to partially install the required packages for them, and reconfigure some portions.

Icinga 2

Install the ido-mysql package as described in the docs, it will pull the libmysql client packages as well. Ensure that the MariaDB/MySQL server is running (or install it like described in the docs).

Next up, configure the ido-mysql feature and enable it. Ensure that Icinga 2 really writes to this backend, by querying the database like shown in this example.

Icinga Web 2

Install the PHP extension for MySQL first. If you have chosen to store your users in the icingaweb2 database, you’ll need to create it manually and import the MySQL schema. The docs also have the query required for creating the initial user.

Then navigate into the configuration frontend for Icinga Web 2, and add 2 new resources:

  • icingaweb_mysql
  • icinga_ido_mysql

There you’ll define the credentials and more database specific access.

Now comes the big part, re-configure Icinga Web 2 to use these resources instead of the old ones.

  • Set the config_resource to icingaweb_mysql
  • Navigate into the monitoring module configuration, and set icinga_ido_mysql as default backend resource.

Log-in with a different browser and ensure everything is working. If not, look into the configuration files on disk for resources, backends, etc and edit them by hand.

Note

If you prefer to re-run the setup wizard, and skip everything else, you can do so by 1) enabling the setup module again 2) generating a new setup token 3) Navigate to /icingaweb2/setup

Director

  • Create a MySQL database
  • Define it as resource, e.g. director_mysql
  • Modify the backend resource inside the Director modules configuration, and point it to director_mysql as default backend.

Notes

That’s how I would do it, always with a backup of the entire configs and databases. I haven’t tested them all (just extracted the docs), so maybe it is worth a shot with doing it the other way - start on a fresh server with a fresh install.

Cheers,
Michael

1 Like