Redis Sentinel did not work correctly when restart

Bug #1788179 reported by Liping Mao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla-ansible
Fix Released
Undecided
Liping Mao

Bug Description

Problem:
Redis Sentinel did not work correctly when restart.

Reproduce:
a). Boot redis and redis sentinel on three controllers.
b). restart redis sentinel container.
c). Check sentinels number increase from 3 to 4.
# redis-cli -h $IP -p 26379
info

# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=kolla,status=ok,address=10.225.26.54:6379,slaves=2,sentinels=4 <-- sentinels should be 3 not 4.

d). if you restart the container again, the sentinels on other node will increase 1 again.
e). In this case, if some redis failed, the cluster will not work properly in take over redis master case.

Root cause:
In the case, we use kolla COPY_ALWAYS, kolla will copy configuration for /etc/redis/redis.conf. But the problem is redis-sentinel will generate a sentinel myid and store it in /etc/redis/redis.conf . The problem is when docker container restart, kolla will overwrite /etc/redis/redis.conf, so it will generate a new sentinel myid, every time when it restarted. In this case, you will see sentinels increase always.
So we can set up sentinel myid in /etc/redis/redis.conf, so that when it restart, it will use same myid.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla-ansible (master)

Reviewed: https://review.openstack.org/594177
Committed: https://git.openstack.org/cgit/openstack/kolla-ansible/commit/?id=735d085bc72ca7cc774c8612ed0d373e018610c5
Submitter: Zuul
Branch: master

commit 735d085bc72ca7cc774c8612ed0d373e018610c5
Author: Liping Mao (limao) <email address hidden>
Date: Tue Aug 21 21:40:29 2018 +0800

    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

Changed in kolla-ansible:
status: New → Fix Released
Liping Mao (limao)
Changed in kolla-ansible:
assignee: nobody → Liping Mao (limao)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla-ansible 7.0.0.0rc1

This issue was fixed in the openstack/kolla-ansible 7.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.