diff --git a/REFERENCE.md b/REFERENCE.md
index c2b5a708..7ed98525 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -112,6 +112,7 @@ The following parameters are available in the `redis` class:
* [`hll_sparse_max_bytes`](#-redis--hll_sparse_max_bytes)
* [`hz`](#-redis--hz)
* [`latency_monitor_threshold`](#-redis--latency_monitor_threshold)
+* [`latency_tracking`](#-redis--latency_tracking)
* [`list_max_ziplist_entries`](#-redis--list_max_ziplist_entries)
* [`list_max_ziplist_value`](#-redis--list_max_ziplist_value)
* [`log_dir`](#-redis--log_dir)
@@ -153,6 +154,7 @@ The following parameters are available in the `redis` class:
* [`repl_announce_port`](#-redis--repl_announce_port)
* [`repl_backlog_size`](#-redis--repl_backlog_size)
* [`repl_backlog_ttl`](#-redis--repl_backlog_ttl)
+* [`repl_diskless_sync`](#-redis--repl_diskless_sync)
* [`repl_disable_tcp_nodelay`](#-redis--repl_disable_tcp_nodelay)
* [`repl_ping_slave_period`](#-redis--repl_ping_slave_period)
* [`repl_timeout`](#-redis--repl_timeout)
@@ -455,6 +457,14 @@ Latency monitoring threshold in milliseconds
Default value: `0`
+##### `latency_tracking`
+
+Data type: `Boolean`
+
+Latency monitoring enabled
+
+Default value: `true`
+
##### `list_max_ziplist_entries`
Data type: `Integer[0]`
@@ -784,6 +794,14 @@ The number of seconds to elapse before freeing backlog buffer
Default value: `3600`
+##### `repl_diskless_sync`
+
+Data type: `Boolean`
+
+Enable/disable diskless replication
+
+Default value: `true`
+
##### `repl_disable_tcp_nodelay`
Data type: `Boolean`
@@ -1944,6 +1962,7 @@ The following parameters are available in the `redis::instance` defined type:
* [`hll_sparse_max_bytes`](#-redis--instance--hll_sparse_max_bytes)
* [`hz`](#-redis--instance--hz)
* [`latency_monitor_threshold`](#-redis--instance--latency_monitor_threshold)
+* [`latency_tracking`](#-redis--instance--latency_tracking)
* [`list_max_ziplist_entries`](#-redis--instance--list_max_ziplist_entries)
* [`list_max_ziplist_value`](#-redis--instance--list_max_ziplist_value)
* [`log_dir`](#-redis--instance--log_dir)
@@ -1972,6 +1991,7 @@ The following parameters are available in the `redis::instance` defined type:
* [`repl_announce_port`](#-redis--instance--repl_announce_port)
* [`repl_backlog_size`](#-redis--instance--repl_backlog_size)
* [`repl_backlog_ttl`](#-redis--instance--repl_backlog_ttl)
+* [`repl_diskless_sync`](#-redis--instance--repl_diskless_sync)
* [`repl_disable_tcp_nodelay`](#-redis--instance--repl_disable_tcp_nodelay)
* [`repl_ping_slave_period`](#-redis--instance--repl_ping_slave_period)
* [`repl_timeout`](#-redis--instance--repl_timeout)
@@ -2236,6 +2256,14 @@ Latency monitoring threshold in milliseconds
Default value: `$redis::latency_monitor_threshold`
+##### `latency_tracking`
+
+Data type: `Boolean`
+
+Latency monitoring enabled
+
+Default value: `$redis::latency_tracking`
+
##### `list_max_ziplist_entries`
Data type: `Integer[0]`
@@ -2461,6 +2489,14 @@ The number of seconds to elapse before freeing backlog buffer
Default value: `$redis::repl_backlog_ttl`
+##### `repl_diskless_sync`
+
+Data type: `Boolean`
+
+Enable/disable diskless replication
+
+Default value: `$redis::repl_diskless_sync`
+
##### `repl_disable_tcp_nodelay`
Data type: `Boolean`
diff --git a/manifests/init.pp b/manifests/init.pp
index e48ed67c..ebfd6a60 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -75,6 +75,8 @@
# Set redis background tasks frequency
# @param latency_monitor_threshold
# Latency monitoring threshold in milliseconds
+# @param latency_tracking
+# Latency monitoring enabled
# @param list_max_ziplist_entries
# Set max ziplist entries for lists.
# @param list_max_ziplist_value
@@ -158,6 +160,8 @@
# The replication backlog size
# @param repl_backlog_ttl
# The number of seconds to elapse before freeing backlog buffer
+# @param repl_diskless_sync
+# Enable/disable diskless replication
# @param repl_disable_tcp_nodelay
# Enable/disable TCP_NODELAY on the slave socket after SYNC
# @param repl_ping_slave_period
@@ -382,6 +386,7 @@
Integer[0] $hll_sparse_max_bytes = 3000,
Integer[1, 500] $hz = 10,
Integer[0] $latency_monitor_threshold = 0,
+ Boolean $latency_tracking = true,
Integer[0] $list_max_ziplist_entries = 512,
Integer[0] $list_max_ziplist_value = 64,
Stdlib::Absolutepath $log_dir = $redis::params::log_dir,
@@ -422,6 +427,7 @@
Optional[Stdlib::Port] $repl_announce_port = undef,
String[1] $repl_backlog_size = '1mb',
Integer[0] $repl_backlog_ttl = 3600,
+ Boolean $repl_diskless_sync = true,
Boolean $repl_disable_tcp_nodelay = false,
Integer[1] $repl_ping_slave_period = 10,
Integer[1] $repl_timeout = 60,
diff --git a/manifests/instance.pp b/manifests/instance.pp
index 3b18cfca..571b496a 100644
--- a/manifests/instance.pp
+++ b/manifests/instance.pp
@@ -56,6 +56,8 @@
# Set redis background tasks frequency
# @param latency_monitor_threshold
# Latency monitoring threshold in milliseconds
+# @param latency_tracking
+# Latency monitoring enabled
# @param list_max_ziplist_entries
# Set max ziplist entries for lists.
# @param list_max_ziplist_value
@@ -113,6 +115,8 @@
# The replication backlog size
# @param repl_backlog_ttl
# The number of seconds to elapse before freeing backlog buffer
+# @param repl_diskless_sync
+# Enable/disable diskless replication
# @param repl_disable_tcp_nodelay
# Enable/disable TCP_NODELAY on the slave socket after SYNC
# @param repl_ping_slave_period
@@ -319,6 +323,7 @@
Integer[0] $hll_sparse_max_bytes = $redis::hll_sparse_max_bytes,
Integer[1, 500] $hz = $redis::hz,
Integer[0] $latency_monitor_threshold = $redis::latency_monitor_threshold,
+ Boolean $latency_tracking = $redis::latency_tracking,
Integer[0] $list_max_ziplist_entries = $redis::list_max_ziplist_entries,
Integer[0] $list_max_ziplist_value = $redis::list_max_ziplist_value,
Stdlib::Absolutepath $log_dir = $redis::log_dir,
@@ -344,6 +349,7 @@
Optional[Stdlib::Port] $repl_announce_port = $redis::repl_announce_port,
String[1] $repl_backlog_size = $redis::repl_backlog_size,
Integer[0] $repl_backlog_ttl = $redis::repl_backlog_ttl,
+ Boolean $repl_diskless_sync = $redis::repl_diskless_sync,
Boolean $repl_disable_tcp_nodelay = $redis::repl_disable_tcp_nodelay,
Integer[1] $repl_ping_slave_period = $redis::repl_ping_slave_period,
Integer[1] $repl_timeout = $redis::repl_timeout,
@@ -501,6 +507,9 @@
$bind_arr = [$bind].flatten
+ $default_redis_version = '8.0.0'
+ $redis_version = $facts.get('redis_server_version', $instance::default_version_var)
+
$_template_params = {
daemonize => $daemonize,
pid_file => $pid_file,
@@ -535,6 +544,7 @@
repl_disable_tcp_nodelay => $repl_disable_tcp_nodelay,
repl_backlog_size => $repl_backlog_size,
repl_backlog_ttl => $repl_backlog_ttl,
+ repl_diskless_sync => $repl_diskless_sync,
slave_priority => $slave_priority,
min_slaves_to_write => $min_slaves_to_write,
min_slaves_max_lag => $min_slaves_max_lag,
@@ -554,6 +564,7 @@
slowlog_log_slower_than => $slowlog_log_slower_than,
slowlog_max_len => $slowlog_max_len,
latency_monitor_threshold => $latency_monitor_threshold,
+ latency_tracking => $latency_tracking,
notify_keyspace_events => $notify_keyspace_events,
hash_max_ziplist_entries => $hash_max_ziplist_entries,
hash_max_ziplist_value => $hash_max_ziplist_value,
@@ -604,6 +615,7 @@
rdb_save_incremental_fsync => $rdb_save_incremental_fsync,
acls => $acls,
custom_options => $custom_options,
+ redis_version => $redis_version,
}
# TODO: Rely on https://github.com/puppetlabs/puppetlabs-stdlib/pull/1425
diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb
index b0cae74a..cfbd876b 100644
--- a/spec/classes/redis_spec.rb
+++ b/spec/classes/redis_spec.rb
@@ -741,6 +741,20 @@ class { 'redis':
}
end
+ describe 'with parameter latency_tracking' do
+ let(:params) do
+ {
+ latency_tracking: true
+ }
+ end
+
+ it {
+ is_expected.to contain_file(config_file_orig).with(
+ 'content' => %r{^latency-tracking yes$}
+ )
+ }
+ end
+
describe 'with parameter rdbcompression' do
let(:params) do
{
@@ -826,6 +840,20 @@ class { 'redis':
}
end
+ describe 'with parameter repl_diskless_sync' do
+ let(:params) do
+ {
+ repl_diskless_sync: true
+ }
+ end
+
+ it {
+ is_expected.to contain_file(config_file_orig).with(
+ 'content' => %r{^repl-diskless-sync yes$}
+ )
+ }
+ end
+
describe 'with parameter repl_disable_tcp_nodelay' do
let(:params) do
{
diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp
index a14f7060..3eb392f4 100644
--- a/templates/redis.conf.epp
+++ b/templates/redis.conf.epp
@@ -32,6 +32,7 @@
Boolean $repl_disable_tcp_nodelay,
String[1] $repl_backlog_size,
Integer[0] $repl_backlog_ttl,
+ Boolean $repl_diskless_sync,
Integer[0] $slave_priority,
Integer[0] $min_slaves_to_write,
Integer[0] $min_slaves_max_lag,
@@ -51,6 +52,7 @@
Integer[-1] $slowlog_log_slower_than,
Integer[0] $slowlog_max_len,
Integer[0] $latency_monitor_threshold,
+ Boolean $latency_tracking,
Optional[String[1]] $notify_keyspace_events,
Integer[0] $hash_max_ziplist_entries,
Integer[0] $hash_max_ziplist_value,
@@ -101,6 +103,7 @@
Optional[Boolean] $rdb_save_incremental_fsync,
Array[String[1]] $acls,
Hash[String[1],Variant[String[1], Integer]] $custom_options,
+ String[1] $redis_version
| -%>
# Redis configuration file example
@@ -562,6 +565,37 @@ slave-priority <%= $slave_priority %>
min-slaves-to-write <%= $min_slaves_to_write %>
min-slaves-max-lag <%= $min_slaves_max_lag %>
+# Replication SYNC strategy: disk or socket.
+#
+# New replicas and reconnecting replicas that are not able to continue the
+# replication process just receiving differences, need to do what is called a
+# "full synchronization". An RDB file is transmitted from the master to the
+# replicas.
+#
+# The transmission can happen in two different ways:
+#
+# 1) Disk-backed: The Redis master creates a new process that writes the RDB
+# file on disk. Later the file is transferred by the parent
+# process to the replicas incrementally.
+# 2) Diskless: The Redis master creates a new process that directly writes the
+# RDB file to replica sockets, without touching the disk at all.
+#
+# With disk-backed replication, while the RDB file is generated, more replicas
+# can be queued and served with the RDB file as soon as the current child
+# producing the RDB file finishes its work. With diskless replication instead
+# once the transfer starts, new replicas arriving will be queued and a new
+# transfer will start when the current one terminates.
+#
+# When diskless replication is used, the master waits a configurable amount of
+# time (in seconds) before starting the transfer in the hope that multiple
+# replicas will arrive and the transfer can be parallelized.
+#
+# With slow disks and fast (large bandwidth) networks, diskless replication
+# works better.
+<%- if versioncmp($redis_version, '7.0.0') >= 0 { -%>
+repl-diskless-sync <%= bool2str($repl_diskless_sync, 'yes', 'no') -%>
+<%- } -%>
+
################################## SECURITY ###################################
# Require clients to issue AUTH before processing any other
@@ -845,6 +879,18 @@ slowlog-max-len <%= $slowlog_max_len %>
# "CONFIG SET latency-monitor-threshold " if needed.
latency-monitor-threshold <%= $latency_monitor_threshold %>
+################################ LATENCY TRACKING ##############################
+
+# The Redis extended latency monitoring tracks the per command latencies and enables
+# exporting the percentile distribution via the INFO latencystats command,
+# and cumulative latency distributions (histograms) via the LATENCY command.
+#
+# By default, the extended latency monitoring is enabled since the overhead
+# of keeping track of the command latency is very small.
+<% if versioncmp($redis_version, '7.0.0') >= 0 { %>
+latency-tracking <%= bool2str($latency_tracking, 'yes', 'no') -%>
+<% } %>
+
############################# Event notification ##############################
# Redis can notify Pub/Sub clients about events happening in the key space.