From db996b1839df9fbd5a905fec3fc11bd7c883a7b1 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 23 Sep 2021 18:14:07 +0200 Subject: [PATCH] Document Postgres support refs #136 --- README.md | 5 +++-- doc/01-About.md | 5 +++-- doc/02-Installation.md | 40 ++++++++++++++++++++++++++++++++++++++-- doc/03-Configuration.md | 1 + 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e7e5342e..b57623ff 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,10 @@ ## About -Icinga DB serves as a synchronisation daemon between Icinga 2 (Redis) and Icinga Web 2 (MySQL). It synchronises configuration, state and history of an Icinga 2 environment using checksums. +Icinga DB serves as a synchronisation daemon between Icinga 2 (Redis) and Icinga Web 2 (MySQL/MariaDB/PostgreSQL database). +It synchronises configuration, state and history of an Icinga 2 environment using checksums. -Icinga DB also supports reading from multiple environments and writing into a single MySQL instance. +Icinga DB also supports reading from multiple environments and writing into a single database. ## License diff --git a/doc/01-About.md b/doc/01-About.md index 29229dec..3c3e8903 100644 --- a/doc/01-About.md +++ b/doc/01-About.md @@ -2,6 +2,7 @@ ![Icinga DB Context](images/about/icinga-db-in-icinga-context.png) -Icinga DB serves as a synchronisation daemon between Icinga 2 (Redis) and Icinga Web 2 (MySQL). It synchronises configuration, volatile states and history of an Icinga 2 environment using checksums. +Icinga DB serves as a synchronisation daemon between Icinga 2 (Redis) and Icinga Web 2 (MySQL/MariaDB/PostgreSQL database). +It synchronises configuration, volatile states and history of an Icinga 2 environment using checksums. -Icinga DB also supports reading from multiple environments and writing into a single MySQL instance. \ No newline at end of file +Icinga DB also supports reading from multiple environments and writing into a single database. diff --git a/doc/02-Installation.md b/doc/02-Installation.md index 58712867..30c67730 100644 --- a/doc/02-Installation.md +++ b/doc/02-Installation.md @@ -3,7 +3,7 @@ ## Requirements * Local Redis instance (Will be installed during this documentation) -* MySQL/MariaDB database `icingadb`, user and schema imports (Will be set up during this documentation) +* MySQL/MariaDB/PostgreSQL database `icingadb`, user and schema imports (Will be set up during this documentation) ## Setting up Icinga DB @@ -133,7 +133,11 @@ Debian/Ubuntu: apt-get install icingadb-redis ``` -### Setting up the MySQL database +### Setting up the Database + +A MySQL/MariaDB or PostgreSQL database is required. + +#### MySQL/MariaDB Note that if you're using a version of MySQL < 5.7 or MariaDB < 10.2, the following server options must be set: @@ -159,6 +163,38 @@ After creating the database, you can import the Icinga DB schema using the follo mysql -u root -p icingadb + +Set up a PostgreSQL database for Icinga DB: + +``` +# su -l postgres + +createuser -P icingadb +createdb -E UTF8 -O icingadb icingadb +``` + +Edit `pg_hba.conf`, insert the following before everything else: + +``` +local all icingadb md5 +host all icingadb 0.0.0.0/0 md5 +host all icingadb ::/0 md5 +``` + +To apply those changes, run `systemctl reload postgresql`. +(On RHEL/CentOS 7 the service is called "rh-postgresql95-postgresql".) + +After creating the database you can import the Icinga DB schema using the +following command. Enter the password when asked. + +``` +psql -U icingadb icingadb < /usr/share/icingadb/schema/pgsql/schema.sql +``` + +On RHEL/CentOS 7 prefix "createuser", "createdb" and "psql" with +"/opt/rh/rh-postgresql95/root/usr/bin/". + ### Running Icinga DB Foreground: diff --git a/doc/03-Configuration.md b/doc/03-Configuration.md index da018de9..7d9ed2e1 100644 --- a/doc/03-Configuration.md +++ b/doc/03-Configuration.md @@ -25,6 +25,7 @@ Configuration of the database used by Icinga DB. Option | Description -------------------------|----------------------------------------------- +type | **Optional.** Either `mysql` (default) or `pgsql`. host | **Required.** Database host or absolute Unix socket path. port | **Required.** Database port. database | **Required.** Database database.