Skip to content

Commit

Permalink
Document wsrep_sync_wait database option
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Mar 26, 2024
1 parent eea3ea5 commit 4a6e3a3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
8 changes: 8 additions & 0 deletions config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ database:
# Database password.
password: CHANGEME

# List of low-level database options that can be set to influence some Icinga DB internal default behaviours.
options:
# Enforce Galera cluster nodes strict cluster-wide causality checks before executing specific SQL queries
# determined by the number you provided. By default, 7 is used, which includes "SELECT,DELETE,INSERT,REPLACE"
# query types and is usually sufficient for running Icinga DB with Galera setups and a database load balancer.
# When you use Galera cluster but don't have a load balancer, you can set this to 0 to disable it completely.
# wsrep_sync_wait: 7

# Connection configuration for the Redis server where Icinga 2 writes its configuration, state and history items.
# This is the same connection as configured in the 'icingadb' feature of the corresponding Icinga 2 node.
# High availability setups require a dedicated Redis server per Icinga 2 node and
Expand Down
33 changes: 20 additions & 13 deletions doc/03-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,26 @@ This is also the database used in
[Icinga DB Web](https://icinga.com/docs/icinga-db-web) to view and work with the data.
In high availability setups, all Icinga DB instances must write to the same database.

| Option | Description |
|----------|--------------------------------------------------------------------------------------------------------|
| type | **Optional.** Either `mysql` (default) or `pgsql`. |
| host | **Required.** Database host or absolute Unix socket path. |
| port | **Optional.** Database port. By default, the MySQL or PostgreSQL port, depending on the database type. |
| database | **Required.** Database name. |
| user | **Required.** Database username. |
| password | **Optional.** Database password. |
| tls | **Optional.** Whether to use TLS. |
| cert | **Optional.** Path to TLS client certificate. |
| key | **Optional.** Path to TLS private key. |
| ca | **Optional.** Path to TLS CA certificate. |
| insecure | **Optional.** Whether not to verify the peer. |
| Option | Description |
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| type | **Optional.** Either `mysql` (default) or `pgsql`. |
| host | **Required.** Database host or absolute Unix socket path. |
| port | **Optional.** Database port. By default, the MySQL or PostgreSQL port, depending on the database type. |
| database | **Required.** Database name. |
| user | **Required.** Database username. |
| password | **Optional.** Database password. |
| tls | **Optional.** Whether to use TLS. |
| cert | **Optional.** Path to TLS client certificate. |
| key | **Optional.** Path to TLS private key. |
| ca | **Optional.** Path to TLS CA certificate. |
| insecure | **Optional.** Whether not to verify the peer. |
| options | **Optional.** List of low-level database options that can be set to influence some Icinga DB internal default behaviours. See [database options](#database-options) for details. |

### Database Options

| Option | Description |
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| wsrep_sync_wait | **Optional.** Enforce Galera cluster nodes strict [cluster-wide](https://mariadb.com/kb/en/galera-cluster-system-variables/#wsrep_sync_wait) causality checks before executing specific SQL queries determined by the number you provided. Defaults to `7`. |

## Logging Configuration

Expand Down
5 changes: 4 additions & 1 deletion pkg/icingadb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ type Options struct {
// The default is 2^13, which in our tests showed the best performance in terms of execution time and parallelism.
MaxRowsPerTransaction int `yaml:"max_rows_per_transaction" default:"8192"`

// WsrepSyncWait defines which kinds of SQL statements catch up all pending sync between nodes first, see:
// WsrepSyncWait enforces Galera cluster nodes strict cluster-wide causality checks
// before executing specific SQL queries determined by the number you provided.
// The default value is 7, which includes "READ,DELETE,INSERT,REPLACE" query types and seems to be sufficient
// for running Icinga DB with Galera setups. Please refer to the below link for a complete list of options.
// https://mariadb.com/kb/en/galera-cluster-system-variables/#wsrep_sync_wait
WsrepSyncWait int `yaml:"wsrep_sync_wait" default:"7"`
}
Expand Down

0 comments on commit 4a6e3a3

Please sign in to comment.