kolla-ansible/ansible/roles/redis/templates/redis-sentinel.conf.j2
Liping Mao (limao) 735d085bc7 Fix redis sentinel change myid every time when it restarted
If you use COPY_ALWAYS, kolla will overwrite /etc/redis/redis.conf.
But Redis Sentinel will store myid in this file. So when it restart,
Redis Sentinel will regenerate new myid every time. Redis Sentinel
cluster will see more and more sentinel, This patch use hash value
with hostname as sentinel myid.

Change-Id: I6d9403231e41baac177f29c58e67ba605795385d
Closes-bug: #1788179
2018-08-23 14:34:28 +08:00

13 lines
602 B
Django/Jinja

{% set redis_master_address = hostvars[groups['redis'][0]]['ansible_' + hostvars[groups['redis'][0]]['api_interface']]['ipv4']['address'] %}
daemonize no
pidfile "/var/run/redis/redis-sentinel.pid"
logfile "/var/log/kolla/redis/redis-sentinel.log"
bind {{ api_interface_address }}
port {{ redis_sentinel_port }}
sentinel myid {{ inventory_hostname | hash('sha1') }}
sentinel monitor kolla {{ redis_master_address }} {{ redis_port }} 2
sentinel auth-pass kolla {{ redis_master_password }}
sentinel down-after-milliseconds kolla 5000
sentinel failover-timeout kolla 60000
sentinel parallel-syncs kolla 1