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

Various Sentinel fixes #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions manifests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# Copyright 2013 Felipe Salum, unless otherwise noted.
#
class redis::sentinel (
$conf_bind = '0.0.0.0',
$conf_port = '26379',
$conf_daemonize = 'yes',
$sentinel_confs = [],
Expand All @@ -47,6 +48,7 @@
$service_restart = true,
$manage_upstart_scripts = true,
$package_name = undef,
$package_ensure = 'present',
) {

include redis::sentinel_params
Expand Down Expand Up @@ -123,9 +125,7 @@
exec { "cp ${conf_sentinel_orig} ${conf_sentinel}":
path => '/bin:/usr/bin:/sbin:/usr/sbin',
refreshonly => true,
user => redis,
group => redis,
notify => Service['sentinel'],
notify => Service['sentinel'],
require => File[$conf_sentinel],
}

Expand Down
15 changes: 11 additions & 4 deletions templates/sentinel.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ pidfile <%= @conf_pidfile_real %>
port <%= @conf_port %>
<%- end -%>

# If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for incoming connections.
#
# bind 127.0.0.1
<%- if @conf_bind -%>
bind <%= @conf_bind %>
<%- end -%>

# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
Expand Down Expand Up @@ -134,7 +142,7 @@ sentinel <%= key %> <%= master %> <%= @sentinel_confs[master][key] %>
# NOTIFICATION SCRIPT
#
# sentinel notification-script <master-name> <script-path>
#
#
# Call the specified notification script for any sentinel event that is
# generated in the WARNING level (for instance -sdown, -odown, and so forth).
# This script should notify the system administrator via email, SMS, or any
Expand All @@ -158,14 +166,14 @@ sentinel <%= key %> <%= master %> <%= @sentinel_confs[master][key] %>
# When the master changed because of a failover a script can be called in
# order to perform application-specific tasks to notify the clients that the
# configuration has changed and the master is at a different address.
#
#
# The following arguments are passed to the script:
#
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
#
# <state> is currently always "failover"
# <role> is either "leader" or "observer"
#
#
# The arguments from-ip, from-port, to-ip, to-port are used to communicate
# the old address of the master and the new address of the elected slave
# (now a master).
Expand All @@ -175,4 +183,3 @@ sentinel <%= key %> <%= master %> <%= @sentinel_confs[master][key] %>
# Example:
#
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh

1 change: 1 addition & 0 deletions tests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}

class { 'redis::sentinel':
conf_bind => '127.0.0.1',
conf_port => '26379',
sentinel_confs => {
'mymaster' => {
Expand Down