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 sentinel_bind to bind sentinel to different IPs #306

Merged
merged 1 commit into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ suites:
sentinels:
-
name: 'cluster'
sentinel_bind: 0.0.0.0
sentinel_port: 26379
masters:
-
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ The sentinel recipe's use their own attribute file.
```
'user' => 'redis',
'configdir' => '/etc/redis',
'sentinel_bind' => nil,
'sentinel_port' => 26379,
'monitor' => nil,
'down-after-milliseconds' => 30000,
Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
chef.json = {
'redisio' => {
'sentinels' => [
{'sentinel_port' => 26379, 'name' => 'redisio', 'master_ip' => '192.168.50.5', 'master_port' => '6379'}
{'sentinel_bind' => '0.0.0.0', 'sentinel_port' => 26379, 'name' => 'redisio', 'master_ip' => '192.168.50.5', 'master_port' => '6379'}
]
}
}
Expand Down
1 change: 1 addition & 0 deletions attributes/redis_sentinel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
default['redisio']['sentinel_defaults'] = {
'user' => 'redis',
'configdir' => config_dir,
'sentinel_bind' => nil,
'sentinel_port' => 26379,
'monitor' => nil,
'down-after-milliseconds' => 30000,
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Installs/Configures redis'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.5.0'
version '2.5.1'

%w(
amazon
Expand Down
1 change: 1 addition & 0 deletions providers/sentinel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def configure
name: current['name'],
piddir: piddir,
job_control: node['redisio']['job_control'],
sentinel_bind: current['sentinel_bind'],
sentinel_port: current['sentinel_port'],
loglevel: current['loglevel'],
logfile: current['logfile'],
Expand Down
4 changes: 4 additions & 0 deletions templates/default/sentinel.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ syslog-ident redis-<%= @name %>
syslog-facility <%= @syslogfacility %>
<%= "logfile #{@logfile}" unless @logfile.nil? %>

# bind sentinel IP
<% if @sentinel_bind %>
bind <%=@sentinel_bind%>
<% end %>
# port <sentinel-port>
# The port that this sentinel instance will run on
port <%=@sentinel_port%>
Expand Down
2 changes: 2 additions & 0 deletions test/unit/spec/sentinel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
chef_run = ChefSpec::SoloRunner.new do |node|
node.set['redisio']['sentinels'] = [
{
'sentinel_bind' => '0.0.0.0',
'sentinel_port' => '1234',
'name' => 'sentinel-test-params',
'master_ip' => '5.6.7.8',
Expand All @@ -46,6 +47,7 @@
expect(chef_run).to run_redisio_sentinel('redis-sentinels').with(
sentinels: [
{
'sentinel_bind' => '0.0.0.0',
'sentinel_port' => '1234',
'name' => 'sentinel-test-params',
'master_ip' => '5.6.7.8',
Expand Down