Skip to content

Commit 305d331

Browse files
committed
Add resolve-hostnames support for Sentinel
Starting with version 6.2, Sentinel has optional support for host names. Cf. https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/#ip-addresses-and-dns-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 <hostname> and sentinel announce-ip <hostname> for all Redis and Sentinel instances, respectively.
1 parent 51b0dff commit 305d331

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ redis_sentinel_password: false
309309
redis_sentinel_pidfile: /var/run/redis/sentinel_{{ redis_sentinel_port }}.pid
310310
redis_sentinel_logfile: '""'
311311
redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }}
312+
redis_sentinel_resolve_hostnames: no
312313
redis_sentinel_monitors:
313314
- name: master01
314315
host: localhost

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ redis_sentinel_pidfile: /var/run/redis/sentinel_{{ redis_sentinel_port }}.pid
130130
redis_sentinel_logfile: '""'
131131
redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }}
132132
redis_sentinel_oom_score_adjust: 0
133+
redis_sentinel_resolve_hostnames: no
133134
redis_sentinel_monitors:
134135
- name: master01
135136
host: localhost

templates/redis_sentinel.conf.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ pidfile {{ redis_sentinel_pidfile }}
88
port {{ redis_sentinel_port }}
99
bind {{ redis_sentinel_bind }}
1010

11+
sentinel resolve-hostnames {{ redis_sentinel_resolve_hostnames }}
12+
1113
# Security
1214
{% if redis_sentinel_password %}
1315
requirepass {{ redis_sentinel_password }}

0 commit comments

Comments
 (0)