From 735d085bc72ca7cc774c8612ed0d373e018610c5 Mon Sep 17 00:00:00 2001 From: "Liping Mao (limao)" Date: Tue, 21 Aug 2018 21:40:29 +0800 Subject: [PATCH] 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 --- ansible/roles/redis/templates/redis-sentinel.conf.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/roles/redis/templates/redis-sentinel.conf.j2 b/ansible/roles/redis/templates/redis-sentinel.conf.j2 index 0e034e9a33..efe719b107 100644 --- a/ansible/roles/redis/templates/redis-sentinel.conf.j2 +++ b/ansible/roles/redis/templates/redis-sentinel.conf.j2 @@ -4,6 +4,7 @@ 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