-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentinel #39
base: master
Are you sure you want to change the base?
Sentinel #39
Conversation
Thanks for the patch! I will need to dig into sentinel a bit to fully understand your patch. As to the points you raise, you are right. I will at some point make those changes. |
Hi, sorry for leaving this open forever. As we now know that Sentinel doesn't work very well (http://aphyr.com/posts/283-call-me-maybe-redis) I'll close this pull request. |
Hello Knut, I believe you should reconsider your position, and here is my arguments about why you should. In the article you linked Aphyr shows that Redis instances + Redis sentinel failover is not a consistent system, and that a lot of writes are lost during partitions. This is the main argument you use to don't merge Sentinel support. However there are two important points to examine here.
So the current Redis Sentinel is a complete reimplementation with new algorithms compared to what was examined by Aphyr, and the changes are mainly the following two:
With this changes, you have a clear semantics about how Sentinels propagate changes and agree about performing a failover (TL;DR it is an eventually consistent system where in every given partition the higher configuration version wins, and where majority is required to start a failover). Moreover because you can configure Redis instances to stop accepting writes if there are not specific conditions about replications, you have now an option to limit the write loss to a given window during a network partition, instead of having it unbound. For example, using the right configuration, if a the master gets partitioned away with clients in a minority partition, while the majority partition will promote a new master, the old master will stop accepting writes in the minority partition after some time. You can drop Sentinel and implement your Zookeeper Based failover, and you still will have the same semantics, since the limit is what master-slave + failover + asynchronous replications can give you. But at the same time this is what makes Redis fast and able to support complex data structures. |
It's been a year since this patch was introduced. Based on Redis documentation, Sentinel is the official high availability solution for Redis. Sentinel2 is now the current release and is available with both redis 2.8 & 3.x. Would love to see this go in either as a separate library or integrated into eredis. More and more production redis deployments rely on sentinel to provide client connectivity to the current redis master. |
@mkurkov I'm very interested in this project. Did you ever spin it up as a separate library that depends on |
Hello! As far as I can understand Sentinel logic, things have changed since the time PR was done. Now the logic of Sentinel is much simpler from the perspective of the client, since Redis server just drops connections when it is under Sentinel control and its role changes. Hence, to have Sentinel support we mainly need a some sort of "factory" which we use each time we want connect to Redis. Such a library can be easily implemented as a standalone project; there is also an example of such a library in https://github.com/miros/eredis_sentinel. |
@savonarola can you please explain how to use such library with eredis? {ok, C} = eredis:start_link().
{ok, <<"bar">>} = eredis:q(C, ["GET", "foo"]). How will it work with a factory that is using Sentinel to create the connection? |
Hi, I have added initial support for redis sentinel failover.
I decide to add it to eredis instead of standalone lib, what do you think about it?
For now sentinel is experimental feature but it should be main aproach to monitor redis clusters and many already use it in production.
Also I see some issues with current implementation of eredis:
Thanks.