* Alerting: Add support for Redis Sentinel
* docs
* docs
* Use minisentinel in test
* Apply suggestions from code review
Co-authored-by: Johnny Kartheiser <140559259+JohnnyK-Grafana@users.noreply.github.com>
Co-authored-by: Fayzal Ghantiwala <114010985+fayzal-g@users.noreply.github.com>
* "address(es)" -> "address or addresses"
* make update-workspace
* make lint-go-diff
---------
Co-authored-by: Johnny Kartheiser <140559259+JohnnyK-Grafana@users.noreply.github.com>
Co-authored-by: Fayzal Ghantiwala <114010985+fayzal-g@users.noreply.github.com>
# Listen address/hostname and port to receive unified alerting messages for other Grafana instances. The port is used for both TCP and UDP. It is assumed other Grafana instances are also running on the same port. The default value is `0.0.0.0:9094`.
# Listen address/hostname and port to receive unified alerting messages for other Grafana instances. The port is used for both TCP and UDP. It is assumed other Grafana instances are also running on the same port. The default value is `0.0.0.0:9094`.
@ -67,7 +67,7 @@ For a demo, see this [example using Docker Compose](https://github.com/grafana/a
## Enable alerting high availability using Redis
## Enable alerting high availability using Redis
As an alternative to Memberlist, you can configure Redis to enable high availability. Only **Redis Server** and **Redis Cluster** modes are supported.
As an alternative to Memberlist, you can configure Redis to enable high availability. Redis standalone, Redis Cluster and Redis Sentinel modes are supported.
{{% admonition type="note" %}}
{{% admonition type="note" %}}
@ -77,8 +77,11 @@ Memberlist is the preferred option for high availability. Use Redis only in envi
1. Make sure you have a Redis server that supports pub/sub. If you use a proxy in front of your Redis cluster, make sure the proxy supports pub/sub.
1. Make sure you have a Redis server that supports pub/sub. If you use a proxy in front of your Redis cluster, make sure the proxy supports pub/sub.
1. In your custom configuration file ($WORKING_DIR/conf/custom.ini), go to the `[unified_alerting]` section.
1. In your custom configuration file ($WORKING_DIR/conf/custom.ini), go to the `[unified_alerting]` section.
1. Set `ha_redis_address` to the Redis server address Grafana should connect to.
1. Set `ha_redis_address` to the Redis server address or addresses Grafana should connect to. It can be a single Redis address if using Redis standalone, or a list of comma-separated addresses if using Redis Cluster or Sentinel.
1. Optional: Set `ha_redis_cluster_mode_enabled` to `true` if you are using Redis Cluster.
1. Optional: Set `ha_redis_sentinel_mode_enabled` to `true` if you are using Redis Sentinel. Also set `ha_redis_sentinel_master_name` to the Redis Sentinel master name.
1. Optional: Set the username and password if authentication is enabled on the Redis server using `ha_redis_username` and `ha_redis_password`.
1. Optional: Set the username and password if authentication is enabled on the Redis server using `ha_redis_username` and `ha_redis_password`.
1. Optional: Set the username and password if authentication is enabled on Redis Sentinel using `ha_redis_sentinel_username` and `ha_redis_sentinel_password`.
1. Optional: Set `ha_redis_prefix` to something unique if you plan to share the Redis server with multiple Grafana instances.
1. Optional: Set `ha_redis_prefix` to something unique if you plan to share the Redis server with multiple Grafana instances.
1. Optional: Set `ha_redis_tls_enabled` to `true` and configure the corresponding `ha_redis_tls_*` fields to secure communications between Grafana and Redis with Transport Layer Security (TLS).
1. Optional: Set `ha_redis_tls_enabled` to `true` and configure the corresponding `ha_redis_tls_*` fields to secure communications between Grafana and Redis with Transport Layer Security (TLS).
1. Set `[ha_advertise_address]` to `ha_advertise_address = "${POD_IP}:9094"` This is required if the instance doesn't have an IP address that is part of RFC 6890 with a default route.
1. Set `[ha_advertise_address]` to `ha_advertise_address = "${POD_IP}:9094"` This is required if the instance doesn't have an IP address that is part of RFC 6890 with a default route.
@ -1771,19 +1771,40 @@ The interval string is a possibly signed sequence of decimal numbers, followed b
#### `ha_redis_address`
#### `ha_redis_address`
The Redis server address that should be connected to.
Redis server address or addresses. It can be a single Redis address if using Redis standalone,
or a list of comma-separated addresses if using Redis Cluster/Sentinel.
{{<admonitiontype="note">}}
{{<admonitiontype="note">}}
For more information on Redis, refer to [Enable alerting high availability using Redis](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/alerting/set-up/configure-high-availability/#enable-alerting-high-availability-using-redis).
For more information on Redis, refer to [Enable alerting high availability using Redis](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/alerting/set-up/configure-high-availability/#enable-alerting-high-availability-using-redis).
{{</admonition>}}
{{</admonition>}}
#### `ha_redis_cluster_mode_enabled`
Set to `true` when using Redis in Cluster mode. Mutually exclusive with `ha_redis_sentinel_mode_enabled`.
#### `ha_redis_sentinel_mode_enabled`
Set to `true` when using Redis in Sentinel mode. Mutually exclusive with `ha_redis_cluster_mode_enabled`.
#### `ha_redis_sentinel_master_name`
Redis Sentinel master name. Only applicable when `ha_redis_sentinel_mode_enabled` is set to `true`.
#### `ha_redis_username`
#### `ha_redis_username`
The username that should be used to authenticate with the Redis server.
The username that should be used to authenticate with Redis.
#### `ha_redis_password`
#### `ha_redis_password`
The password that should be used to authenticate with the Redis server.
The password that should be used to authenticate with Redis.
#### `ha_redis_sentinel_username`
The username that should be used to authenticate with Redis Sentinel. Only applicable when `ha_redis_sentinel_mode_enabled` is set to `true`.
#### `ha_redis_sentinel_password`
The password that should be used to authenticate with Redis Sentinel. Only applicable when `ha_redis_sentinel_mode_enabled` is set to `true`.
#### `ha_redis_db`
#### `ha_redis_db`
@ -1791,7 +1812,7 @@ The Redis database. The default value is `0`.
#### `ha_redis_prefix`
#### `ha_redis_prefix`
A prefix that is used for every key or channel that is created on the Redis server as part of HA for alerting.
A prefix that is used for every key or channel that is created on the Redis server as part of HA for alerting. Useful if you plan to share Redis with multiple Grafana instances.
#### `ha_redis_peer_name`
#### `ha_redis_peer_name`
@ -1801,6 +1822,38 @@ The name of the cluster peer to use as an identifier. If none is provided, a ran
The maximum number of simultaneous Redis connections.
The maximum number of simultaneous Redis connections.
#### `ha_redis_tls_enabled`
Enable TLS on the client used to communicate with the Redis server. This should be set to `true` if using any of the other `ha_redis_tls_*` fields.
#### `ha_redis_tls_cert_path`
Path to the PEM-encoded TLS client certificate file used to authenticate with the Redis server. Required if using Mutual TLS.
#### `ha_redis_tls_key_path`
Path to the PEM-encoded TLS private key file. Also requires the client certificate to be configured. Required if using Mutual TLS.
#### `ha_redis_tls_ca_path`
Path to the PEM-encoded CA certificates file. If not set, the host's root CA certificates are used.
#### `ha_redis_tls_server_name`
Overrides the expected name of the Redis server certificate.
Listen IP address and port to receive unified alerting messages for other Grafana instances. The port is used for both TCP and UDP. It is assumed other Grafana instances are also running on the same port. The default value is `0.0.0.0:9094`.
Listen IP address and port to receive unified alerting messages for other Grafana instances. The port is used for both TCP and UDP. It is assumed other Grafana instances are also running on the same port. The default value is `0.0.0.0:9094`.