-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Even when specifying sentinels, initial connect requires knowledge of current master #672
Comments
Is |
Actually it's the default from the examples: |
Switching to
Which I'm guessing means it's failing DNS resolution for |
Yes, the name in the first url needs to match, at least until we merge an option to specifiy it separately (at which point the url will not be used at all). Are |
Yeah,
So I guess I'm stuck until #640 gets merged? Renaming the sentinel pod to Thanks for the quick reply. |
Oh damn, I only see it now, you have run into another issue. The following code should work for you: sentinels = [
{ :host => 'redis1', :port => 26379},
{ :host => 'redis2', :port => 26379},
{ :host => 'arbiter', :port => 26379}]
redis = Redis.new(:url => 'redis://mymaster', :sentinels => sentinels, :role => :master) |
Heh. I had actually switched to That code you gave does work for me. Thanks for all your help. |
Pardon me if I've missed something, but it appears that even when connecting to sentinel,
Redis.new()
requires the client to know which redis host is currently the master? This defeats the point of connecting to the sentinels at all.e.g., I have 2 redis hosts on
redis1
andredis2
.redis1
is master,redis2
is slave (and I have a 3rd sentinel instance running on a host namedarbiter
). I connect like:and everything works fine.
However, if failover has occurred and
redis1
andredis2
have swapped their roles as master and slave, if I restart my rails server or boot a new instance, the same connect incantation above yields:Redis::CommandError: READONLY You can't write against a read only slave.
i.e., even though it has connected to the sentinels, it is not aware of the current master instance and attempts to write to the instance specified in the
:url
parameter regardless of the current master/slave configuration.Am I missing something?
The text was updated successfully, but these errors were encountered: