Skip to content

Commit 7b4c3f6

Browse files
committedSep 9, 2016
replay commits from develop branch
2 parents 719505e + 356e98b commit 7b4c3f6

File tree

5 files changed

+98
-56
lines changed

5 files changed

+98
-56
lines changed
 

‎README.md

+25-11
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Most of the time you will only need `redis_version`.
5454
}
5555
```
5656
To install redis from package use the following parameters.
57-
You will need `redis_version` and `redis_package`.
57+
You will need `redis_version` and `redis_package`.
5858
```puppet
5959
class { 'redis::install':
6060
redis_version => '2.8.18-1.el6.remi',
@@ -112,12 +112,16 @@ node 'redis-master.my.domain' {
112112
113113
redis::server {
114114
'master':
115-
redis_memory => '1g',
116-
redis_ip => '0.0.0.0',
117-
redis_port => 6379,
118-
running => true,
119-
enabled => true,
120-
requirepass => 'some_really_long_random_password',
115+
redis_memory => '1g',
116+
redis_ip => '0.0.0.0',
117+
redis_port => 6379,
118+
running => true,
119+
enabled => true,
120+
requirepass => 'some_really_long_random_password',
121+
client_output_buffer_limit => {
122+
'normal' => '0 0 0',
123+
'slave' => '500000000 300000000 60',
124+
},
121125
}
122126
}
123127
@@ -145,7 +149,7 @@ node 'redis-slave.my.domain' {
145149
Please note that right now you can only create cluster-enabled instances
146150
but you cannot configure a Redis Cluster only with this module. You should
147151
still use `redis-trib.rb` from Redis source distribution or configure it
148-
by hand with redis cluster commands. Moreover, the cluster mode will be enabled
152+
by hand with redis cluster commands. Moreover, the cluster mode will be enabled
149153
only for Redis >= 3.0
150154

151155
A simple example of a cluster-enabled instance, with a timeout of 5 seconds to
@@ -253,7 +257,7 @@ The dir to which the newly built redis binaries are copied.
253257
Redis system user. Default: undef (string)
254258
Default 'undef' results to 'root' as redis system user
255259

256-
Some redis install packages create the redis system user by default (at
260+
Some redis install packages create the redis system user by default (at
257261
least SLES and Ubuntu provide redis install packages).
258262
Normally the log directory and the pid directory are created also by
259263
the redis install package. Therefor, these values must be adjusted too.
@@ -266,7 +270,7 @@ Default 'undef' results to 'root' as redis system group
266270

267271
#####`download_base`
268272

269-
Url where to find the source tar.gz.
273+
Url where to find the source tar.gz.
270274
Default value is 'http://download.redis.io/releases'
271275

272276
####Defined Type: `redis::server`
@@ -398,11 +402,17 @@ Configure Redis save snapshotting. Example: [[900, 1], [300, 10]]. Default: []
398402

399403
Boolean. Default: `false`
400404

401-
Configure if the redis config is overwritten by puppet followed by a restart.
405+
Configure if the redis config is overwritten by puppet followed by a restart.
402406
Since redis automatically rewrite their config since
403407
version 2.8 setting this to `true` will trigger a redis restart on each puppet
404408
run with redis 2.8 or later.
405409

410+
#####`client_output_buffer_limit`
411+
412+
Hash containing 3 possible classes as keys (normal, slave, pubsub) and with the
413+
values set to the hard limit, soft limit and seconds.
414+
Default: empty
415+
406416
#####`manage_logrotate`
407417

408418
Configure logrotate rules for redis server. Default: true
@@ -429,6 +439,10 @@ Configure Redis slave to be in read-only mode. Default: true (boolean)
429439

430440
Configure Redis slave replication timeout in seconds. Default: 60 (number)
431441

442+
#####`repl_backlog_size`
443+
444+
Configure Redis slave backlog size in bytes. Default: undef
445+
432446
#####`repl_ping_slave_period`
433447

434448
Configure Redis replication ping slave period in seconds. Default: 10 (number)

‎manifests/sentinel.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
}
109109

110110
# startup script
111-
if ($::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '7') >=0) {
111+
if ($::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '7') >=0 and $::operatingsystem != 'Amazon') {
112112
$service_file = "/usr/lib/systemd/system/redis-sentinel_${sentinel_name}.service"
113113
exec { "systemd_service_${sentinel_name}_preset":
114114
command => "/bin/systemctl preset redis-sentinel_${sentinel_name}.service",

‎manifests/server.pp

+51-42
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
# Configure Redis slave replication timeout
7070
# [*repl_ping_slave_period*]
7171
# Configure Redis replication ping slave period
72+
# [*repl_backlog_size*]
73+
# Replication backlog size (in bytes or multiples). Default: undef
7274
# [*save*]
7375
# Configure Redis save snapshotting. Example: [[900, 1], [300, 10]]. Default: []
7476
# [*hash_max_ziplist_entries*]
@@ -88,6 +90,11 @@
8890
# the config files created by puppet will be copied to this directory and redis will be started from
8991
# this copy.
9092
#
93+
# [*client_output_buffer_limit*]
94+
# Hash containing 3 possible classes as keys (normal, slave, pubsub) and
95+
# with the values set to the hard limit, soft limit and seconds.
96+
# Default: empty
97+
#
9198
# [*manage_logrotate*]
9299
# Configure logrotate rules for redis server. Default: true
93100
#
@@ -110,51 +117,53 @@
110117
# is at least an hash slot uncovered.
111118

112119
define redis::server (
113-
$redis_name = $name,
114-
$redis_memory = '100mb',
115-
$redis_ip = '127.0.0.1',
116-
$redis_port = 6379,
117-
$redis_usesocket = false,
118-
$redis_socket = '/tmp/redis.sock',
119-
$redis_socketperm = 755,
120-
$redis_mempolicy = 'allkeys-lru',
121-
$redis_memsamples = 3,
122-
$redis_timeout = 0,
123-
$redis_nr_dbs = 1,
124-
$redis_dbfilename = 'dump.rdb',
125-
$redis_dir = '/var/lib',
126-
$redis_log_dir = '/var/log',
127-
$redis_pid_dir = '/var/run',
128-
$redis_run_dir = '/var/run/redis',
129-
$redis_loglevel = 'notice',
130-
$redis_appedfsync = 'everysec',
131-
$running = true,
132-
$enabled = true,
133-
$requirepass = undef,
134-
$maxclients = undef,
135-
$appendfsync_on_rewrite = false,
136-
$aof_rewrite_percentage = 100,
137-
$aof_rewrite_minsize = 64,
138-
$redis_appendfsync = 'everysec',
139-
$redis_enabled_append_file = false,
140-
$redis_append_file = undef,
141-
$redis_append_enable = false,
142-
$slaveof = undef,
143-
$masterauth = undef,
144-
$slave_serve_stale_data = true,
145-
$slave_read_only = true,
146-
$repl_timeout = 60,
147-
$repl_ping_slave_period = 10,
148-
$save = [],
149-
$hash_max_ziplist_entries = 512,
150-
$hash_max_ziplist_value = 64,
151-
$manage_logrotate = true,
152-
$cluster_enabled = false,
153-
$protected_mode = undef,
120+
$redis_name = $name,
121+
$redis_memory = '100mb',
122+
$redis_ip = '127.0.0.1',
123+
$redis_port = 6379,
124+
$redis_usesocket = false,
125+
$redis_socket = '/tmp/redis.sock',
126+
$redis_socketperm = 755,
127+
$redis_mempolicy = 'allkeys-lru',
128+
$redis_memsamples = 3,
129+
$redis_timeout = 0,
130+
$redis_nr_dbs = 1,
131+
$redis_dbfilename = 'dump.rdb',
132+
$redis_dir = '/var/lib',
133+
$redis_log_dir = '/var/log',
134+
$redis_pid_dir = '/var/run',
135+
$redis_run_dir = '/var/run/redis',
136+
$redis_loglevel = 'notice',
137+
$redis_appedfsync = 'everysec',
138+
$running = true,
139+
$enabled = true,
140+
$requirepass = undef,
141+
$maxclients = undef,
142+
$appendfsync_on_rewrite = false,
143+
$aof_rewrite_percentage = 100,
144+
$aof_rewrite_minsize = 64,
145+
$redis_appendfsync = 'everysec',
146+
$redis_enabled_append_file = false,
147+
$redis_append_file = undef,
148+
$redis_append_enable = false,
149+
$slaveof = undef,
150+
$masterauth = undef,
151+
$slave_serve_stale_data = true,
152+
$slave_read_only = true,
153+
$repl_timeout = 60,
154+
$repl_ping_slave_period = 10,
155+
$repl_backlog_size = undef,
156+
$save = [],
157+
$hash_max_ziplist_entries = 512,
158+
$hash_max_ziplist_value = 64,
159+
$client_output_buffer_limit = {},
160+
$manage_logrotate = true,
161+
$cluster_enabled = false,
154162
$cluster_node_timeout = undef,
155163
$cluster_slave_validity_factor = undef,
156164
$cluster_migration_barrier = undef,
157165
$cluster_require_full_coverage = true,
166+
$protected_mode = undef,
158167
) {
159168
$redis_user = $::redis::install::redis_user
160169
$redis_group = $::redis::install::redis_group
@@ -180,7 +189,7 @@
180189
}
181190

182191
# startup script
183-
if ($::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '7') >=0) {
192+
if ($::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '7') >=0 and $::operatingsystem != 'Amazon') {
184193
$service_file = "/usr/lib/systemd/system/redis-server_${redis_name}.service"
185194
exec { "systemd_service_${redis_name}_preset":
186195
command => "/bin/systemctl preset redis-server_${redis_name}.service",

‎templates/etc/redis.conf.erb

+20-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
# units are case insensitive so 1GB 1Gb 1gB are all the same.
1616

17-
<% if @osfamily == 'RedHat' and scope.function_versioncmp([@operatingsystemmajrelease, '7']) >= 0 -%>
17+
<% if @osfamily == 'RedHat' and scope.function_versioncmp([@operatingsystemmajrelease, '7']) >= 0 and @operatingsystem != 'Amazon' -%>
1818
daemonize no
1919
<% else -%>
2020
# By default Redis does not run as a daemon. Use 'yes' if you need it.
@@ -202,6 +202,20 @@ repl-timeout <%= @repl_timeout %>
202202
# By default the priority is 100.
203203
#slave-priority 100
204204

205+
# Set the replication backlog size. The backlog is a buffer that accumulates
206+
# slave data when slaves are disconnected for some time, so that when a slave
207+
# wants to reconnect again, often a full resync is not needed, but a partial
208+
# resync is enough, just passing the portion of data the slave missed while
209+
# disconnected.
210+
#
211+
# The bigger the replication backlog, the longer the time the slave can be
212+
# disconnected and later be able to perform a partial resynchronization.
213+
#
214+
# The backlog is only allocated once there is at least a slave connected.
215+
#
216+
# repl-backlog-size 1mb
217+
<% if @repl_backlog_size -%>repl-backlog-size <%= @repl_backlog_size %><% end -%>
218+
205219
################################## SECURITY ###################################
206220

207221
# Require clients to issue AUTH password before processing any other
@@ -636,10 +650,15 @@ activerehashing yes
636650
# subscribers and slaves receive data in a push fashion.
637651
#
638652
# Both the hard or the soft limit can be disabled just setting it to zero.
653+
#
639654
#client-output-buffer-limit normal 0 0 0
640655
#client-output-buffer-limit slave 256mb 64mb 60
641656
#client-output-buffer-limit pubsub 32mb 8mb 60
642657

658+
<% @client_output_buffer_limit.sort.each do |key, value| -%>
659+
client-output-buffer-limit <%= key -%> <%= value %>
660+
<% end -%>
661+
643662
################################## INCLUDES ###################################
644663

645664
# Include one or more other config files here. This is useful if you

‎templates/etc/sentinel.conf.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# !!! generated by puppet !!!
44

5-
<% if @osfamily == 'RedHat' and scope.function_versioncmp([@operatingsystemmajrelease, '7']) >= 0 -%>
5+
<% if @osfamily == 'RedHat' and scope.function_versioncmp([@operatingsystemmajrelease, '7']) >= 0 and @operatingsystem != 'Amazon' -%>
66
daemonize no
77
<% else -%>
88
daemonize yes

0 commit comments

Comments
 (0)
Please sign in to comment.