3

I am trying to setup a high-availability setup where if a server goes down that is hosting my main Redis cache, that it will choose a different master, but I am a little confused after reading through all the documentation about Sentinels.

For instance, if I have a url that I am pointing my Redis Client to: http://my.RedisServer.com:6379, how is the the sentinel helping to failover to another server say at http://mybackup.RedisServer.com:6379?

I am using the ServiceStack.Redis client for .Net and have my Redis installation on a Windows server, but I am thinking in order to get high-availability I have to switch to Linux and use a Twemproxy setup or something? I am guessing I can't just store the http://my.RedisServer.com:6379 in my web.config and have it somehow work right? I imagine somewhere there has to be a DNS that maps to the 2+ IPs and is load-balanced like any H.A. web application...

I think I saw something about a PooledRedisClientManager that might be my answer?

Thanks for the clarification.

Ben Humphrey
  • 588
  • 5
  • 17

2 Answers2

1

I just setup Redis on Windows, one master and one slave, one sentinel per server, the servers are in a cluster enviroment by the ms network load balancer.

So basically what I did was:

Server A: (local IP: 1.10.10.1, cluster ip: 1.10.11.1)

  • Run Redis as Master
  • Run redis as Sentinel watching to Server A

Server B: (local IP: 1.10.10.2, cluster ip: 1.10.11.1)

  • Run Redis as Slave of Server A
  • Run redis as Sentinel watching to Server B

Now the first problem I had was that when I connected to the cluster address, I dont know which server are responding, and I need to connect to the master, because the slave is a readonly (only for failover) so of course HAProxy and Twemproxy is for that, but there is no implementation for windows, so I decided to create a proxy for that purpose:

https://bitbucket.org/israelito3000/redis

So basically I installed the redis-proxy on both servers and now when I connected from my client library the proxy always transmit the package to the master, so it is like a tunnel. When master redis fail, the sentinel automaticaly will change the role of the slave to master and the proxy will redirect the traffic to the new master, so basically from the client I dont need to do anything.

It is important to said that I could not access directly to the servers (only thru the cluster ip)

Israel Garcia
  • 778
  • 7
  • 16
0

I believe I found the answer.

How to tell a Client where the new Redis master is using Sentinel

Apparently you just have to subscribe and listen to events from the Sentinels. Makes sense.. I just figured there was a more streamlined way.

I read something about the Twemproxy for Linux which acts as a proxy and probably does this for you? But I was on redis for Windows and was trying to find a Windows option. We might just moved to Linux if that's the approved way it should be done.

Community
  • 1
  • 1
Ben Humphrey
  • 588
  • 5
  • 17
  • I found the same problem, Twemproxy and HAProxy have the capability to talk with the sentinels to know who is the master, and always redirect the call to the master, unfortunately there is no version of those for windows, that why I created a proxy that do exactly that step, so you only connect to the proxy and he redirect to the master. – Israel Garcia Sep 30 '15 at 18:12