-
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
Redis::CannotConnectError: No sentinels available. #531
Comments
Renamed master name identifies a group of Redis instances from |
I think the line 496 in @master = @options[:master_name] The current assignment causes def resolve_master
sentinel_detect do |client|
if reply = client.call(["sentinel", "get-master-addr-by-name", @master])
{:host => reply[0], :port => reply[1]}
end
end
end https://github.com/redis/redis-rb/blob/master/lib/redis/client.rb#L556 |
@nguyenductung We should still use the hostname if |
@badboy But if the master name is different from the host name, it'll result in What about @master = @options[:master_name] || @options[:host] ? |
@badboy , yes it was my mistake. Also I found that options hash should contain only symbol keys. I spent a lot of time to find this reason of my issue. I have loaded config from YML file and had a hash with string keys: |
@nguyenductung The good thing: With Sentinel the hostname from that "redis URL" is only used for the master name anyway, so why should it be different? But yes, I can still see having this as an option as useful. Care to submit a PR? |
Restarted it, this is just a not-so-safe test setup right now… |
Looking forward to seeing the associated PR merged. |
why is this issue is closed? problem still not fixed |
shooting in the dark here... looking for a fix: I have the generally the same setup and identical error output as @palexvs: My initializer:
and I know the
It seems that no matter which combination of master_names and other configs, I get |
This is super confusing but here is what you need to do: The Redis URL has to be defined as: @cobyrne09 So for your context, it will be something like:
|
Thank so much @brodock!
|
@cobyrne09 to actually run sentinel you need a password for redis versions |
thanks for the heads up @brodock. Still on 2.8.4, so I will have to deal with that soon enough... |
Correction: you can totally run Sentinels without a password. Just make sure you don't expose them to the internet. |
For reference: adding a |
640: Add new master_name param for sentinel. Fixes #531 r=badboy Associated with issue #531. Based on #534 with the addition of tests. Didn't know how to keep @nguyenductung 's commit sadly but this PR does fix the issue and is tested. 701: Get tests passing with frozen-string-literals enabled. r=badboy This one simple change ensure that all string literals can be frozen (as per the optional feature in MRI 2.3 and onwards). @twalpole has (again) beaten me to such a patch (in #590), though mine (again) does not add the pragma comment to all files. Getting their or my PRs merged in would be excellent :) As an alternative to the pragma comment, I would recommend adding the following to your .travis.yml file to ensure regressions aren't introduced: ```yml before_script: - if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT ``` This will add the flag when the tests are run on MRI 2.4 or newer (while the feature was introduced in 2.3, it doesn't seem to work reliably until 2.4). Please note: tests will currently fail when this flag is set unless test-unit is also updated (as noted in test-unit/test-unit#149).
Hello, I'm trying to setup sentinels, but i get error
Redis::CannotConnectError: No sentinels available
:Error:
But sentinel exists:
The text was updated successfully, but these errors were encountered: