-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 Support Derived from pr-692 #1067
Conversation
Initial pass at adding Sentinel support. Adds ConnectionMultiplexer that is managed by a set of Sentinel servers. Usage: ```C# ConfigurationOptions sentinelConfig = new ConfigurationOptions(); sentinelConfig.ServiceName = "ServiceNameValue"; sentinelConfig.EndPoints.Add("127.0.0.1", 26379); sentinelConfig.EndPoints.Add("127.0.0.2", 26379); sentinelConfig.EndPoints.Add("127.0.0.4", 26379); sentinelConfig.TieBreaker = ""; sentinelConfig.DefaultVersion = new Version(3, 0); // Add the configuration for the masters that we will connect to ConfigurationOptions masterConfig = new ConfigurationOptions(); sentinelConfig.SentinelMasterConfignfigurationOptions = mo; // Connect! ConnectionMultiplexer sentinelConnection = ConnectionMultiplexer.Connect(sentinelConfig); // When we need to perform a command against the masters, use the master connection sentinelConnection.SentinelMasterConnection.GetDatabase().MyCommand(); ``` Sentinel Support - Second Draft Modified approach to allow for a sentinel-only setup with the option of requesting a connection to a master managed by the sentinel connection. Can also support multiple services on the same sentinel. Handle closed managed connections Add some basic handling for disposed connections that are managed by the Sentinel connection.
Need some help, noob here. Downloaded the code and built it and added reference to Redis.Stackexchange.dll to my own project. I am not able to see GetSentinelMasterConnection method. What am I doing wrong? Any help would be greatly appreciated. |
Please ensure that you are follow the example usage from commit conv.
On Thu, Feb 28, 2019 at 18:30 kooldude2010 ***@***.***> wrote:
Need some help, noob here. Downloaded the code and built it and added
reference to Redis.Stackexchange.dll to my own project. I am not able to
see GetSentinelMasterConnection method. What am I doing wrong?
Any help would be greatly appreciated.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1067 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABF7Dqh-oa_5E1HF4XJMTTa37D9mL-Yjks5vSAQ0gaJpZM4bIQzt>
.
--
*Shadi MassalhaEmail: sm@ <shady.massalha@gmail.com>apps.mygbiz.com
<http://apps.mygbiz.com>Skype: shadi.massalhaMobile #: +972-52-553-4466Fax
#: +972-73-726-7768*
|
I am finding with this PR that redis slaves are never used, even when requests are set to prefer them. Digging through the code it appears that slaves are never added to the |
- modify to use new class LogProxy with pr-1067 code
@mgravell any chance you got to review it? |
…ConnectionMultiplexer area. adding new sentinel instance to be comply with the recommended sentinel configuration.
var Server = sentinelConnection.GetServer(<any sentinel ip>, <port>);
var slaves = Server.SentinelSlaves(ServiceName);
var config = new ConfigurationOptions
{
TieBreaker = "";
ServiceName = TestConfig.Current.SentinelSeviceName,
SyncTimeout = 5000
};
foreach(var kv in slaves)
{
config.EndPoints.Add(kv.ToDictionary()["name"]);
}
var readonlyConn = ConnectionMultiplexer.Connect(config); I had added a new unit test for the above case see ReadOnlyConnectionSlavesTest. |
# Conflicts: # tests/StackExchange.Redis.Tests/Sentinel.cs
And shouldn't there also be |
Regarding slaves and
I seem to fail to grasp the idea. Can you elaborate how this is envisioned to be used?
Using |
I agree it's easy to add the slaves also in the GetSentinelMasterConnection but, I am not sure if this match the Redis client design. because GetSentinelMasterConnection should point to the master only. anyway, I will examine if its correct to do this change in GetSentinelMasterConnection or create a new method GetSentinelSlaveConnection. |
Should we discuss this here or under #692? I come from a place where we used Redis Cluster and that is more or less transparent for this client. You throw at it all the cluster nodes and it "just works." Even with Sentinel when you point the client at Redis nodes (those Sentinel managed) it works until there is some Sentinel action. And the connection multiplexer very much understands which nodes are masters and which are slaves and sends commands according to Also what #692 (and by extension you) is doing amounts to a breaking change. With this Sentinel support (through |
…ent that sentinel should response to info command) add Sentinel Masters command to setup connection instead using info command.
I would love to see this working in the near future. Is there something I can do to make this happen soon? |
@mgravell is anything blocking this PR? |
@gkorland Yep - there's still zero testing on any of the Sentinel bits thus far - it's not something we use or prioritize, so it especially needs testing. It's something we've brought up in all the other Sentinel PRs thus far. |
but, we have completed the missing testing. |
@shadim Ah indeed! I completely missed this from being collapsed - let me try and pull this local and remedy a few things :) It'll need Marc's eyes as well but let me get tests in shape on Linux, master merged, etc. - let's see if I can push to that branch... |
@NickCraver no in my local environment I get all the test pass, I think you are right this because of bad assumptions in the tests of "clean slate" |
I would like to contribute, but did not manage to make the solution work on Linux and from what I've read in the documentation testing is only supported on Windows in general. |
I'd like to contribute on this too, if you need any help. I looked at the tests, and there is no assumption of who is the master or the slave server. @NickCraver Maybe the output of the servers will help you determine what is the exact problem of the failures. |
@NickCraver is this still alive? Can I help with something to get things done? |
I've been trying to get tests on CI stable (including getting an upgrade to our CI plan) - now trying consistent builds here. I'm also testing some community contributions on Docker to get a clean slate test environment more readily available for all. I've got CI mostly green now which was the hard part - kicking builds here and trying to pull in the Docker approach as another testing method on any platform for all. That'll make this much easier to solve...the changing state on local machines makes this cluster state-dependent type of PR especially hard to determine flakiness of (it's likely my cluster). |
@NickCraver I'm having a really hard time trying to create a clean set of changes ahead of this PR for the docker support. I have a fork based on https://github.com/shadim/StackExchange.Redis that I have made changes to here: https://github.com/ejsmith/StackExchange.Redis My git skills are failing me. It seems like this entire PR isn't a ton of changes and it would be nice to have a clean PR with minimal changes rebased onto your current master, but I haven't been able to figure out how to do that without just doing a diff and creating a brand new PR. |
I created this PR to the PR. :-) shadim#3 |
Found while fixing up runs for #1067. Docker layer cache sucks :)
Found while fixing up runs for #1067. Docker layer cache sucks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting this in for the 2.1.x release, thanks for the work here everyone! We've got more testing in, Docker ability to test this locally better, and are generally in a good state. We can make more refinements here as needed.
Were the "transparency issues" raised by @mrmartan addressed? |
Yes; there's a new build on myget. We've been dogfooding it at Stack
Overflow without problem. We'll probably push it to nuget on Monday.
…On Sun, 29 Mar 2020, 18:16 Gunnar Liljas, ***@***.***> wrote:
Were the "transparency issues raised" by @mrmartan
<https://github.com/mrmartan> addressed?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1067 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMEOBQSDW4MVABDDNE3RJ567HANCNFSM4GZBBTWQ>
.
|
Is this the right way to configure sentinels? I'm quite confused as i see this in the documentation:
My specific problem: |
When you call |
Indeed! thanks! |
This PR is derived from PR-692 and have been merged with the latest master commit.
Things that have been done:
Usage: