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 redis multi instance monitor support for redis-sentinel #356

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e85b6e8
Merge pull request #1 from voxpupuli/master
basti-nis May 5, 2020
facd408
add multi instance support for redis-sentinel
basti-nis May 5, 2020
c87be32
add multi instance support to sentinel
basti-nis May 5, 2020
a4d1b5b
set auth_pass to optional / spec changed
basti-nis May 5, 2020
dc95a13
fix sentinel spec
basti-nis May 5, 2020
c4230cf
TGTIT: Thx god there is Travis
basti-nis May 5, 2020
4744ae6
delete doubled auth_pass in type
basti-nis May 5, 2020
deb4075
close the given hash
basti-nis May 5, 2020
68f44c4
accidently added folder with wrong name
basti-nis May 5, 2020
1a4e9b6
fix closing class in acceptance test
basti-nis May 5, 2020
7e811fc
add parameter to fix full cover test
basti-nis May 5, 2020
dafbd47
fix redis_sentinel_spec
basti-nis May 5, 2020
c213e88
fix travis
basti-nis May 5, 2020
fef0597
new variable name / puppet strings
basti-nis May 6, 2020
c09d1ff
catch basic inclusion, dunno why it was run away
basti-nis May 6, 2020
d5482b4
confused about puppet strings
basti-nis May 6, 2020
e6d9cef
finishing sentinel instance monitor
basti-nis May 6, 2020
7846856
fix intending
basti-nis May 6, 2020
7f53eb9
Delete redis-sentinel.conf_master.epp
basti-nis May 6, 2020
2bc9ccf
fix acceptance check
basti-nis May 6, 2020
041ba16
defaults, merge fix
basti-nis May 7, 2020
b368f80
fix trailing comma
basti-nis May 7, 2020
38d19eb
some improvements suggested from ekohl
basti-nis Jun 4, 2020
b2e1a9e
fix trailing comma
basti-nis Jun 4, 2020
9d60184
fix defaults
basti-nis Jun 4, 2020
b36cc11
remove concat
basti-nis Nov 9, 2020
444933e
adding diffs from master
basti-nis Nov 9, 2020
e31e457
fixing spec
basti-nis Nov 9, 2020
4844efb
Merge branch 'master' into master
basti-nis Nov 9, 2020
bd0ae2e
remove remaining concat code
basti-nis Nov 9, 2020
ad146c9
readd comments
basti-nis Nov 9, 2020
0bf57f0
double param comment removed
basti-nis Nov 9, 2020
dc15fb9
remove dead parameter
basti-nis Nov 9, 2020
a688036
revert from ensure => present to file
basti-nis Nov 9, 2020
184ccdd
remove empty row
basti-nis Nov 9, 2020
88434c1
revert content to $conf_template
basti-nis Nov 9, 2020
170269a
there should be a single space or newline before a closing brace
basti-nis Nov 9, 2020
7298967
fix unit tests
basti-nis Nov 10, 2020
1e1e552
delete comma at the end of hash
basti-nis Nov 10, 2020
a8a20b7
protected mode failure workaround
basti-nis Nov 10, 2020
484ce19
fix syntax error in spec
basti-nis Nov 10, 2020
0fa0889
fix template and spec test
basti-nis Nov 10, 2020
3894fa4
fix duplicate entrys
basti-nis Nov 10, 2020
f417d65
add protected mode support
basti-nis Nov 10, 2020
204b844
fix spec test and protected mode
basti-nis Nov 10, 2020
e809d0a
minimum_version should be private
basti-nis Nov 10, 2020
38394bb
Merge pull request #2 from basti-nis/hotfix/protected_mode_fix
basti-nis Nov 10, 2020
d2d9bcc
remove comments
basti-nis Nov 10, 2020
eed6b76
add missing traling comma after last element
basti-nis Nov 11, 2020
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
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@ With adjustments:

```puppet
class { '::redis::sentinel':
master_name => 'cow',
redis_host => '192.168.1.5',
failover_timeout => 30000,
sentinel_monitor => {
'cow' => {
'redis_host' => '192.168.1.5',
'redis_port' => 6379,
'quorum' => 2,
'parallel_sync' => 1,
'down_after' => 6000,
'failover_timeout' => 30000,
},
},
}
```

Expand Down
138 changes: 53 additions & 85 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ repositories.
### Data types

* [`Redis::LogLevel`](#redisloglevel): Specify the server verbosity level.
* [`Redis::RedisUrl`](#redisredisurl)
* [`Redis::RedisUrl`](#redisredisurl):
* [`Redis::SentinelMonitor`](#redissentinelmonitor):

### Tasks

Expand Down Expand Up @@ -974,32 +975,44 @@ Install redis-sentinel

#### Examples

##### Basic inclusion

```puppet
include redis::sentinel
```

##### Configuring options

```puppet
class {'redis::sentinel':
down_after => 80000,
log_file => '/var/log/redis/sentinel.log',
}
sentinel_monitor => {
'session' => {
redis_host => $redis_master_ip,
redis_port => 6381,
quorum => 2,
parallel_sync => 1,
down_after => 5000,
failover_timeout => 12000,
auth_pass => $redis_auth,
},
'cache' => {
redis_host => $redis_master_ip,
redis_port => 6380,
quorum => 2,
parallel_sync => 1,
down_after => 5000,
failover_timeout => 12000,
auth_pass => $redis_auth,
}
}
```

#### Parameters

The following parameters are available in the `redis::sentinel` class.

##### `auth_pass`
##### `sentinel_monitor`

Data type: `Optional[String[1]]`
Data type: `Redis::SentinelMonitor`

The password to use to authenticate with the master and slaves.
Specify the sentinel monitor.

Default value: ``undef``
Default value: $redis::params::sentinel_monitor

##### `config_file`

Expand Down Expand Up @@ -1045,24 +1058,6 @@ Have Redis sentinel run as a daemon.

Default value: `$redis::params::sentinel_daemonize`

##### `down_after`

Data type: `Integer[1]`

Number of milliseconds the master (or any attached slave or sentinel)
should be unreachable (as in, not acceptable reply to PING, continuously,
for the specified period) in order to consider it in S_DOWN state.

Default value: `30000`

##### `failover_timeout`

Data type: `Integer[1]`

Specify the failover timeout in milliseconds.

Default value: `180000`

##### `init_script`

Data type: `Optional[Stdlib::Absolutepath]`
Expand All @@ -1087,31 +1082,6 @@ Specify how much we should log.

Default value: `'notice'`

##### `master_name`

Data type: `String[1]`

Specify the name of the master redis server.
The valid charset is A-z 0-9 and the three characters ".-_".

Default value: `'mymaster'`

##### `redis_host`

Data type: `Stdlib::Host`

Specify the bound host of the master redis server.

Default value: `'127.0.0.1'`

##### `redis_port`

Data type: `Stdlib::Port`

Specify the port of the master redis server.

Default value: `6379`

##### `package_name`

Data type: `String[1]`
Expand All @@ -1128,15 +1098,6 @@ Do we ensure this package.

Default value: `'present'`

##### `parallel_sync`

Data type: `Integer[0]`

How many slaves can be reconfigured at the same time to use a
new master after a failover.

Default value: `1`

##### `pid_file`

Data type: `Stdlib::Absolutepath`
Expand All @@ -1145,15 +1106,6 @@ If sentinel is daemonized it will write its pid at this location.

Default value: `$redis::params::sentinel_pid_file`

##### `quorum`

Data type: `Integer[1]`

Number of sentinels that must agree that a master is down to
signal sdown state.

Default value: `2`

##### `sentinel_bind`

Data type: `Variant[Undef, Stdlib::IP::Address, Array[Stdlib::IP::Address]]`
Expand Down Expand Up @@ -1212,29 +1164,28 @@ conflicts.

Default value: `$redis::params::sentinel_working_dir`

##### `notification_script`
##### `daemonize`

Data type: `Boolean`

Data type: `Optional[Stdlib::Absolutepath]`
Default value: $redis::params::sentinel_daemonize

Path to the notification script

Default value: ``undef``
##### `init_template`

##### `client_reconfig_script`
Data type: `String[1]`

Data type: `Optional[Stdlib::Absolutepath]`

Path to the client-reconfig script

Default value: ``undef``
Default value: `'redis/redis-sentinel.init.erb'`

##### `init_template`
##### `parallel_sync`

Data type: `String[1]`
Data type: `Integer[0]`



Default value: `'redis/redis-sentinel.init.erb'`
Default value: 1

##### `service_ensure`

Expand Down Expand Up @@ -2053,6 +2004,23 @@ The Redis::RedisUrl data type.

Alias of `Pattern[/(^redis:\/\/)/]`

### Redis::SentinelMonitor

The Redis::SentinelMonitor data type.

Alias of `Hash[String, Struct[{
redis_host => Stdlib::Host,
redis_port => Stdlib::Port,
quorum => Integer[1],
down_after => Integer[1],
parallel_sync => Integer[0],
failover_timeout => Integer[1],
monitor_name => Optional[String],
auth_pass => Optional[String],
notification_script => Optional[Stdlib::Absolutepath],
client_reconfig_script => Optional[Stdlib::Absolutepath],
}]]`

## Tasks

### `redis_cli`
Expand Down
34 changes: 23 additions & 11 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
}

'RedHat': {
$ppa_repo = undef
$daemonize = false
$config_owner = 'redis'
$config_group = 'root'
$config_dir_mode = '0755'
$log_dir_mode = '0750'

$sentinel_daemonize = false
$sentinel_init_script = undef
$sentinel_working_dir = '/tmp'
$sentinel_protected_mode = true
$ppa_repo = undef
$daemonize = false
$config_owner = 'redis'
$config_group = 'root'
$config_dir_mode = '0755'
$log_dir_mode = '0750'

$sentinel_daemonize = false
$sentinel_init_script = undef
$sentinel_working_dir = '/tmp'
$sentinel_protected_mode = true

$scl = $redis::globals::scl
if $scl {
Expand Down Expand Up @@ -205,4 +205,16 @@
fail "Operating system ${facts['os']['name']} is not supported yet."
}
}

$sentinel_monitor_defaults = {
redis_host => '127.0.0.1',
redis_port => 6379,
quorum => 2,
down_after => 30000,
parallel_sync => 1,
failover_timeout => 180000,
}
$sentinel_default_monitor = {
'mymaster' => $sentinel_monitor_defaults,
}
}
Loading