Skip to content

Commit

Permalink
Add resolve-hostnames support for Sentinel
Browse files Browse the repository at this point in the history
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 <hostname> and sentinel announce-ip <hostname> for all Redis and Sentinel instances,
respectively.

Cf. https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/#ip-addresses-and-dns-names
  • Loading branch information
loliee committed Jun 29, 2024
1 parent 51b0dff commit bc456e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions templates/redis_sentinel.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit bc456e5

Please sign in to comment.