From bc456e52c2dd625168a0ad7a6eee8a78272f6599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Loli=C3=A9e?= Date: Sat, 29 Jun 2024 19:53:28 +0200 Subject: [PATCH] Add resolve-hostnames support for Sentinel Starting with version 6.2, Sentinel has optional support for host names. This capability is disabled by default. If you're going to enable DNS/hostnames support, please note: 1. The name resolution configuration on your Redis and Sentinel nodes must be reliable and be able to resolve addresses quickly. Unexpected delays in address resolution may have a negative impact on Sentinel. 2. You should use hostnames everywhere and avoid mixing hostnames and IP addresses. To do that, use replica-announce-ip and sentinel announce-ip for all Redis and Sentinel instances, respectively. Cf. https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/#ip-addresses-and-dns-names --- README.md | 1 + defaults/main.yml | 1 + templates/redis_sentinel.conf.j2 | 2 ++ 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index e16891de..f99a8cb8 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,7 @@ redis_sentinel_password: false redis_sentinel_pidfile: /var/run/redis/sentinel_{{ redis_sentinel_port }}.pid redis_sentinel_logfile: '""' redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }} +redis_sentinel_resolve_hostnames: no redis_sentinel_monitors: - name: master01 host: localhost diff --git a/defaults/main.yml b/defaults/main.yml index dfc8956d..e914df28 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -130,6 +130,7 @@ redis_sentinel_pidfile: /var/run/redis/sentinel_{{ redis_sentinel_port }}.pid redis_sentinel_logfile: '""' redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }} redis_sentinel_oom_score_adjust: 0 +redis_sentinel_resolve_hostnames: no redis_sentinel_monitors: - name: master01 host: localhost diff --git a/templates/redis_sentinel.conf.j2 b/templates/redis_sentinel.conf.j2 index 2fc59390..835012bd 100644 --- a/templates/redis_sentinel.conf.j2 +++ b/templates/redis_sentinel.conf.j2 @@ -8,6 +8,8 @@ pidfile {{ redis_sentinel_pidfile }} port {{ redis_sentinel_port }} bind {{ redis_sentinel_bind }} +sentinel resolve-hostnames {{ redis_sentinel_resolve_hostnames }} + # Security {% if redis_sentinel_password %} requirepass {{ redis_sentinel_password }}