mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #409 from Icinga/config-example-and-docs
Improve example configuration, docs and config defaults
This commit is contained in:
commit
bb50db981c
7 changed files with 81 additions and 49 deletions
14
README.md
14
README.md
|
|
@ -1,17 +1,3 @@
|
|||
# IMPORTANT (28.05.2021)
|
||||
|
||||
> :warning: **We've changed a lot to prepare for Icinga DB 1.0.0 RC2** :warning:
|
||||
|
||||
You will have to do the following steps to upgrade Icinga DB to the current master:
|
||||
|
||||
1. Completely stop Icinga 2 and Icinga DB
|
||||
2. Flush your Redis (`redis-cli flushall`) - We made a lot of changes to our Redis schema, so this is necessary
|
||||
3. Upgrade Icinga 2 to the latest snapshot/master
|
||||
4. Upgrade Icinga DB to latest master
|
||||
5. Upgrade the Icinga DB SQL schema (`mysql icingadb < schema/mysql/upgrades/1.0.0-rc2.sql`)
|
||||
6. Copy `config.yml.example` to `config.yml` and change it to your needs (The config file has changed and we don't use the old `icingadb.ini` config anymore)
|
||||
7. Start Icinga 2 and Icinga DB (For Icinga DB use `go run cmd/icingadb/main.go`)
|
||||
|
||||
# Icinga DB
|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
# This is the configuration file for Icinga DB.
|
||||
|
||||
database:
|
||||
host: icingadb
|
||||
host: localhost
|
||||
port: 3306
|
||||
database: icingadb
|
||||
user: icingadb
|
||||
password: icingadb
|
||||
|
||||
redis:
|
||||
address: redis:6380
|
||||
address: localhost:6380
|
||||
|
||||
logging:
|
||||
# Default logging level. Can be set to 'fatal', 'error', 'warning', 'info' or 'debug'.
|
||||
# Default logging level. Can be set to 'fatal', 'error', 'warn', 'info' or 'debug'.
|
||||
# If not set, defaults to 'info'.
|
||||
level:
|
||||
# level: info
|
||||
|
||||
# Logging output. Can be set to 'console' (stderr) or 'systemd-journald'.
|
||||
# If not set, logs to systemd-journald when running under systemd, otherwise stderr.
|
||||
output:
|
||||
# output:
|
||||
|
||||
# Interval for periodic logging defined as duration string.
|
||||
# A duration string is a sequence of decimal numbers and a unit suffix, such as "20s".
|
||||
# Valid units are "ms", "s", "m", "h".
|
||||
# Defaults to "20s".
|
||||
interval:
|
||||
# interval: 20s
|
||||
|
||||
# Map of component-logging level pairs to define a different log level than the default value for each component.
|
||||
options:
|
||||
|
|
|
|||
|
|
@ -5,20 +5,17 @@
|
|||
* Local Redis instance (Will be installed during this documentation)
|
||||
* MySQL/MariaDB server with `icingadb` database, user and schema imports (Will be installed during this documentation)
|
||||
|
||||
Supported enterprise distributions:
|
||||
|
||||
* RHEL/CentOS 7/8
|
||||
* Debian 10 Buster
|
||||
* Ubuntu 18 Bionic
|
||||
* SLES 15.1
|
||||
|
||||
## Setting up Icinga DB <a id="setting-up-icingadb"></a>
|
||||
|
||||
### Package Repositories <a id="package-repositories"></a>
|
||||
|
||||
In order to install the latest release candidate, you have to add our `testing` repository as shown below.
|
||||
In order to install the latest release candidate, you have to add our `testing` repository as shown below. We assume
|
||||
that you have our `release` repository already activated. The following commands must be executed with root permissions
|
||||
unless noted otherwise.
|
||||
|
||||
#### RHEL/CentOS Repositories <a id="package-repositories-rhel-centos"></a>
|
||||
#### RHEL/CentOS/Fedora Repositories <a id="package-repositories-rhel-centos"></a>
|
||||
|
||||
Make sure you have wget installed.
|
||||
|
||||
```
|
||||
rpm --import https://packages.icinga.com/icinga.key
|
||||
|
|
@ -71,10 +68,17 @@ wget -O - https://packages.icinga.com/icinga.key | apt-key add -
|
|||
apt-get update
|
||||
```
|
||||
|
||||
|
||||
### Installing Icinga DB <a id="installing-icingadb"></a>
|
||||
|
||||
RHEL/CentOS 7/8:
|
||||
RHEL/CentOS 8/Fedora:
|
||||
|
||||
```
|
||||
dnf install icingadb
|
||||
systemctl enable icingadb
|
||||
systemctl start icingadb
|
||||
```
|
||||
|
||||
RHEL/CentOS 7:
|
||||
|
||||
```
|
||||
yum install icingadb
|
||||
|
|
@ -96,7 +100,16 @@ apt-get install icingadb
|
|||
|
||||
### Installing Icinga DB Redis <a id="configuring-icingadb-mysql"></a>
|
||||
|
||||
RHEL/CentOS 7/8:
|
||||
RHEL/CentOS 8/Fedora:
|
||||
|
||||
```
|
||||
dnf install icingadb-redis
|
||||
|
||||
systemctl enable icingadb-redis
|
||||
systemctl start icingadb-redis
|
||||
```
|
||||
|
||||
RHEL/CentOS 7:
|
||||
|
||||
```
|
||||
yum install icingadb-redis
|
||||
|
|
@ -124,7 +137,18 @@ apt-get install icingadb-redis
|
|||
|
||||
#### Installing MySQL/MariaDB database server <a id="installing-database-mysql-server"></a>
|
||||
|
||||
RHEL/CentOS 7/8:
|
||||
RHEL/CentOS 8/Fedora:
|
||||
|
||||
```
|
||||
dnf install mariadb-server mariadb
|
||||
|
||||
systemctl enable mariadb
|
||||
systemctl start mariadb
|
||||
|
||||
mysql_secure_installation
|
||||
```
|
||||
|
||||
RHEL/CentOS 7:
|
||||
|
||||
```
|
||||
yum install mariadb-server mariadb
|
||||
|
|
@ -157,8 +181,8 @@ mysql_secure_installation
|
|||
Note that if you're using a version of MySQL < 5.7 or MariaDB < 10.2, the following server options must be set:
|
||||
|
||||
```
|
||||
innodb_file_format=barracuda
|
||||
innodb_file_per_table=1
|
||||
innodb_file_format=barracuda
|
||||
innodb_file_per_table=1
|
||||
innodb_large_prefix=1
|
||||
```
|
||||
|
||||
|
|
@ -169,16 +193,12 @@ Set up a MySQL database for Icinga DB:
|
|||
|
||||
CREATE DATABASE icingadb;
|
||||
GRANT ALL ON icingadb.* TO 'icingadb'@'127.0.0.1' IDENTIFIED BY 'icingadb';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
quit
|
||||
```
|
||||
|
||||
After creating the database you can import the Icinga DB schema using the
|
||||
following command. Enter the root password into the prompt when asked.
|
||||
After creating the database, you can import the Icinga DB schema using the following command:
|
||||
|
||||
```
|
||||
cat /usr/share/icingadb/schema/mysql/schema.sql | mysql -uroot icingadb -p
|
||||
mysql -u root -p icingadb </usr/share/icingadb/schema/mysql/schema.sql
|
||||
```
|
||||
|
||||
### Running Icinga DB <a id="running-icingadb"></a>
|
||||
|
|
@ -186,7 +206,7 @@ cat /usr/share/icingadb/schema/mysql/schema.sql | mysql -uroot icingadb -p
|
|||
Foreground:
|
||||
|
||||
```
|
||||
icingadb -config /etc/icingadb/icingadb.yml
|
||||
icingadb -config /etc/icingadb/config.yml
|
||||
```
|
||||
|
||||
Systemd service:
|
||||
|
|
@ -198,10 +218,15 @@ systemctl start icingadb
|
|||
|
||||
### Enable remote Redis connections <a id="remote-redis"></a>
|
||||
|
||||
By default `icingadb-redis` listens only on `127.0.0.1`. If you want to change that (e.g. Icinga Web 2), just change `bind 127.0.0.1 ::1` and `protected-mode yes` in `/etc/icinga-redis/icingadb-redis.conf` to the interface you want to use and `protected-mode no`.
|
||||
By default `icingadb-redis` listens only on `127.0.0.1`. If you want to change that, e.g. for Icinga Web 2 or Icinga 2
|
||||
running on another node, just change `bind 127.0.0.1 ::1` and `protected-mode yes`
|
||||
in `/etc/icingadb-redis/icingadb-redis.conf` to the interface you want to use and to `protected-mode no`.
|
||||
|
||||
> WARNING: Make sure your host is secured by some kind of firewall, if you open Redis to an external interface. Redis, by default, does not have any authentication that prevent others from accessing it.
|
||||
> WARNING: By default, Redis does not have any authentication that prevents others from accessing it.
|
||||
> If you open Redis to an external interface, make sure that you set up appropriate firewall rules or configure TLS
|
||||
> with certificate authentication on Redis and its consumers, i.e. Icinga 2, Icinga DB and Icinga Web 2.
|
||||
|
||||
### Icinga DB Web
|
||||
|
||||
Consult the [Icinga DB Web documentation](https://icinga.com/docs/icingadb/latest/icingadb-web/doc/02-Installation/) on how to connect Icinga Web 2 with Icinga DB.
|
||||
Consult the [Icinga DB Web documentation](https://icinga.com/docs/icingadb/latest/icingadb-web/doc/02-Installation/) on
|
||||
how to connect Icinga Web 2 with Icinga DB.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Overview <a id="configuration-overview"></a>
|
||||
|
||||
The configuration is stored in `/etc/icingadb/icingadb.yml`.
|
||||
The configuration is stored in `/etc/icingadb/config.yml`.
|
||||
See [config.yml.example](../config.yml.example) for an example configuration.
|
||||
|
||||
## Redis Configuration <a id="configuration-redis"></a>
|
||||
|
|
@ -41,7 +41,7 @@ Configuration of the logging component used by Icinga DB.
|
|||
|
||||
Option | Description
|
||||
-------------------------|-----------------------------------------------
|
||||
level | **Optional.** Specifies the default logging level. Can be set to `fatal`, `error`, `warning`, `info` or `debug`. Defaults to `info`.
|
||||
level | **Optional.** Specifies the default logging level. Can be set to `fatal`, `error`, `warn`, `info` or `debug`. Defaults to `info`.
|
||||
output | **Optional.** Configures the logging output. Can be set to `console` (stderr) or `systemd-journald`. If not set, logs to systemd-journald when running under systemd, otherwise stderr.
|
||||
interval | **Optional.** Interval for periodic logging defined as [duration string](#duration-string). Defaults to `"20s"`.
|
||||
options | **Optional.** Map of component name to logging level in order to set a different logging level for each component instead of the default one. See [logging components](#logging-components) for details.
|
||||
|
|
|
|||
21
doc/04-Upgrading.md
Normal file
21
doc/04-Upgrading.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Upgrading Icinga DB <a id="upgrading"></a>
|
||||
|
||||
## Upgrading to Icinga DB RC2
|
||||
|
||||
Icinga DB RC2 is a complete rewrite compared to RC1. Because of this, a lot has changed in the Redis and database
|
||||
schema, which is why they have to be deleted and recreated. The configuration file has changed from `icingadb.ini`
|
||||
to `config.yml`. Instead of the INI format, we are now using YAML and have introduced more configuration options. We
|
||||
have also changed the packages of `icingadb-redis`, which is why the Redis CLI commands are now prefixed with `icingadb`
|
||||
instead of just `icinga`, i.e. the Redis CLI is now accessed via `icingadb-redis-cli`.
|
||||
|
||||
Please follow the steps below to upgrade to Icinga DB RC2:
|
||||
|
||||
1. Stop Icinga 2 and Icinga DB.
|
||||
2. Flush your Redis instances using `icinga-redis-cli flushall` (note the `icinga` prefix as we did not
|
||||
upgrade `icingadb-redis` yet) and stop them afterwards.
|
||||
3. Upgrade Icinga 2 to version 2.13.2 or newer.
|
||||
4. Remove the `icinga-redis` package where installed as it may conflict with `icingadb-redis`.
|
||||
5. Install Icinga DB Redis (`icingadb-redis`) on your primary Icinga 2 nodes to version 6.2.6 or newer.
|
||||
6. Upgrade Icinga DB to RC2.
|
||||
7. Drop the Icinga DB MySQL database and recreate it using the provided schema.
|
||||
8. Start Icinga DB Redis, Icinga 2 and Icinga DB.
|
||||
|
|
@ -39,7 +39,7 @@ type Flags struct {
|
|||
// Version decides whether to just print the version and exit.
|
||||
Version bool `long:"version" description:"print version and exit"`
|
||||
// Config is the path to the config file
|
||||
Config string `short:"c" long:"config" description:"path to config file" required:"true" default:"./config.yml"`
|
||||
Config string `short:"c" long:"config" description:"path to config file" required:"true" default:"/etc/icingadb/config.yml"`
|
||||
}
|
||||
|
||||
// FromYAMLFile returns a new Config value created from the given YAML config file.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type Client struct {
|
|||
// Options define user configurable Redis options.
|
||||
type Options struct {
|
||||
Timeout time.Duration `yaml:"timeout" default:"30s"`
|
||||
MaxHMGetConnections int `yaml:"max_hmget_connections" default:"4096"`
|
||||
MaxHMGetConnections int `yaml:"max_hmget_connections" default:"8"`
|
||||
HMGetCount int `yaml:"hmget_count" default:"4096"`
|
||||
HScanCount int `yaml:"hscan_count" default:"4096"`
|
||||
XReadCount int `yaml:"xread_count" default:"4096"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue