Redis doesn't handle dns names properly

606 views
Skip to first unread message

Anand

unread,
Oct 17, 2016, 1:36:13 AM10/17/16
to Redis DB
When running redis-sentinel with the master redis1 (resolves to 172.21.0.2) and config file

sentinel monitor mymaster redis1 6379 2
bind 0.0.0.0

sentinel rewrites the config on first run and resolves the dns names:

sentinel myid XXX
bind 0.0.0.0
# Generated by CONFIG REWRITE
port 26379
dir "/data"
sentinel monitor mymaster 172.21.0.2 6379 2 <- redis1 dns name resolved
sentinel config-epoch mbn 0
sentinel leader-epoch mbn 0
sentinel known-slave mbn 172.21.0.3 6379 <- redis1 dns name resolved
sentinel current-epoch 0
 .

One of the biggest issues with this is when using containers (Docker, kuberntes), when the cluster restarts (e.g. after power cut), the container might not necessarily be assigned the same ip address as before. Clearly this then requires manual configuration to rewrite the mymaster ip address in all sentinel servers and a manual start. If the containers had a dns name (e.g. consul, skydns on kubernetes), then no manual intervention will be required to restart.

Are there any solutions to this issue?

Could one not just change the redis source code for all ip address structures to be rewritten as interfaces for either an ip address or a domain name, that can be resolved?
 

George Chilumbu

unread,
Oct 18, 2016, 5:24:02 AM10/18/16
to Redis DB
I would advice you against using sentinel. If you are not using a Redis cluster, i would encourage you to do so. 

Otherwise, with the dans issue, maybe you can try to use consul by harchi corp. Thats what we use at my company to access redis via dns queries.

The purpose of us using sentinel is to take advantage of its ability to manage a fail over between master and their replicas in the redis cluster. But since the redis cluster can manage master/slave failover, it is kind of redundant and costly to be usingsentinel in addition.


Our decision to stop using sentinel came about as we found out that it was causing connection problems for clients to connect to the redis servers at random times. I also discovered a weird situation in which one of the slaves turned one master and it's slave both to become its slave. Though cannot confirm for sure, but i suspect sentinel might have played a hand in this weird behavior.

Reply all
Reply to author
Forward
0 new messages