Skip to content
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

Add new master_name param for sentinel. Fixes #531 #640

Closed
wants to merge 4 commits into from

Conversation

BookOfGreg
Copy link

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.

@BookOfGreg
Copy link
Author

Hi team,
All builds in Travis passed except JRuby9.0.5 on unstable.
https://travis-ci.org/redis/redis-rb/jobs/168656998
Seems like it failed with something to do with the redis_mock method. Am I using it incorrectly in my test?

@Dahie
Copy link

Dahie commented Oct 19, 2016

I just discovered the same issue and was about to file a similar pull request. Thanks for coming up with a solution already. :) I'd be very happy to see this merged.

@ac-astuartkregor
Copy link

Until this is merged, due to the nature of the issue, does this mean that sentinels must be installed on the same host as the redis master?

@Dahie
Copy link

Dahie commented Oct 19, 2016

In the configuration for each sentinel you define the address and port of the master and assign it a name. Right now the redis gem assumes this name is the same as the host name.

@finger-berlin
Copy link

Hi, this param is critical to make the gem work with sentinel, because the hostnames/ip addresses (should) have no relation to the master-name (http://redis.io/topics/sentinel). So +1(!). Thanks.

@ac-astuartkregor
Copy link

@Dahie The master name is assumed to be the same as the hostname of the redis master or the hostname of the sentinel? As far as I can tell, you connect to one or more sentinels using the host: parameter and then it assumes that the name of the cluster, as defined in the redis sentinel config is the same as the host: parameter, which I am assuming is the/a sentinel host.

@Dahie
Copy link

Dahie commented Oct 19, 2016

@ac-astuartkregor The gem currently assumes the master name is the same as the host the master redis is running on.

@ac-astuartkregor
Copy link

@Dahie Huh, I tried that and it barfed, so perhaps I messed up something else as well.

@BookOfGreg
Copy link
Author

BookOfGreg commented Oct 19, 2016

We're using redis with the following conf.
We've named our redis in sentinel to 'redis_queue' for the eventuality we add 'redis_cache' later
Works great :)

Sidekiq.configure_server do |config|
  config.redis = {
    sentinels: [
      { host: "queue.example.com", port: 26379 }
    ],
    failover_reconnect_timeout: 20,
    master_name: 'redis_queue'
  }
end

remember the configure_client part also

@BookOfGreg
Copy link
Author

Ping. Is this repo still maintained?

@BookOfGreg
Copy link
Author

I thought merging in master would help but turns out master currently fails the build also.

@badboy
Copy link
Contributor

badboy commented Feb 6, 2017

Yey for flaky tests. That's a known issue with current Redis and unrelated to this PR.

@finger-berlin
Copy link

Ping... any news here?

@BookOfGreg
Copy link
Author

Looks like master still fails with Redis Unstable, meaning no PRs are being merged in this project until sorted?
https://travis-ci.org/redis/redis-rb

@BookOfGreg
Copy link
Author

BookOfGreg commented Jul 7, 2017

Ping @badboy

Is there anything left for me to do to get this into a mergeable state?

@badboy badboy self-assigned this Jul 7, 2017
@badboy
Copy link
Contributor

badboy commented Jul 7, 2017

Nah, I just didn't spend any time on this project in the last months. I try to catch up.

@badboy
Copy link
Contributor

badboy commented Jul 15, 2017

@BookOfGreg could you add a line for this new option to the client documentation?

@badboy
Copy link
Contributor

badboy commented Jul 17, 2017

bors r+

@BookOfGreg
Copy link
Author

Great catch, thank you!
I chose the words on the documentation line carefully so googling them is likely to come up with the sentinel monitor docs:

screen shot 2017-07-17 at 09 09 45

screen shot 2017-07-17 at 09 09 25

not-a-robot bot added a commit that referenced this pull request Jul 17, 2017
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).
@BookOfGreg BookOfGreg closed this Nov 3, 2017
@sesposito
Copy link

sesposito commented Jul 1, 2019

@BookOfGreg hey, why was this PR closed and never merged, is there another way to pass the master_name into the configurations?

EDIT:
Figured out this works: #531 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants