diff --git a/REFERENCE.md b/REFERENCE.md
index 8593101..fe5f776 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -1,2280 +1,2280 @@
# Reference
## Table of Contents
### Classes
#### Public Classes
* [`redis`](#redis): This class installs redis
* [`redis::administration`](#redisadministration): Allows various administrative settings for Redis
* [`redis::globals`](#redisglobals): Set a global config for Redis
* [`redis::sentinel`](#redissentinel): Install redis-sentinel
#### Private Classes
* `redis::config`: This class provides configuration for Redis.
* `redis::install`: This class installs the application.
* `redis::params`: This class provides a number of parameters.
* `redis::preinstall`: Provides anything required by the install class, such as package
repositories.
* `redis::service`: This class manages the Redis daemon.
* `redis::ulimit`: Redis class for configuring ulimit Used to DRY up the config class, and move the logic for ulimit changes all into one place. Parameters are
### Defined types
* [`redis::instance`](#redisinstance): Allows the configuration of multiple redis configurations on one machine
### Functions
* [`redis::get`](#redisget): ```
### Data types
* [`Redis::LogLevel`](#redisloglevel): Specify the server verbosity level.
* [`Redis::RedisUrl`](#redisredisurl)
### Tasks
* [`redis_cli`](#redis_cli): Executes a redis-cli command on the target system
## Classes
### `redis`
This class installs redis
#### Examples
##### Default install
```puppet
include redis
```
##### Slave Node
```puppet
class { '::redis':
bind => '10.0.1.2',
slaveof => '10.0.1.1 6379',
}
```
##### Binding on multiple interfaces
```puppet
class { 'redis':
bind => ['127.0.0.1', '10.0.0.1', '10.1.0.1'],
}
```
##### Binding on all interfaces
```puppet
class { 'redis':
bind => [],
}
```
#### Parameters
The following parameters are available in the `redis` class:
* [`activerehashing`](#activerehashing)
* [`aof_load_truncated`](#aof_load_truncated)
* [`aof_rewrite_incremental_fsync`](#aof_rewrite_incremental_fsync)
* [`appendfilename`](#appendfilename)
* [`appendfsync`](#appendfsync)
* [`appendonly`](#appendonly)
* [`auto_aof_rewrite_min_size`](#auto_aof_rewrite_min_size)
* [`auto_aof_rewrite_percentage`](#auto_aof_rewrite_percentage)
* [`bind`](#bind)
* [`config_dir`](#config_dir)
* [`config_dir_mode`](#config_dir_mode)
* [`config_file_orig`](#config_file_orig)
* [`config_file`](#config_file)
* [`config_file_mode`](#config_file_mode)
* [`config_group`](#config_group)
* [`config_owner`](#config_owner)
* [`conf_template`](#conf_template)
* [`daemonize`](#daemonize)
* [`default_install`](#default_install)
* [`databases`](#databases)
* [`dbfilename`](#dbfilename)
* [`extra_config_file`](#extra_config_file)
* [`hash_max_ziplist_entries`](#hash_max_ziplist_entries)
* [`hash_max_ziplist_value`](#hash_max_ziplist_value)
* [`hll_sparse_max_bytes`](#hll_sparse_max_bytes)
* [`hz`](#hz)
* [`latency_monitor_threshold`](#latency_monitor_threshold)
* [`list_max_ziplist_entries`](#list_max_ziplist_entries)
* [`list_max_ziplist_value`](#list_max_ziplist_value)
* [`log_dir`](#log_dir)
* [`log_dir_mode`](#log_dir_mode)
* [`log_file`](#log_file)
* [`log_level`](#log_level)
* [`manage_repo`](#manage_repo)
* [`manage_package`](#manage_package)
* [`managed_by_cluster_manager`](#managed_by_cluster_manager)
* [`masterauth`](#masterauth)
* [`maxclients`](#maxclients)
* [`maxmemory`](#maxmemory)
* [`maxmemory_policy`](#maxmemory_policy)
* [`maxmemory_samples`](#maxmemory_samples)
* [`min_slaves_max_lag`](#min_slaves_max_lag)
* [`min_slaves_to_write`](#min_slaves_to_write)
* [`no_appendfsync_on_rewrite`](#no_appendfsync_on_rewrite)
* [`notify_keyspace_events`](#notify_keyspace_events)
* [`notify_service`](#notify_service)
* [`package_ensure`](#package_ensure)
* [`package_name`](#package_name)
* [`pid_file`](#pid_file)
* [`port`](#port)
* [`protected_mode`](#protected_mode)
* [`ppa_repo`](#ppa_repo)
* [`rdbcompression`](#rdbcompression)
* [`rename_commands`](#rename_commands)
* [`repl_backlog_size`](#repl_backlog_size)
* [`repl_backlog_ttl`](#repl_backlog_ttl)
* [`repl_disable_tcp_nodelay`](#repl_disable_tcp_nodelay)
* [`repl_ping_slave_period`](#repl_ping_slave_period)
* [`repl_timeout`](#repl_timeout)
* [`requirepass`](#requirepass)
* [`save_db_to_disk`](#save_db_to_disk)
* [`save_db_to_disk_interval`](#save_db_to_disk_interval)
* [`service_manage`](#service_manage)
* [`service_enable`](#service_enable)
* [`service_ensure`](#service_ensure)
* [`service_group`](#service_group)
* [`service_name`](#service_name)
* [`service_user`](#service_user)
* [`set_max_intset_entries`](#set_max_intset_entries)
* [`slave_priority`](#slave_priority)
* [`slave_read_only`](#slave_read_only)
* [`slave_serve_stale_data`](#slave_serve_stale_data)
* [`slaveof`](#slaveof)
* [`slowlog_log_slower_than`](#slowlog_log_slower_than)
* [`slowlog_max_len`](#slowlog_max_len)
* [`stop_writes_on_bgsave_error`](#stop_writes_on_bgsave_error)
* [`syslog_enabled`](#syslog_enabled)
* [`syslog_facility`](#syslog_facility)
* [`tcp_backlog`](#tcp_backlog)
* [`tcp_keepalive`](#tcp_keepalive)
* [`timeout`](#timeout)
* [`ulimit`](#ulimit)
* [`ulimit_managed`](#ulimit_managed)
* [`unixsocket`](#unixsocket)
* [`unixsocketperm`](#unixsocketperm)
* [`workdir`](#workdir)
* [`workdir_mode`](#workdir_mode)
* [`zset_max_ziplist_entries`](#zset_max_ziplist_entries)
* [`zset_max_ziplist_value`](#zset_max_ziplist_value)
* [`cluster_enabled`](#cluster_enabled)
* [`cluster_config_file`](#cluster_config_file)
* [`cluster_node_timeout`](#cluster_node_timeout)
* [`cluster_slave_validity_factor`](#cluster_slave_validity_factor)
* [`cluster_require_full_coverage`](#cluster_require_full_coverage)
* [`cluster_migration_barrier`](#cluster_migration_barrier)
* [`instances`](#instances)
* [`output_buffer_limit_slave`](#output_buffer_limit_slave)
* [`output_buffer_limit_pubsub`](#output_buffer_limit_pubsub)
* [`manage_service_file`](#manage_service_file)
##### `activerehashing`
Data type: `Boolean`
Enable/disable active rehashing.
Default value: ``true``
##### `aof_load_truncated`
Data type: `Boolean`
Enable/disable loading truncated AOF file
Default value: ``true``
##### `aof_rewrite_incremental_fsync`
Data type: `Boolean`
Enable/disable fsync for AOF file
Default value: ``true``
##### `appendfilename`
Data type: `String[1]`
The name of the append only file
Default value: `'appendonly.aof'`
##### `appendfsync`
Data type: `Enum['no', 'always', 'everysec']`
Adjust fsync mode
Default value: `'everysec'`
##### `appendonly`
Data type: `Boolean`
Enable/disable appendonly mode.
Default value: ``false``
##### `auto_aof_rewrite_min_size`
Data type: `String[1]`
Adjust minimum size for auto-aof-rewrite.
Default value: `'64mb'`
##### `auto_aof_rewrite_percentage`
Data type: `Integer[0]`
Adjust percentatge for auto-aof-rewrite.
Default value: `100`
##### `bind`
Data type: `Variant[Stdlib::IP::Address, Array[Stdlib::IP::Address]]`
Configure which IP address(es) to listen on. To bind on all interfaces, use an empty array.
Default value: `['127.0.0.1']`
##### `config_dir`
Data type: `Stdlib::Absolutepath`
Directory containing the configuration files.
Default value: `$redis::params::config_dir`
##### `config_dir_mode`
Data type: `Stdlib::Filemode`
Adjust mode for directory containing configuration files.
Default value: `$redis::params::config_dir_mode`
##### `config_file_orig`
Data type: `Stdlib::Absolutepath`
The location and name of a config file that provides the source
Default value: `$redis::params::config_file_orig`
##### `config_file`
Data type: `Stdlib::Absolutepath`
Adjust main configuration file.
Default value: `$redis::params::config_file`
##### `config_file_mode`
Data type: `Stdlib::Filemode`
Adjust permissions for configuration files.
Default value: `'0644'`
##### `config_group`
Data type: `String[1]`
Adjust filesystem group for config files.
Default value: `$redis::params::config_group`
##### `config_owner`
Data type: `String[1]`
Adjust filesystem owner for config files.
Default value: `$redis::params::config_owner`
##### `conf_template`
Data type: `String[1]`
Define which template to use.
-Default value: `'redis/redis.conf.erb'`
+Default value: `'redis/redis.conf.epp'`
##### `daemonize`
Data type: `Boolean`
Have Redis run as a daemon.
Default value: `$redis::params::daemonize`
##### `default_install`
Data type: `Boolean`
Configure a default install of redis.
Default value: ``true``
##### `databases`
Data type: `Integer[1]`
Set the number of databases.
Default value: `16`
##### `dbfilename`
Data type: `Variant[String[1], Boolean]`
The filename where to dump the DB
Default value: `'dump.rdb'`
##### `extra_config_file`
Data type: `Optional[String]`
Optional extra config file to include
Default value: ``undef``
##### `hash_max_ziplist_entries`
Data type: `Integer[0]`
Set max ziplist entries for hashes.
Default value: `512`
##### `hash_max_ziplist_value`
Data type: `Integer[0]`
Set max ziplist values for hashes.
Default value: `64`
##### `hll_sparse_max_bytes`
Data type: `Integer[0]`
HyperLogLog sparse representation bytes limit
Default value: `3000`
##### `hz`
Data type: `Integer[1, 500]`
Set redis background tasks frequency
Default value: `10`
##### `latency_monitor_threshold`
Data type: `Integer[0]`
Latency monitoring threshold in milliseconds
Default value: `0`
##### `list_max_ziplist_entries`
Data type: `Integer[0]`
Set max ziplist entries for lists.
Default value: `512`
##### `list_max_ziplist_value`
Data type: `Integer[0]`
Set max ziplist values for lists.
Default value: `64`
##### `log_dir`
Data type: `Stdlib::Absolutepath`
Specify directory where to write log entries.
Default value: `$redis::params::log_dir`
##### `log_dir_mode`
Data type: `Stdlib::Filemode`
Adjust mode for directory containing log files.
Default value: `$redis::params::log_dir_mode`
##### `log_file`
Data type: `String`
Specify file where to write log entries. Relative paths will be prepended
with log_dir but absolute paths are also accepted.
Default value: `'redis.log'`
##### `log_level`
Data type: `Redis::LogLevel`
Specify the server verbosity level.
Default value: `'notice'`
##### `manage_repo`
Data type: `Boolean`
Enable/disable upstream repository configuration.
Default value: ``false``
##### `manage_package`
Data type: `Boolean`
Enable/disable management of package
Default value: ``true``
##### `managed_by_cluster_manager`
Data type: `Boolean`
Choose if redis will be managed by a cluster manager such as pacemaker or rgmanager
Default value: ``false``
##### `masterauth`
Data type: `Optional[String[1]]`
If the master is password protected (using the "requirepass" configuration
Default value: ``undef``
##### `maxclients`
Data type: `Integer[1]`
Set the max number of connected clients at the same time.
Default value: `10000`
##### `maxmemory`
Data type: `Any`
Don't use more memory than the specified amount of bytes.
Default value: ``undef``
##### `maxmemory_policy`
Data type: `Any`
How Redis will select what to remove when maxmemory is reached.
Default value: ``undef``
##### `maxmemory_samples`
Data type: `Any`
Select as well the sample size to check.
Default value: ``undef``
##### `min_slaves_max_lag`
Data type: `Integer[0]`
The lag in seconds
Default value: `10`
##### `min_slaves_to_write`
Data type: `Integer[0]`
Minimum number of slaves to be in "online" state
Default value: `0`
##### `no_appendfsync_on_rewrite`
Data type: `Boolean`
If you have latency problems turn this to 'true'. Otherwise leave it as
Default value: ``false``
##### `notify_keyspace_events`
Data type: `Optional[String[1]]`
Which events to notify Pub/Sub clients about events happening
Default value: ``undef``
##### `notify_service`
Data type: `Boolean`
You may disable service reloads when config files change if you
Default value: ``true``
##### `package_ensure`
Data type: `String[1]`
Default action for package.
Default value: `'present'`
##### `package_name`
Data type: `String[1]`
Upstream package name.
Default value: `$redis::params::package_name`
##### `pid_file`
Data type: `Stdlib::Absolutepath`
Where to store the pid.
Default value: `$redis::params::pid_file`
##### `port`
Data type: `Stdlib::Port`
Configure which port to listen on.
Default value: `6379`
##### `protected_mode`
Data type: `Boolean`
Whether protected mode is enabled or not. Only applicable when no bind is set.
Default value: ``true``
##### `ppa_repo`
Data type: `Optional[String]`
Specify upstream (Ubuntu) PPA entry.
Default value: `$redis::params::ppa_repo`
##### `rdbcompression`
Data type: `Boolean`
Enable/disable compression of string objects using LZF when dumping.
Default value: ``true``
##### `rename_commands`
Data type: `Hash[String,String]`
A list of Redis commands to rename or disable for security reasons
Default value: `{}`
##### `repl_backlog_size`
Data type: `String[1]`
The replication backlog size
Default value: `'1mb'`
##### `repl_backlog_ttl`
Data type: `Integer[0]`
The number of seconds to elapse before freeing backlog buffer
Default value: `3600`
##### `repl_disable_tcp_nodelay`
Data type: `Boolean`
Enable/disable TCP_NODELAY on the slave socket after SYNC
Default value: ``false``
##### `repl_ping_slave_period`
Data type: `Integer[1]`
Slaves send PINGs to server in a predefined interval. It's possible
Default value: `10`
##### `repl_timeout`
Data type: `Integer[1]`
Set the replication timeout for:
Default value: `60`
##### `requirepass`
Data type: `Optional[String]`
Require clients to issue AUTH before processing any other commands.
Default value: ``undef``
##### `save_db_to_disk`
Data type: `Boolean`
Set if save db to disk.
Default value: ``true``
##### `save_db_to_disk_interval`
Data type: `Hash`
save the dataset every N seconds if there are at least M changes in the dataset
Default value: `{ '900' => '1', '300' => '10', '60' => '10000' }`
##### `service_manage`
Data type: `Boolean`
Specify if the service should be part of the catalog.
Default value: ``true``
##### `service_enable`
Data type: `Boolean`
Enable/disable daemon at boot.
Default value: ``true``
##### `service_ensure`
Data type: `Stdlib::Ensure::Service`
Specify if the server should be running.
Default value: `'running'`
##### `service_group`
Data type: `String[1]`
Specify which group to run as.
Default value: `'redis'`
##### `service_name`
Data type: `String[1]`
Specify the service name for Init or Systemd.
Default value: `$redis::params::service_name`
##### `service_user`
Data type: `String[1]`
Specify which user to run as.
Default value: `'redis'`
##### `set_max_intset_entries`
Data type: `Integer[0]`
The following configuration setting sets the limit in the size of the set
in order to use this special memory saving encoding.
Default value: `512`
##### `slave_priority`
Data type: `Integer[0]`
The priority number for slave promotion by Sentinel
Default value: `100`
##### `slave_read_only`
Data type: `Boolean`
You can configure a slave instance to accept writes or not.
Default value: ``true``
##### `slave_serve_stale_data`
Data type: `Boolean`
When a slave loses its connection with the master, or when the replication
is still in progress, the slave can act in two different ways:
1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
still reply to client requests, possibly with out of date data, or the
data set may just be empty if this is the first synchronization.
2) if slave-serve-stale-data is set to 'no' the slave will reply with
an error "SYNC with master in progress" to all the kind of commands
but to INFO and SLAVEOF.
Default value: ``true``
##### `slaveof`
Data type: `Optional[String[1]]`
Use slaveof to make a Redis instance a copy of another Redis server.
Default value: ``undef``
##### `slowlog_log_slower_than`
Data type: `Integer[0]`
Tells Redis what is the execution time, in microseconds, to exceed in order
for the command to get logged.
Default value: `10000`
##### `slowlog_max_len`
Data type: `Integer[0]`
Tells Redis what is the length to exceed in order for the command to get
logged.
Default value: `1024`
##### `stop_writes_on_bgsave_error`
Data type: `Boolean`
If false then Redis will continue to work as usual even if there are
problems with disk, permissions, and so forth.
Default value: ``true``
##### `syslog_enabled`
Data type: `Boolean`
Enable/disable logging to the system logger.
Default value: ``false``
##### `syslog_facility`
Data type: `Optional[String[1]]`
Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
Default value: ``undef``
##### `tcp_backlog`
Data type: `Integer[0]`
Sets the TCP backlog
Default value: `511`
##### `tcp_keepalive`
Data type: `Integer[0]`
TCP keepalive.
Default value: `0`
##### `timeout`
Data type: `Integer[0]`
Close the connection after a client is idle for N seconds (0 to disable).
Default value: `0`
##### `ulimit`
Data type: `Integer[0]`
Limit the use of system-wide resources.
Default value: `65536`
##### `ulimit_managed`
Data type: `Boolean`
Defines wheter the max number of open files for the
systemd service unit is explicitly managed.
Default value: ``true``
##### `unixsocket`
Data type: `Variant[Stdlib::Absolutepath, Enum['']]`
Define unix socket path
Default value: `'/var/run/redis/redis.sock'`
##### `unixsocketperm`
Data type: `Variant[Stdlib::Filemode, Enum['']]`
Define unix socket file permissions
Default value: `'0755'`
##### `workdir`
Data type: `Stdlib::Absolutepath`
The DB will be written inside this directory, with the filename specified
above using the 'dbfilename' configuration directive.
Default value: `$redis::params::workdir`
##### `workdir_mode`
Data type: `Stdlib::Filemode`
Adjust mode for data directory.
Default value: `'0750'`
##### `zset_max_ziplist_entries`
Data type: `Integer[0]`
Set max entries for sorted sets.
Default value: `128`
##### `zset_max_ziplist_value`
Data type: `Integer[0]`
Set max values for sorted sets.
Default value: `64`
##### `cluster_enabled`
Data type: `Boolean`
Enables redis 3.0 cluster functionality
Default value: ``false``
##### `cluster_config_file`
Data type: `String[1]`
Config file for saving cluster nodes configuration. This file is never
touched by humans. Only set if cluster_enabled is true
Default value: `'nodes.conf'`
##### `cluster_node_timeout`
Data type: `Integer[1]`
Node timeout. Only set if cluster_enabled is true
Default value: `5000`
##### `cluster_slave_validity_factor`
Data type: `Integer[0]`
Control variable to disable promoting slave in case of disconnection from master
Only set if cluster_enabled is true
Default value: `0`
##### `cluster_require_full_coverage`
Data type: `Boolean`
If false Redis Cluster will server queries even if requests about a subset of keys can be processed
Only set if cluster_enabled is true
Default value: ``true``
##### `cluster_migration_barrier`
Data type: `Integer[0]`
Minimum number of slaves master will remain connected with, for another
slave to migrate to a master which is no longer covered by any slave.
Only set if cluster_enabled is true
Default value: `1`
##### `instances`
Data type: `Hash[String[1], Hash]`
Iterate through multiple instance configurations
Default value: `{}`
##### `output_buffer_limit_slave`
Data type: `String[1]`
Default value: `'256mb 64mb 60'`
##### `output_buffer_limit_pubsub`
Data type: `String[1]`
Default value: `'32mb 8mb 60'`
##### `manage_service_file`
Data type: `Boolean`
Default value: ``false``
### `redis::administration`
As documented in the FAQ and https://redis.io/topics/admin.
For disabling Transparent Huge Pages (THP), use separate module such as:
https://forge.puppet.com/modules/alexharvey/disable_transparent_hugepage
Note that this class requires the herculesteam/augeasproviders_sysctl module.
* **See also**
* https://redis.io/topics/admin
* https://forge.puppet.com/herculesteam/augeasproviders_sysctl
#### Examples
-#####
+#####
```puppet
include redis::administration
```
-#####
+#####
```puppet
class {'redis::administration':
enable_overcommit_memory => false,
}
```
#### Parameters
The following parameters are available in the `redis::administration` class:
* [`enable_overcommit_memory`](#enable_overcommit_memory)
* [`somaxconn`](#somaxconn)
##### `enable_overcommit_memory`
Data type: `Boolean`
Enable the overcommit memory setting
Default value: ``true``
##### `somaxconn`
Data type: `Integer[0]`
Set somaxconn value
Default value: `65535`
### `redis::globals`
Set a global config for Redis
#### Parameters
The following parameters are available in the `redis::globals` class:
* [`scl`](#scl)
##### `scl`
Data type: `Optional[String]`
Use a specific Software CoLlection on Red Hat based systems
Default value: ``undef``
### `redis::sentinel`
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',
}
```
#### Parameters
The following parameters are available in the `redis::sentinel` class:
* [`auth_pass`](#auth_pass)
* [`config_file`](#config_file)
* [`config_file_orig`](#config_file_orig)
* [`config_file_mode`](#config_file_mode)
* [`conf_template`](#conf_template)
* [`daemonize`](#daemonize)
* [`down_after`](#down_after)
* [`failover_timeout`](#failover_timeout)
* [`log_file`](#log_file)
* [`log_level`](#log_level)
* [`master_name`](#master_name)
* [`redis_host`](#redis_host)
* [`redis_port`](#redis_port)
* [`requirepass`](#requirepass)
* [`protected_mode`](#protected_mode)
* [`package_name`](#package_name)
* [`package_ensure`](#package_ensure)
* [`parallel_sync`](#parallel_sync)
* [`pid_file`](#pid_file)
* [`quorum`](#quorum)
* [`sentinel_bind`](#sentinel_bind)
* [`sentinel_port`](#sentinel_port)
* [`service_group`](#service_group)
* [`service_name`](#service_name)
* [`service_user`](#service_user)
* [`service_enable`](#service_enable)
* [`working_dir`](#working_dir)
* [`notification_script`](#notification_script)
* [`client_reconfig_script`](#client_reconfig_script)
* [`service_ensure`](#service_ensure)
##### `auth_pass`
Data type: `Optional[String[1]]`
The password to use to authenticate with the master and slaves.
Default value: ``undef``
##### `config_file`
Data type: `Stdlib::Absolutepath`
The location and name of the sentinel config file.
Default value: `$redis::params::sentinel_config_file`
##### `config_file_orig`
Data type: `Stdlib::Absolutepath`
The location and name of a config file that provides the source
of the sentinel config file. Two different files are needed
because sentinel itself writes to its own config file and we do
not want override that when puppet is run unless there are
changes from the manifests.
Default value: `$redis::params::sentinel_config_file_orig`
##### `config_file_mode`
Data type: `Stdlib::Filemode`
Permissions of config file.
Default value: `'0644'`
##### `conf_template`
Data type: `String[1]`
Define which template to use.
Default value: `'redis/redis-sentinel.conf.erb'`
##### `daemonize`
Data type: `Boolean`
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`
##### `log_file`
Data type: `Stdlib::Absolutepath`
Specify where to write log entries.
Default value: `$redis::params::sentinel_log_file`
##### `log_level`
Data type: `Redis::LogLevel`
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`
##### `requirepass`
Data type: `Optional[String[1]]`
Specify the password to require client authentication via the AUTH command, however this feature is only available starting with Redis 5.0.1.
Default value: ``undef``
##### `protected_mode`
Data type: `Boolean`
Whether protected mode is enabled or not. Only applicable when no bind is set.
Default value: ``true``
##### `package_name`
Data type: `String[1]`
The name of the package that installs sentinel.
Default value: `$redis::params::sentinel_package_name`
##### `package_ensure`
Data type: `String[1]`
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`
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]]`
Allow optional sentinel server ip binding. Can help overcome
issues arising from protect-mode added Redis 3.2
Default value: ``undef``
##### `sentinel_port`
Data type: `Stdlib::Port`
The port of sentinel server.
Default value: `26379`
##### `service_group`
Data type: `String[1]`
The group of the config file.
Default value: `'redis'`
##### `service_name`
Data type: `String[1]`
The name of the service (for puppet to manage).
Default value: `$redis::params::sentinel_service_name`
##### `service_user`
Data type: `String[1]`
The owner of the config file.
Default value: `'redis'`
##### `service_enable`
Data type: `Boolean`
Enable the service at boot time.
Default value: ``true``
##### `working_dir`
Data type: `Stdlib::Absolutepath`
The directory into which sentinel will change to avoid mount
conflicts.
Default value: `$redis::params::sentinel_working_dir`
##### `notification_script`
Data type: `Optional[Stdlib::Absolutepath]`
Path to the notification script
Default value: ``undef``
##### `client_reconfig_script`
Data type: `Optional[Stdlib::Absolutepath]`
Path to the client-reconfig script
Default value: ``undef``
##### `service_ensure`
Data type: `Stdlib::Ensure::Service`
Default value: `'running'`
## Defined types
### `redis::instance`
This is an defined type to allow the configuration of
multiple redis instances on one machine without conflicts
#### Examples
-#####
+#####
```puppet
redis::instance {'6380':
port => 6380,
}
```
#### Parameters
The following parameters are available in the `redis::instance` defined type:
* [`activerehashing`](#activerehashing)
* [`aof_load_truncated`](#aof_load_truncated)
* [`aof_rewrite_incremental_fsync`](#aof_rewrite_incremental_fsync)
* [`appendfilename`](#appendfilename)
* [`appendfsync`](#appendfsync)
* [`appendonly`](#appendonly)
* [`auto_aof_rewrite_min_size`](#auto_aof_rewrite_min_size)
* [`auto_aof_rewrite_percentage`](#auto_aof_rewrite_percentage)
* [`bind`](#bind)
* [`config_file_orig`](#config_file_orig)
* [`config_file`](#config_file)
* [`config_file_mode`](#config_file_mode)
* [`config_group`](#config_group)
* [`config_owner`](#config_owner)
* [`conf_template`](#conf_template)
* [`daemonize`](#daemonize)
* [`databases`](#databases)
* [`dbfilename`](#dbfilename)
* [`extra_config_file`](#extra_config_file)
* [`hash_max_ziplist_entries`](#hash_max_ziplist_entries)
* [`hash_max_ziplist_value`](#hash_max_ziplist_value)
* [`hll_sparse_max_bytes`](#hll_sparse_max_bytes)
* [`hz`](#hz)
* [`latency_monitor_threshold`](#latency_monitor_threshold)
* [`list_max_ziplist_entries`](#list_max_ziplist_entries)
* [`list_max_ziplist_value`](#list_max_ziplist_value)
* [`log_dir`](#log_dir)
* [`log_dir_mode`](#log_dir_mode)
* [`log_file`](#log_file)
* [`log_level`](#log_level)
* [`masterauth`](#masterauth)
* [`maxclients`](#maxclients)
* [`maxmemory`](#maxmemory)
* [`maxmemory_policy`](#maxmemory_policy)
* [`maxmemory_samples`](#maxmemory_samples)
* [`min_slaves_max_lag`](#min_slaves_max_lag)
* [`min_slaves_to_write`](#min_slaves_to_write)
* [`no_appendfsync_on_rewrite`](#no_appendfsync_on_rewrite)
* [`notify_keyspace_events`](#notify_keyspace_events)
* [`pid_file`](#pid_file)
* [`port`](#port)
* [`protected_mode`](#protected_mode)
* [`rdbcompression`](#rdbcompression)
* [`rename_commands`](#rename_commands)
* [`repl_backlog_size`](#repl_backlog_size)
* [`repl_backlog_ttl`](#repl_backlog_ttl)
* [`repl_disable_tcp_nodelay`](#repl_disable_tcp_nodelay)
* [`repl_ping_slave_period`](#repl_ping_slave_period)
* [`repl_timeout`](#repl_timeout)
* [`requirepass`](#requirepass)
* [`save_db_to_disk`](#save_db_to_disk)
* [`save_db_to_disk_interval`](#save_db_to_disk_interval)
* [`service_name`](#service_name)
* [`service_enable`](#service_enable)
* [`service_ensure`](#service_ensure)
* [`service_group`](#service_group)
* [`service_user`](#service_user)
* [`set_max_intset_entries`](#set_max_intset_entries)
* [`slave_priority`](#slave_priority)
* [`slave_read_only`](#slave_read_only)
* [`slave_serve_stale_data`](#slave_serve_stale_data)
* [`slaveof`](#slaveof)
* [`slowlog_log_slower_than`](#slowlog_log_slower_than)
* [`slowlog_max_len`](#slowlog_max_len)
* [`stop_writes_on_bgsave_error`](#stop_writes_on_bgsave_error)
* [`syslog_enabled`](#syslog_enabled)
* [`syslog_facility`](#syslog_facility)
* [`tcp_backlog`](#tcp_backlog)
* [`tcp_keepalive`](#tcp_keepalive)
* [`timeout`](#timeout)
* [`ulimit`](#ulimit)
* [`ulimit_managed`](#ulimit_managed)
* [`unixsocket`](#unixsocket)
* [`unixsocketperm`](#unixsocketperm)
* [`workdir`](#workdir)
* [`workdir_mode`](#workdir_mode)
* [`zset_max_ziplist_entries`](#zset_max_ziplist_entries)
* [`zset_max_ziplist_value`](#zset_max_ziplist_value)
* [`cluster_enabled`](#cluster_enabled)
* [`cluster_config_file`](#cluster_config_file)
* [`cluster_node_timeout`](#cluster_node_timeout)
* [`cluster_slave_validity_factor`](#cluster_slave_validity_factor)
* [`cluster_require_full_coverage`](#cluster_require_full_coverage)
* [`cluster_migration_barrier`](#cluster_migration_barrier)
* [`output_buffer_limit_slave`](#output_buffer_limit_slave)
* [`output_buffer_limit_pubsub`](#output_buffer_limit_pubsub)
* [`managed_by_cluster_manager`](#managed_by_cluster_manager)
* [`manage_service_file`](#manage_service_file)
##### `activerehashing`
Data type: `Boolean`
Enable/disable active rehashing.
Default value: `$redis::activerehashing`
##### `aof_load_truncated`
Data type: `Boolean`
Enable/disable loading truncated AOF file
Default value: `$redis::aof_load_truncated`
##### `aof_rewrite_incremental_fsync`
Data type: `Boolean`
Enable/disable fsync for AOF file
Default value: `$redis::aof_rewrite_incremental_fsync`
##### `appendfilename`
Data type: `String[1]`
The name of the append only file
Default value: `$redis::appendfilename`
##### `appendfsync`
Data type: `Enum['no', 'always', 'everysec']`
Adjust fsync mode. Valid options: always, everysec, no.
Default value: `$redis::appendfsync`
##### `appendonly`
Data type: `Boolean`
Enable/disable appendonly mode.
Default value: `$redis::appendonly`
##### `auto_aof_rewrite_min_size`
Data type: `String[1]`
Adjust minimum size for auto-aof-rewrite.
Default value: `$redis::auto_aof_rewrite_min_size`
##### `auto_aof_rewrite_percentage`
Data type: `Integer[0]`
Adjust percentatge for auto-aof-rewrite.
Default value: `$redis::auto_aof_rewrite_percentage`
##### `bind`
Data type: `Variant[Stdlib::IP::Address, Array[Stdlib::IP::Address]]`
Configure which IP address(es) to listen on. To bind on all interfaces, use an empty array.
Default value: `$redis::bind`
##### `config_file_orig`
Data type: `Stdlib::Absolutepath`
The location and name of a config file that provides the source
Default value: `$redis::config_file_orig`
##### `config_file`
Data type: `Stdlib::Absolutepath`
Adjust main configuration file.
Default value: `$redis::config_file`
##### `config_file_mode`
Data type: `Stdlib::Filemode`
Adjust permissions for configuration files.
Default value: `$redis::config_file_mode`
##### `config_group`
Data type: `String[1]`
Adjust filesystem group for config files.
Default value: `$redis::config_group`
##### `config_owner`
Data type: `String[1]`
Adjust filesystem owner for config files.
Default value: `$redis::config_owner`
##### `conf_template`
Data type: `String[1]`
Define which template to use.
Default value: `$redis::conf_template`
##### `daemonize`
Data type: `Boolean`
Have Redis run as a daemon.
Default value: ``true``
##### `databases`
Data type: `Integer[1]`
Set the number of databases.
Default value: `$redis::databases`
##### `dbfilename`
Data type: `Variant[String[1], Boolean]`
The filename where to dump the DB
Default value: `$redis::dbfilename`
##### `extra_config_file`
Data type: `Optional[String]`
Optional extra config file to include
Default value: `$redis::extra_config_file`
##### `hash_max_ziplist_entries`
Data type: `Integer[0]`
Set max ziplist entries for hashes.
Default value: `$redis::hash_max_ziplist_entries`
##### `hash_max_ziplist_value`
Data type: `Integer[0]`
Set max ziplist values for hashes.
Default value: `$redis::hash_max_ziplist_value`
##### `hll_sparse_max_bytes`
Data type: `Integer[0]`
HyperLogLog sparse representation bytes limit
Default value: `$redis::hll_sparse_max_bytes`
##### `hz`
Data type: `Integer[1, 500]`
Set redis background tasks frequency
Default value: `$redis::hz`
##### `latency_monitor_threshold`
Data type: `Integer[0]`
Latency monitoring threshold in milliseconds
Default value: `$redis::latency_monitor_threshold`
##### `list_max_ziplist_entries`
Data type: `Integer[0]`
Set max ziplist entries for lists.
Default value: `$redis::list_max_ziplist_entries`
##### `list_max_ziplist_value`
Data type: `Integer[0]`
Set max ziplist values for lists.
Default value: `$redis::list_max_ziplist_value`
##### `log_dir`
Data type: `Stdlib::Absolutepath`
Specify directory where to write log entries.
Default value: `$redis::log_dir`
##### `log_dir_mode`
Data type: `Stdlib::Filemode`
Adjust mode for directory containing log files.
Default value: `$redis::log_dir_mode`
##### `log_file`
Data type: `String`
Specify file where to write log entries. Relative paths will be prepended
with log_dir but absolute paths are also accepted.
Default value: `"redis-server-${name}.log"`
##### `log_level`
Data type: `Redis::LogLevel`
Specify the server verbosity level.
Default value: `$redis::log_level`
##### `masterauth`
Data type: `Optional[String[1]]`
If the master is password protected (using the "requirepass" configuration
Default value: `$redis::masterauth`
##### `maxclients`
Data type: `Integer[1]`
Set the max number of connected clients at the same time.
Default value: `$redis::maxclients`
##### `maxmemory`
Data type: `Any`
Don't use more memory than the specified amount of bytes.
Default value: `$redis::maxmemory`
##### `maxmemory_policy`
Data type: `Any`
How Redis will select what to remove when maxmemory is reached.
Default value: `$redis::maxmemory_policy`
##### `maxmemory_samples`
Data type: `Any`
Select as well the sample size to check.
Default value: `$redis::maxmemory_samples`
##### `min_slaves_max_lag`
Data type: `Integer[0]`
The lag in seconds
Default value: `$redis::min_slaves_max_lag`
##### `min_slaves_to_write`
Data type: `Integer[0]`
Minimum number of slaves to be in "online" state
Default value: `$redis::min_slaves_to_write`
##### `no_appendfsync_on_rewrite`
Data type: `Boolean`
If you have latency problems turn this to 'true'. Otherwise leave it as
Default value: `$redis::no_appendfsync_on_rewrite`
##### `notify_keyspace_events`
Data type: `Optional[String[1]]`
Which events to notify Pub/Sub clients about events happening
Default value: `$redis::notify_keyspace_events`
##### `pid_file`
Data type: `Stdlib::Absolutepath`
Where to store the pid.
Default value: `"/var/run/redis/redis-server-${name}.pid"`
##### `port`
Data type: `Stdlib::Port`
Configure which port to listen on.
Default value: `$redis::port`
##### `protected_mode`
Data type: `Boolean`
Whether protected mode is enabled or not. Only applicable when no bind is set.
Default value: `$redis::protected_mode`
##### `rdbcompression`
Data type: `Boolean`
Enable/disable compression of string objects using LZF when dumping.
Default value: `$redis::rdbcompression`
##### `rename_commands`
Data type: `Hash[String,String]`
A list of Redis commands to rename or disable for security reasons
Default value: `$redis::rename_commands`
##### `repl_backlog_size`
Data type: `String[1]`
The replication backlog size
Default value: `$redis::repl_backlog_size`
##### `repl_backlog_ttl`
Data type: `Integer[0]`
The number of seconds to elapse before freeing backlog buffer
Default value: `$redis::repl_backlog_ttl`
##### `repl_disable_tcp_nodelay`
Data type: `Boolean`
Enable/disable TCP_NODELAY on the slave socket after SYNC
Default value: `$redis::repl_disable_tcp_nodelay`
##### `repl_ping_slave_period`
Data type: `Integer[1]`
Slaves send PINGs to server in a predefined interval. It's possible
Default value: `$redis::repl_ping_slave_period`
##### `repl_timeout`
Data type: `Integer[1]`
Set the replication timeout for:
Default value: `$redis::repl_timeout`
##### `requirepass`
Data type: `Optional[String]`
Require clients to issue AUTH before processing any other
commands.
Default value: `$redis::requirepass`
##### `save_db_to_disk`
Data type: `Boolean`
Set if save db to disk.
Default value: `$redis::save_db_to_disk`
##### `save_db_to_disk_interval`
Data type: `Hash`
save the dataset every N seconds if there are at least M changes in the dataset
Default value: `$redis::save_db_to_disk_interval`
##### `service_name`
Data type: `String[1]`
The service name for this instance
Default value: `"redis-server-${name}"`
##### `service_enable`
Data type: `Boolean`
Enable/disable daemon at boot.
Default value: `$redis::service_enable`
##### `service_ensure`
Data type: `Stdlib::Ensure::Service`
Specify if the server should be running.
Default value: `$redis::service_ensure`
##### `service_group`
Data type: `String[1]`
Specify which group to run as.
Default value: `$redis::service_group`
##### `service_user`
Data type: `String[1]`
Specify which user to run as.
Default value: `$redis::service_user`
##### `set_max_intset_entries`
Data type: `Integer[0]`
The following configuration setting sets the limit in the size of the set
in order to use this special memory saving encoding.
Default value: `$redis::set_max_intset_entries`
##### `slave_priority`
Data type: `Integer[0]`
The priority number for slave promotion by Sentinel
Default value: `$redis::slave_priority`
##### `slave_read_only`
Data type: `Boolean`
You can configure a slave instance to accept writes or not.
Default value: `$redis::slave_read_only`
##### `slave_serve_stale_data`
Data type: `Boolean`
When a slave loses its connection with the master, or when the replication
is still in progress, the slave can act in two different ways:
1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
still reply to client requests, possibly with out of date data, or the
data set may just be empty if this is the first synchronization.
2) if slave-serve-stale-data is set to 'no' the slave will reply with
an error "SYNC with master in progress" to all the kind of commands
but to INFO and SLAVEOF.
Default value: `$redis::slave_serve_stale_data`
##### `slaveof`
Data type: `Optional[String[1]]`
Use slaveof to make a Redis instance a copy of another Redis server.
Default value: `$redis::slaveof`
##### `slowlog_log_slower_than`
Data type: `Integer[0]`
Tells Redis what is the execution time, in microseconds, to exceed in order
for the command to get logged.
Default value: `$redis::slowlog_log_slower_than`
##### `slowlog_max_len`
Data type: `Integer[0]`
Tells Redis what is the length to exceed in order for the command
to get logged.
Default value: `$redis::slowlog_max_len`
##### `stop_writes_on_bgsave_error`
Data type: `Boolean`
If false then Redis will continue to work as usual even if there
are problems with disk, permissions, and so forth.
Default value: `$redis::stop_writes_on_bgsave_error`
##### `syslog_enabled`
Data type: `Boolean`
Enable/disable logging to the system logger.
Default value: `$redis::syslog_enabled`
##### `syslog_facility`
Data type: `Optional[String[1]]`
Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
Default value: `$redis::syslog_facility`
##### `tcp_backlog`
Data type: `Integer[0]`
Sets the TCP backlog
Default value: `$redis::tcp_backlog`
##### `tcp_keepalive`
Data type: `Integer[0]`
TCP keepalive.
Default value: `$redis::tcp_keepalive`
##### `timeout`
Data type: `Integer[0]`
Close the connection after a client is idle for N seconds (0 to disable).
Default value: `$redis::timeout`
##### `ulimit`
Data type: `Integer[0]`
Limit the use of system-wide resources.
Default value: `$redis::ulimit`
##### `ulimit_managed`
Data type: `Boolean`
Defines wheter the max number of open files for the
systemd service unit is explicitly managed.
Default value: `$redis::ulimit_managed`
##### `unixsocket`
Data type: `Variant[Stdlib::Absolutepath, Enum['']]`
Define unix socket path
Default value: `"/var/run/redis/redis-server-${name}.sock"`
##### `unixsocketperm`
Data type: `Variant[Stdlib::Filemode , Enum['']]`
Define unix socket file permissions
Default value: `$redis::unixsocketperm`
##### `workdir`
Data type: `Stdlib::Absolutepath`
The DB will be written inside this directory, with the filename specified
above using the 'dbfilename' configuration directive.
Default value: `"${redis::workdir}/redis-server-${name}"`
##### `workdir_mode`
Data type: `Stdlib::Filemode`
Adjust mode for data directory.
Default value: `$redis::workdir_mode`
##### `zset_max_ziplist_entries`
Data type: `Integer[0]`
Set max entries for sorted sets.
Default value: `$redis::zset_max_ziplist_entries`
##### `zset_max_ziplist_value`
Data type: `Integer[0]`
Set max values for sorted sets.
Default value: `$redis::zset_max_ziplist_value`
##### `cluster_enabled`
Data type: `Boolean`
Enables redis 3.0 cluster functionality
Default value: `$redis::cluster_enabled`
##### `cluster_config_file`
Data type: `String[1]`
Config file for saving cluster nodes configuration. This file is never
touched by humans. Only set if cluster_enabled is true
Default value: `$redis::cluster_config_file`
##### `cluster_node_timeout`
Data type: `Integer[1]`
Node timeout. Only set if cluster_enabled is true
Default value: `$redis::cluster_node_timeout`
##### `cluster_slave_validity_factor`
Data type: `Integer[0]`
Control variable to disable promoting slave in case of disconnection from
master Only set if cluster_enabled is true
Default value: `$redis::cluster_slave_validity_factor`
##### `cluster_require_full_coverage`
Data type: `Boolean`
If false Redis Cluster will server queries even if requests about a subset
of keys can be processed Only set if cluster_enabled is true
Default value: `$redis::cluster_require_full_coverage`
##### `cluster_migration_barrier`
Data type: `Integer[0]`
Minimum number of slaves master will remain connected with, for another
slave to migrate to a master which is no longer covered by any slave Only
set if cluster_enabled is true
Default value: `$redis::cluster_migration_barrier`
##### `output_buffer_limit_slave`
Data type: `String[1]`
Default value: `$redis::output_buffer_limit_slave`
##### `output_buffer_limit_pubsub`
Data type: `String[1]`
Default value: `$redis::output_buffer_limit_pubsub`
##### `managed_by_cluster_manager`
Data type: `Boolean`
Default value: `$redis::managed_by_cluster_manager`
##### `manage_service_file`
Data type: `Boolean`
Default value: ``true``
## Functions
### `redis::get`
Type: Ruby 4.x API
```
#### `redis::get(String[1] $key, Redis::RedisUrl $url, Optional[String] $default)`
```
Returns: `Optional[String]` Returns the value of the key from Redis
##### `key`
Data type: `String[1]`
The key to look up in redis
##### `url`
Data type: `Redis::RedisUrl`
The endpoint of the Redis instance
##### `default`
Data type: `Optional[String]`
The value to return if the key is not found or the connection to Redis fails
## Data types
### `Redis::LogLevel`
This can be one of:
* debug (a lot of information, useful for development/testing)
* verbose (many rarely useful info, but not a mess like the debug level)
* notice (moderately verbose, what you want in production probably)
* warning (only very important / critical messages are logged)
Alias of
```puppet
Enum['debug', 'verbose', 'notice', 'warning']
```
### `Redis::RedisUrl`
The Redis::RedisUrl data type.
Alias of
```puppet
Pattern[/(^redis:\/\/)/]
```
## Tasks
### `redis_cli`
Executes a redis-cli command on the target system
**Supports noop?** false
#### Parameters
##### `command`
Data type: `String[1]`
The command to run, including all arguments
diff --git a/manifests/init.pp b/manifests/init.pp
index 52b4508..a8b7181 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,353 +1,353 @@
# This class installs redis
#
# @example Default install
# include redis
#
# @example Slave Node
# class { '::redis':
# bind => '10.0.1.2',
# slaveof => '10.0.1.1 6379',
# }
#
# @example Binding on multiple interfaces
# class { 'redis':
# bind => ['127.0.0.1', '10.0.0.1', '10.1.0.1'],
# }
#
# @example Binding on all interfaces
# class { 'redis':
# bind => [],
# }
#
# @param activerehashing
# Enable/disable active rehashing.
# @param aof_load_truncated
# Enable/disable loading truncated AOF file
# @param aof_rewrite_incremental_fsync
# Enable/disable fsync for AOF file
# @param appendfilename
# The name of the append only file
# @param appendfsync
# Adjust fsync mode
# @param appendonly
# Enable/disable appendonly mode.
# @param auto_aof_rewrite_min_size
# Adjust minimum size for auto-aof-rewrite.
# @param auto_aof_rewrite_percentage
# Adjust percentatge for auto-aof-rewrite.
# @param bind
# Configure which IP address(es) to listen on. To bind on all interfaces, use an empty array.
# @param config_dir
# Directory containing the configuration files.
# @param config_dir_mode
# Adjust mode for directory containing configuration files.
# @param config_file_orig
# The location and name of a config file that provides the source
# @param config_file
# Adjust main configuration file.
# @param config_file_mode
# Adjust permissions for configuration files.
# @param config_group
# Adjust filesystem group for config files.
# @param config_owner
# Adjust filesystem owner for config files.
# @param conf_template
# Define which template to use.
# @param daemonize
# Have Redis run as a daemon.
# @param default_install
# Configure a default install of redis.
# @param databases
# Set the number of databases.
# @param dbfilename
# The filename where to dump the DB
# @param extra_config_file
# Optional extra config file to include
# @param hash_max_ziplist_entries
# Set max ziplist entries for hashes.
# @param hash_max_ziplist_value
# Set max ziplist values for hashes.
# @param hll_sparse_max_bytes
# HyperLogLog sparse representation bytes limit
# @param hz
# Set redis background tasks frequency
# @param latency_monitor_threshold
# Latency monitoring threshold in milliseconds
# @param list_max_ziplist_entries
# Set max ziplist entries for lists.
# @param list_max_ziplist_value
# Set max ziplist values for lists.
# @param log_dir
# Specify directory where to write log entries.
# @param log_dir_mode
# Adjust mode for directory containing log files.
# @param log_file
# Specify file where to write log entries. Relative paths will be prepended
# with log_dir but absolute paths are also accepted.
# @param log_level
# Specify the server verbosity level.
# @param manage_repo
# Enable/disable upstream repository configuration.
# @param manage_package
# Enable/disable management of package
# @param managed_by_cluster_manager
# Choose if redis will be managed by a cluster manager such as pacemaker or rgmanager
# @param masterauth
# If the master is password protected (using the "requirepass" configuration
# @param maxclients
# Set the max number of connected clients at the same time.
# @param maxmemory
# Don't use more memory than the specified amount of bytes.
# @param maxmemory_policy
# How Redis will select what to remove when maxmemory is reached.
# @param maxmemory_samples
# Select as well the sample size to check.
# @param min_slaves_max_lag
# The lag in seconds
# @param min_slaves_to_write
# Minimum number of slaves to be in "online" state
# @param no_appendfsync_on_rewrite
# If you have latency problems turn this to 'true'. Otherwise leave it as
# @param notify_keyspace_events
# Which events to notify Pub/Sub clients about events happening
# @param notify_service
# You may disable service reloads when config files change if you
# @param package_ensure
# Default action for package.
# @param package_name
# Upstream package name.
# @param pid_file
# Where to store the pid.
# @param port
# Configure which port to listen on.
# @param protected_mode
# Whether protected mode is enabled or not. Only applicable when no bind is set.
# @param ppa_repo
# Specify upstream (Ubuntu) PPA entry.
# @param rdbcompression
# Enable/disable compression of string objects using LZF when dumping.
# @param rename_commands
# A list of Redis commands to rename or disable for security reasons
# @param repl_backlog_size
# The replication backlog size
# @param repl_backlog_ttl
# The number of seconds to elapse before freeing backlog buffer
# @param repl_disable_tcp_nodelay
# Enable/disable TCP_NODELAY on the slave socket after SYNC
# @param repl_ping_slave_period
# Slaves send PINGs to server in a predefined interval. It's possible
# @param repl_timeout
# Set the replication timeout for:
# @param requirepass
# Require clients to issue AUTH before processing any other commands.
# @param save_db_to_disk
# Set if save db to disk.
# @param save_db_to_disk_interval
# save the dataset every N seconds if there are at least M changes in the dataset
# @param service_manage
# Specify if the service should be part of the catalog.
# @param service_enable
# Enable/disable daemon at boot.
# @param service_ensure
# Specify if the server should be running.
# @param service_group
# Specify which group to run as.
# @param service_name
# Specify the service name for Init or Systemd.
# @param service_user
# Specify which user to run as.
# @param set_max_intset_entries
# The following configuration setting sets the limit in the size of the set
# in order to use this special memory saving encoding.
# @param slave_priority
# The priority number for slave promotion by Sentinel
# @param slave_read_only
# You can configure a slave instance to accept writes or not.
# @param slave_serve_stale_data
# When a slave loses its connection with the master, or when the replication
# is still in progress, the slave can act in two different ways:
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
# still reply to client requests, possibly with out of date data, or the
# data set may just be empty if this is the first synchronization.
# 2) if slave-serve-stale-data is set to 'no' the slave will reply with
# an error "SYNC with master in progress" to all the kind of commands
# but to INFO and SLAVEOF.
# @param slaveof
# Use slaveof to make a Redis instance a copy of another Redis server.
# @param slowlog_log_slower_than
# Tells Redis what is the execution time, in microseconds, to exceed in order
# for the command to get logged.
# @param slowlog_max_len
# Tells Redis what is the length to exceed in order for the command to get
# logged.
# @param stop_writes_on_bgsave_error
# If false then Redis will continue to work as usual even if there are
# problems with disk, permissions, and so forth.
# @param syslog_enabled
# Enable/disable logging to the system logger.
# @param syslog_facility
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# @param tcp_backlog
# Sets the TCP backlog
# @param tcp_keepalive
# TCP keepalive.
# @param timeout
# Close the connection after a client is idle for N seconds (0 to disable).
# @param ulimit
# Limit the use of system-wide resources.
# @param ulimit_managed
# Defines wheter the max number of open files for the
# systemd service unit is explicitly managed.
# @param unixsocket
# Define unix socket path
# @param unixsocketperm
# Define unix socket file permissions
# @param workdir
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
# @param workdir_mode
# Adjust mode for data directory.
# @param zset_max_ziplist_entries
# Set max entries for sorted sets.
# @param zset_max_ziplist_value
# Set max values for sorted sets.
# @param cluster_enabled
# Enables redis 3.0 cluster functionality
# @param cluster_config_file
# Config file for saving cluster nodes configuration. This file is never
# touched by humans. Only set if cluster_enabled is true
# @param cluster_node_timeout
# Node timeout. Only set if cluster_enabled is true
# @param cluster_slave_validity_factor
# Control variable to disable promoting slave in case of disconnection from master
# Only set if cluster_enabled is true
# @param cluster_require_full_coverage
# If false Redis Cluster will server queries even if requests about a subset of keys can be processed
# Only set if cluster_enabled is true
# @param cluster_migration_barrier
# Minimum number of slaves master will remain connected with, for another
# slave to migrate to a master which is no longer covered by any slave.
# Only set if cluster_enabled is true
# @param instances
# Iterate through multiple instance configurations
class redis (
Boolean $activerehashing = true,
Boolean $aof_load_truncated = true,
Boolean $aof_rewrite_incremental_fsync = true,
String[1] $appendfilename = 'appendonly.aof',
Enum['no', 'always', 'everysec'] $appendfsync = 'everysec',
Boolean $appendonly = false,
String[1] $auto_aof_rewrite_min_size = '64mb',
Integer[0] $auto_aof_rewrite_percentage = 100,
Variant[Stdlib::IP::Address, Array[Stdlib::IP::Address]] $bind = ['127.0.0.1'],
String[1] $output_buffer_limit_slave = '256mb 64mb 60',
String[1] $output_buffer_limit_pubsub = '32mb 8mb 60',
- String[1] $conf_template = 'redis/redis.conf.erb',
+ String[1] $conf_template = 'redis/redis.conf.epp',
Stdlib::Absolutepath $config_dir = $redis::params::config_dir,
Stdlib::Filemode $config_dir_mode = $redis::params::config_dir_mode,
Stdlib::Absolutepath $config_file = $redis::params::config_file,
Stdlib::Filemode $config_file_mode = '0644',
Stdlib::Absolutepath $config_file_orig = $redis::params::config_file_orig,
String[1] $config_group = $redis::params::config_group,
String[1] $config_owner = $redis::params::config_owner,
Boolean $daemonize = $redis::params::daemonize,
Integer[1] $databases = 16,
Boolean $default_install = true,
Variant[String[1], Boolean] $dbfilename = 'dump.rdb',
Optional[String] $extra_config_file = undef,
Integer[0] $hash_max_ziplist_entries = 512,
Integer[0] $hash_max_ziplist_value = 64,
Integer[0] $hll_sparse_max_bytes = 3000,
Integer[1, 500] $hz = 10,
Integer[0] $latency_monitor_threshold = 0,
Integer[0] $list_max_ziplist_entries = 512,
Integer[0] $list_max_ziplist_value = 64,
Stdlib::Absolutepath $log_dir = $redis::params::log_dir,
Stdlib::Filemode $log_dir_mode = $redis::params::log_dir_mode,
String $log_file = 'redis.log',
Redis::LogLevel $log_level = 'notice',
Boolean $manage_service_file = false,
Boolean $manage_package = true,
Boolean $manage_repo = false,
Optional[String[1]] $masterauth = undef,
Integer[1] $maxclients = 10000,
$maxmemory = undef,
$maxmemory_policy = undef,
$maxmemory_samples = undef,
Integer[0] $min_slaves_max_lag = 10,
Integer[0] $min_slaves_to_write = 0,
Boolean $no_appendfsync_on_rewrite = false,
Optional[String[1]] $notify_keyspace_events = undef,
Boolean $notify_service = true,
Boolean $managed_by_cluster_manager = false,
String[1] $package_ensure = 'present',
String[1] $package_name = $redis::params::package_name,
Stdlib::Absolutepath $pid_file = $redis::params::pid_file,
Stdlib::Port $port = 6379,
Boolean $protected_mode = true,
Optional[String] $ppa_repo = $redis::params::ppa_repo,
Boolean $rdbcompression = true,
Hash[String,String] $rename_commands = {},
String[1] $repl_backlog_size = '1mb',
Integer[0] $repl_backlog_ttl = 3600,
Boolean $repl_disable_tcp_nodelay = false,
Integer[1] $repl_ping_slave_period = 10,
Integer[1] $repl_timeout = 60,
Optional[String] $requirepass = undef,
Boolean $save_db_to_disk = true,
Hash $save_db_to_disk_interval = { '900' => '1', '300' => '10', '60' => '10000' },
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
String[1] $service_group = 'redis',
Boolean $service_manage = true,
String[1] $service_name = $redis::params::service_name,
String[1] $service_user = 'redis',
Integer[0] $set_max_intset_entries = 512,
Integer[0] $slave_priority = 100,
Boolean $slave_read_only = true,
Boolean $slave_serve_stale_data = true,
Optional[String[1]] $slaveof = undef,
Integer[0] $slowlog_log_slower_than = 10000,
Integer[0] $slowlog_max_len = 1024,
Boolean $stop_writes_on_bgsave_error = true,
Boolean $syslog_enabled = false,
Optional[String[1]] $syslog_facility = undef,
Integer[0] $tcp_backlog = 511,
Integer[0] $tcp_keepalive = 0,
Integer[0] $timeout = 0,
Variant[Stdlib::Absolutepath, Enum['']] $unixsocket = '/var/run/redis/redis.sock',
Variant[Stdlib::Filemode, Enum['']] $unixsocketperm = '0755',
Integer[0] $ulimit = 65536,
Boolean $ulimit_managed = true,
Stdlib::Absolutepath $workdir = $redis::params::workdir,
Stdlib::Filemode $workdir_mode = '0750',
Integer[0] $zset_max_ziplist_entries = 128,
Integer[0] $zset_max_ziplist_value = 64,
Boolean $cluster_enabled = false,
String[1] $cluster_config_file = 'nodes.conf',
Integer[1] $cluster_node_timeout = 5000,
Integer[0] $cluster_slave_validity_factor = 0,
Boolean $cluster_require_full_coverage = true,
Integer[0] $cluster_migration_barrier = 1,
Hash[String[1], Hash] $instances = {},
) inherits redis::params {
contain redis::preinstall
contain redis::install
contain redis::config
contain redis::service
$instances.each | String $key, Hash $values | {
redis::instance { $key:
* => $values,
}
}
Class['redis::preinstall']
-> Class['redis::install']
-> Class['redis::config']
if $redis::notify_service {
Class['redis::config']
~> Class['redis::service']
}
}
diff --git a/manifests/instance.pp b/manifests/instance.pp
index 013c1bd..6f80e8c 100644
--- a/manifests/instance.pp
+++ b/manifests/instance.pp
@@ -1,366 +1,440 @@
# This is an defined type to allow the configuration of
# multiple redis instances on one machine without conflicts
#
# @summary Allows the configuration of multiple redis configurations on one machine
#
# @example
# redis::instance {'6380':
# port => 6380,
# }
#
# @param activerehashing
# Enable/disable active rehashing.
# @param aof_load_truncated
# Enable/disable loading truncated AOF file
# @param aof_rewrite_incremental_fsync
# Enable/disable fsync for AOF file
# @param appendfilename
# The name of the append only file
# @param appendfsync
# Adjust fsync mode. Valid options: always, everysec, no.
# @param appendonly
# Enable/disable appendonly mode.
# @param auto_aof_rewrite_min_size
# Adjust minimum size for auto-aof-rewrite.
# @param auto_aof_rewrite_percentage
# Adjust percentatge for auto-aof-rewrite.
# @param bind
# Configure which IP address(es) to listen on. To bind on all interfaces, use an empty array.
# @param config_file_orig
# The location and name of a config file that provides the source
# @param config_file
# Adjust main configuration file.
# @param config_file_mode
# Adjust permissions for configuration files.
# @param config_group
# Adjust filesystem group for config files.
# @param config_owner
# Adjust filesystem owner for config files.
# @param conf_template
# Define which template to use.
# @param daemonize
# Have Redis run as a daemon.
# @param databases
# Set the number of databases.
# @param dbfilename
# The filename where to dump the DB
# @param extra_config_file
# Optional extra config file to include
# @param hash_max_ziplist_entries
# Set max ziplist entries for hashes.
# @param hash_max_ziplist_value
# Set max ziplist values for hashes.
# @param hll_sparse_max_bytes
# HyperLogLog sparse representation bytes limit
# @param hz
# Set redis background tasks frequency
# @param latency_monitor_threshold
# Latency monitoring threshold in milliseconds
# @param list_max_ziplist_entries
# Set max ziplist entries for lists.
# @param list_max_ziplist_value
# Set max ziplist values for lists.
# @param log_dir
# Specify directory where to write log entries.
# @param log_dir_mode
# Adjust mode for directory containing log files.
# @param log_file
# Specify file where to write log entries. Relative paths will be prepended
# with log_dir but absolute paths are also accepted.
# @param log_level
# Specify the server verbosity level.
# @param masterauth
# If the master is password protected (using the "requirepass" configuration
# @param maxclients
# Set the max number of connected clients at the same time.
# @param maxmemory
# Don't use more memory than the specified amount of bytes.
# @param maxmemory_policy
# How Redis will select what to remove when maxmemory is reached.
# @param maxmemory_samples
# Select as well the sample size to check.
# @param min_slaves_max_lag
# The lag in seconds
# @param min_slaves_to_write
# Minimum number of slaves to be in "online" state
# @param no_appendfsync_on_rewrite
# If you have latency problems turn this to 'true'. Otherwise leave it as
# @param notify_keyspace_events
# Which events to notify Pub/Sub clients about events happening
# @param pid_file
# Where to store the pid.
# @param port
# Configure which port to listen on.
# @param protected_mode
# Whether protected mode is enabled or not. Only applicable when no bind is set.
# @param rdbcompression
# Enable/disable compression of string objects using LZF when dumping.
# @param rename_commands
# A list of Redis commands to rename or disable for security reasons
# @param repl_backlog_size
# The replication backlog size
# @param repl_backlog_ttl
# The number of seconds to elapse before freeing backlog buffer
# @param repl_disable_tcp_nodelay
# Enable/disable TCP_NODELAY on the slave socket after SYNC
# @param repl_ping_slave_period
# Slaves send PINGs to server in a predefined interval. It's possible
# @param repl_timeout
# Set the replication timeout for:
# @param requirepass
# Require clients to issue AUTH before processing any other
# commands.
# @param save_db_to_disk
# Set if save db to disk.
# @param save_db_to_disk_interval
# save the dataset every N seconds if there are at least M changes in the dataset
# @param service_name
# The service name for this instance
# @param service_enable
# Enable/disable daemon at boot.
# @param service_ensure
# Specify if the server should be running.
# @param service_group
# Specify which group to run as.
# @param service_user
# Specify which user to run as.
# @param set_max_intset_entries
# The following configuration setting sets the limit in the size of the set
# in order to use this special memory saving encoding.
# @param slave_priority
# The priority number for slave promotion by Sentinel
# @param slave_read_only
# You can configure a slave instance to accept writes or not.
# @param slave_serve_stale_data
# When a slave loses its connection with the master, or when the replication
# is still in progress, the slave can act in two different ways:
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
# still reply to client requests, possibly with out of date data, or the
# data set may just be empty if this is the first synchronization.
# 2) if slave-serve-stale-data is set to 'no' the slave will reply with
# an error "SYNC with master in progress" to all the kind of commands
# but to INFO and SLAVEOF.
# @param slaveof
# Use slaveof to make a Redis instance a copy of another Redis server.
# @param slowlog_log_slower_than
# Tells Redis what is the execution time, in microseconds, to exceed in order
# for the command to get logged.
# @param slowlog_max_len
# Tells Redis what is the length to exceed in order for the command
# to get logged.
# @param stop_writes_on_bgsave_error
# If false then Redis will continue to work as usual even if there
# are problems with disk, permissions, and so forth.
# @param syslog_enabled
# Enable/disable logging to the system logger.
# @param syslog_facility
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# @param tcp_backlog
# Sets the TCP backlog
# @param tcp_keepalive
# TCP keepalive.
# @param timeout
# Close the connection after a client is idle for N seconds (0 to disable).
# @param ulimit
# Limit the use of system-wide resources.
# @param ulimit_managed
# Defines wheter the max number of open files for the
# systemd service unit is explicitly managed.
# @param unixsocket
# Define unix socket path
# @param unixsocketperm
# Define unix socket file permissions
# @param workdir
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
# @param workdir_mode
# Adjust mode for data directory.
# @param zset_max_ziplist_entries
# Set max entries for sorted sets.
# @param zset_max_ziplist_value
# Set max values for sorted sets.
# @param cluster_enabled
# Enables redis 3.0 cluster functionality
# @param cluster_config_file
# Config file for saving cluster nodes configuration. This file is never
# touched by humans. Only set if cluster_enabled is true
# @param cluster_node_timeout
# Node timeout. Only set if cluster_enabled is true
# @param cluster_slave_validity_factor
# Control variable to disable promoting slave in case of disconnection from
# master Only set if cluster_enabled is true
# @param cluster_require_full_coverage
# If false Redis Cluster will server queries even if requests about a subset
# of keys can be processed Only set if cluster_enabled is true
# @param cluster_migration_barrier
# Minimum number of slaves master will remain connected with, for another
# slave to migrate to a master which is no longer covered by any slave Only
# set if cluster_enabled is true
define redis::instance (
Boolean $activerehashing = $redis::activerehashing,
Boolean $aof_load_truncated = $redis::aof_load_truncated,
Boolean $aof_rewrite_incremental_fsync = $redis::aof_rewrite_incremental_fsync,
String[1] $appendfilename = $redis::appendfilename,
Enum['no', 'always', 'everysec'] $appendfsync = $redis::appendfsync,
Boolean $appendonly = $redis::appendonly,
String[1] $auto_aof_rewrite_min_size = $redis::auto_aof_rewrite_min_size,
Integer[0] $auto_aof_rewrite_percentage = $redis::auto_aof_rewrite_percentage,
Variant[Stdlib::IP::Address, Array[Stdlib::IP::Address]] $bind = $redis::bind,
String[1] $output_buffer_limit_slave = $redis::output_buffer_limit_slave,
String[1] $output_buffer_limit_pubsub = $redis::output_buffer_limit_pubsub,
String[1] $conf_template = $redis::conf_template,
Stdlib::Absolutepath $config_file = $redis::config_file,
Stdlib::Filemode $config_file_mode = $redis::config_file_mode,
Stdlib::Absolutepath $config_file_orig = $redis::config_file_orig,
String[1] $config_group = $redis::config_group,
String[1] $config_owner = $redis::config_owner,
Boolean $daemonize = true,
Integer[1] $databases = $redis::databases,
Variant[String[1], Boolean] $dbfilename = $redis::dbfilename,
Optional[String] $extra_config_file = $redis::extra_config_file,
Integer[0] $hash_max_ziplist_entries = $redis::hash_max_ziplist_entries,
Integer[0] $hash_max_ziplist_value = $redis::hash_max_ziplist_value,
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,
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,
Stdlib::Filemode $log_dir_mode = $redis::log_dir_mode,
Redis::LogLevel $log_level = $redis::log_level,
Optional[String[1]] $masterauth = $redis::masterauth,
Integer[1] $maxclients = $redis::maxclients,
$maxmemory = $redis::maxmemory,
$maxmemory_policy = $redis::maxmemory_policy,
$maxmemory_samples = $redis::maxmemory_samples,
Integer[0] $min_slaves_max_lag = $redis::min_slaves_max_lag,
Integer[0] $min_slaves_to_write = $redis::min_slaves_to_write,
Boolean $no_appendfsync_on_rewrite = $redis::no_appendfsync_on_rewrite,
Optional[String[1]] $notify_keyspace_events = $redis::notify_keyspace_events,
Boolean $managed_by_cluster_manager = $redis::managed_by_cluster_manager,
Stdlib::Port $port = $redis::port,
Boolean $protected_mode = $redis::protected_mode,
Boolean $rdbcompression = $redis::rdbcompression,
Hash[String,String] $rename_commands = $redis::rename_commands,
String[1] $repl_backlog_size = $redis::repl_backlog_size,
Integer[0] $repl_backlog_ttl = $redis::repl_backlog_ttl,
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,
Optional[String] $requirepass = $redis::requirepass,
Boolean $save_db_to_disk = $redis::save_db_to_disk,
Hash $save_db_to_disk_interval = $redis::save_db_to_disk_interval,
String[1] $service_user = $redis::service_user,
Integer[0] $set_max_intset_entries = $redis::set_max_intset_entries,
Integer[0] $slave_priority = $redis::slave_priority,
Boolean $slave_read_only = $redis::slave_read_only,
Boolean $slave_serve_stale_data = $redis::slave_serve_stale_data,
Optional[String[1]] $slaveof = $redis::slaveof,
Integer[0] $slowlog_log_slower_than = $redis::slowlog_log_slower_than,
Integer[0] $slowlog_max_len = $redis::slowlog_max_len,
Boolean $stop_writes_on_bgsave_error = $redis::stop_writes_on_bgsave_error,
Boolean $syslog_enabled = $redis::syslog_enabled,
Optional[String[1]] $syslog_facility = $redis::syslog_facility,
Integer[0] $tcp_backlog = $redis::tcp_backlog,
Integer[0] $tcp_keepalive = $redis::tcp_keepalive,
Integer[0] $timeout = $redis::timeout,
Variant[Stdlib::Filemode , Enum['']] $unixsocketperm = $redis::unixsocketperm,
Integer[0] $ulimit = $redis::ulimit,
Boolean $ulimit_managed = $redis::ulimit_managed,
Stdlib::Filemode $workdir_mode = $redis::workdir_mode,
Integer[0] $zset_max_ziplist_entries = $redis::zset_max_ziplist_entries,
Integer[0] $zset_max_ziplist_value = $redis::zset_max_ziplist_value,
Boolean $cluster_enabled = $redis::cluster_enabled,
String[1] $cluster_config_file = $redis::cluster_config_file,
Integer[1] $cluster_node_timeout = $redis::cluster_node_timeout,
Integer[0] $cluster_slave_validity_factor = $redis::cluster_slave_validity_factor,
Boolean $cluster_require_full_coverage = $redis::cluster_require_full_coverage,
Integer[0] $cluster_migration_barrier = $redis::cluster_migration_barrier,
String[1] $service_name = "redis-server-${name}",
Stdlib::Ensure::Service $service_ensure = $redis::service_ensure,
Boolean $service_enable = $redis::service_enable,
String[1] $service_group = $redis::service_group,
Boolean $manage_service_file = true,
String $log_file = "redis-server-${name}.log",
Stdlib::Absolutepath $pid_file = "/var/run/redis/redis-server-${name}.pid",
Variant[Stdlib::Absolutepath, Enum['']] $unixsocket = "/var/run/redis/redis-server-${name}.sock",
Stdlib::Absolutepath $workdir = "${redis::workdir}/redis-server-${name}",
) {
if $title == 'default' {
$redis_file_name_orig = $config_file_orig
$redis_file_name = $config_file
} else {
$redis_file_name_orig = sprintf('%s/%s.%s', dirname($config_file_orig), $service_name, 'conf.puppet')
$redis_file_name = sprintf('%s/%s.%s', dirname($config_file), $service_name, 'conf')
}
if $log_dir != $redis::log_dir {
file { $log_dir:
ensure => directory,
group => $service_group,
mode => $log_dir_mode,
owner => $service_user,
}
}
if $workdir != $redis::workdir {
file { $workdir:
ensure => directory,
group => $service_group,
mode => $workdir_mode,
owner => $service_user,
}
}
if $manage_service_file {
if $title != 'default' {
$real_service_ensure = $service_ensure == 'running'
$real_service_enable = $service_enable
Exec["cp -p ${redis_file_name_orig} ${redis_file_name}"] ~> Service["${service_name}.service"]
} else {
$real_service_ensure = undef
$real_service_enable = undef
}
systemd::unit_file { "${service_name}.service":
ensure => 'present',
active => $real_service_ensure,
enable => $real_service_enable,
owner => 'root',
group => 'root',
mode => '0644',
content => template('redis/service_templates/redis.service.erb'),
}
} else {
if $ulimit_managed {
systemd::service_limits { "${service_name}.service":
limits => {
'LimitNOFILE' => $ulimit,
},
restart_service => false,
}
}
}
$_real_log_file = $log_file ? {
Stdlib::Absolutepath => $log_file,
default => "${log_dir}/${log_file}",
}
$bind_arr = [$bind].flatten
file { $redis_file_name_orig:
ensure => file,
owner => $config_owner,
group => $config_group,
mode => $config_file_mode,
- content => template($conf_template),
+ content => epp(
+ $conf_template,
+ {
+ daemonize => $daemonize,
+ pid_file => $pid_file,
+ protected_mode => $protected_mode,
+ port => $port,
+ tcp_backlog => $tcp_backlog,
+ bind_arr => $bind_arr,
+ unixsocket => $unixsocket,
+ unixsocketperm => $unixsocketperm,
+ timeout => $timeout,
+ tcp_keepalive => $tcp_keepalive,
+ log_level => $log_level,
+ log_file => $_real_log_file,
+ syslog_enabled => $syslog_enabled,
+ syslog_facility => $syslog_facility,
+ databases => $databases,
+ save_db_to_disk => $save_db_to_disk,
+ save_db_to_disk_interval => $save_db_to_disk_interval,
+ stop_writes_on_bgsave_error => $stop_writes_on_bgsave_error,
+ rdbcompression => $rdbcompression,
+ dbfilename => $dbfilename,
+ workdir => $workdir,
+ slaveof => $slaveof,
+ masterauth => $masterauth,
+ slave_serve_stale_data => $slave_serve_stale_data,
+ slave_read_only => $slave_read_only,
+ repl_ping_slave_period => $repl_ping_slave_period,
+ repl_timeout => $repl_timeout,
+ repl_disable_tcp_nodelay => $repl_disable_tcp_nodelay,
+ repl_backlog_size => $repl_backlog_size,
+ repl_backlog_ttl => $repl_backlog_ttl,
+ slave_priority => $slave_priority,
+ min_slaves_to_write => $min_slaves_to_write,
+ min_slaves_max_lag => $min_slaves_max_lag,
+ requirepass => $requirepass,
+ rename_commands => $rename_commands,
+ maxclients => $maxclients,
+ maxmemory => $maxmemory,
+ maxmemory_policy => $maxmemory_policy,
+ maxmemory_samples => $maxmemory_samples,
+ appendonly => $appendonly,
+ appendfilename => $appendfilename,
+ appendfsync => $appendfsync,
+ no_appendfsync_on_rewrite => $no_appendfsync_on_rewrite,
+ auto_aof_rewrite_percentage => $auto_aof_rewrite_percentage,
+ auto_aof_rewrite_min_size => $auto_aof_rewrite_min_size,
+ aof_load_truncated => $aof_load_truncated,
+ slowlog_log_slower_than => $slowlog_log_slower_than,
+ slowlog_max_len => $slowlog_max_len,
+ latency_monitor_threshold => $latency_monitor_threshold,
+ notify_keyspace_events => $notify_keyspace_events,
+ hash_max_ziplist_entries => $hash_max_ziplist_entries,
+ hash_max_ziplist_value => $hash_max_ziplist_value,
+ list_max_ziplist_entries => $list_max_ziplist_entries,
+ list_max_ziplist_value => $list_max_ziplist_value,
+ set_max_intset_entries => $set_max_intset_entries,
+ zset_max_ziplist_entries => $zset_max_ziplist_entries,
+ zset_max_ziplist_value => $zset_max_ziplist_value,
+ hll_sparse_max_bytes => $hll_sparse_max_bytes,
+ activerehashing => $activerehashing,
+ output_buffer_limit_slave => $output_buffer_limit_slave,
+ output_buffer_limit_pubsub => $output_buffer_limit_pubsub,
+ hz => $hz,
+ aof_rewrite_incremental_fsync => $aof_rewrite_incremental_fsync,
+ cluster_enabled => $cluster_enabled,
+ cluster_config_file => $cluster_config_file,
+ cluster_node_timeout => $cluster_node_timeout,
+ cluster_slave_validity_factor => $cluster_slave_validity_factor,
+ cluster_require_full_coverage => $cluster_require_full_coverage,
+ cluster_migration_barrier => $cluster_migration_barrier,
+ extra_config_file => $extra_config_file,
+ }
+ ),
}
exec { "cp -p ${redis_file_name_orig} ${redis_file_name}":
path => '/usr/bin:/bin',
subscribe => File[$redis_file_name_orig],
refreshonly => true,
}
}
diff --git a/templates/redis.conf.erb b/templates/redis.conf.epp
similarity index 79%
rename from templates/redis.conf.erb
rename to templates/redis.conf.epp
index f10bd53..3955d63 100644
--- a/templates/redis.conf.erb
+++ b/templates/redis.conf.epp
@@ -1,798 +1,870 @@
+<%- |
+ Boolean $daemonize,
+ Stdlib::Absolutepath $pid_file,
+ Boolean $protected_mode,
+ Stdlib::Port $port,
+ Integer[0] $tcp_backlog,
+ Array[Stdlib::IP::Address] $bind_arr,
+ Variant[Stdlib::Absolutepath, Enum['']] $unixsocket,
+ Variant[Stdlib::Filemode, Enum['']] $unixsocketperm,
+ Integer[0] $timeout,
+ Integer[0] $tcp_keepalive,
+ Redis::LogLevel $log_level,
+ Stdlib::Absolutepath $log_file,
+ Boolean $syslog_enabled,
+ Optional[String[1]] $syslog_facility,
+ Integer[1] $databases,
+ Boolean $save_db_to_disk,
+ Hash $save_db_to_disk_interval,
+ Boolean $stop_writes_on_bgsave_error,
+ Boolean $rdbcompression,
+ Variant[String[1], Boolean] $dbfilename,
+ Stdlib::Absolutepath $workdir,
+ Optional[String[1]] $slaveof,
+ Optional[String[1]] $masterauth,
+ Boolean $slave_serve_stale_data,
+ Boolean $slave_read_only,
+ Integer[1] $repl_ping_slave_period,
+ Integer[1] $repl_timeout,
+ Boolean $repl_disable_tcp_nodelay,
+ String[1] $repl_backlog_size,
+ Integer[0] $repl_backlog_ttl,
+ Integer[0] $slave_priority,
+ Integer[0] $min_slaves_to_write,
+ Integer[0] $min_slaves_max_lag,
+ Optional[String[1]] $requirepass,
+ Hash[String,String] $rename_commands,
+ Integer[1] $maxclients,
+ Optional[Variant[Integer, String]] $maxmemory,
+ Optional[String] $maxmemory_policy,
+ Optional[Variant[Integer, String]] $maxmemory_samples,
+ Boolean $appendonly,
+ String[1] $appendfilename,
+ Enum['no', 'always', 'everysec'] $appendfsync,
+ Boolean $no_appendfsync_on_rewrite,
+ Integer[0] $auto_aof_rewrite_percentage,
+ String[1] $auto_aof_rewrite_min_size,
+ Boolean $aof_load_truncated,
+ Integer[0] $slowlog_log_slower_than,
+ Integer[0] $slowlog_max_len,
+ Integer[0] $latency_monitor_threshold,
+ Optional[String[1]] $notify_keyspace_events,
+ Integer[0] $hash_max_ziplist_entries,
+ Integer[0] $hash_max_ziplist_value,
+ Integer[0] $list_max_ziplist_entries,
+ Integer[0] $list_max_ziplist_value,
+ Integer[0] $set_max_intset_entries,
+ Integer[0] $zset_max_ziplist_entries,
+ Integer[0] $zset_max_ziplist_value,
+ Integer[0] $hll_sparse_max_bytes,
+ Boolean $activerehashing,
+ String[1] $output_buffer_limit_slave,
+ String[1] $output_buffer_limit_pubsub,
+ Integer[1, 500] $hz,
+ Boolean $aof_rewrite_incremental_fsync,
+ Boolean $cluster_enabled,
+ String[1] $cluster_config_file,
+ Integer[1] $cluster_node_timeout,
+ Integer[0] $cluster_slave_validity_factor,
+ Boolean $cluster_require_full_coverage,
+ Integer[0] $cluster_migration_barrier,
+ Optional[String] $extra_config_file,
+| -%>
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize <% if @daemonize -%>yes<% else -%>no<% end -%>
+daemonize <%= bool2str($daemonize, 'yes', 'no') -%>
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
-pidfile <%= @pid_file %>
+pidfile <%= $pid_file %>
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
-protected-mode <%= @protected_mode ? 'yes' : 'no' %>
+protected-mode <%= bool2str($protected_mode, 'yes', 'no') %>
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
-port <%= @port %>
+port <%= $port %>
# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
-tcp-backlog <%= @tcp_backlog %>
+tcp-backlog <%= $tcp_backlog %>
-<% unless @bind_arr.empty? -%>
+<% unless $bind_arr.empty { -%>
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
-bind <%= @bind_arr.join(' ') %>
-<% end -%>
+bind <%= $bind_arr.join(' ') %>
+<% } -%>
-<% unless @unixsocket.empty? -%>
+<% unless $unixsocket.empty { -%>
# Specify the path for the unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
-unixsocket <%= @unixsocket %>
-<% unless @unixsocketperm.empty? %>unixsocketperm <%= @unixsocketperm %><% end -%>
+unixsocket <%= $unixsocket %>
+<% unless $unixsocketperm.empty { %>unixsocketperm <%= $unixsocketperm %><% } -%>
-<% end -%>
+<% } -%>
# Close the connection after a client is idle for N seconds (0 to disable)
-timeout <%= @timeout %>
+timeout <%= $timeout %>
# TCP keepalive.
#
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
#
# 1) Detect dead peers.
# 2) Take the connection alive from the point of view of network
# equipment in the middle.
#
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is 60 seconds.
-tcp-keepalive <%= @tcp_keepalive %>
+tcp-keepalive <%= $tcp_keepalive %>
# Set server verbosity to 'debug'
# it can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
-loglevel <%= @log_level %>
+loglevel <%= $log_level %>
# 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
-logfile <%= @_real_log_file %>
+logfile <%= $log_file %>
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
-syslog-enabled <% if @syslog_enabled %>yes<% else %>no<% end %>
+syslog-enabled <%= bool2str($syslog_enabled, 'yes', 'no') %>
# Specify the syslog identity.
# syslog-ident redis
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
-<% if @syslog_facility %>syslog-facility <%= @syslog_facility %><% else %># syslog-facility local0<% end %>
+<% if $syslog_facility { %>syslog-facility <%= $syslog_facility %><% } else { %># syslog-facility local0<% } %>
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT where
# dbid is a number between 0 and 'databases'-1
-databases <%= @databases %>
+databases <%= $databases %>
################################ SNAPSHOTTING #################################
#
# Save the DB on disk:
#
# save
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving at all commenting all the "save" lines.
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
#
# save ""
-<% if @save_db_to_disk %>
-<%- @save_db_to_disk_interval.sort_by{|k,v|k}.each do |seconds, key_change| -%>
-save <%= seconds -%> <%= key_change -%> <%= "\n" -%>
-<%- end -%>
-<% end %>
+<% if $save_db_to_disk { %>
+<%- $save_db_to_disk_interval.each |$seconds, $key_change| { -%>
+save <%= "${seconds} ${key_change}\n" -%>
+<%- } -%>
+<% } %>
# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
# distater will happen.
#
# If the background saving process will start working again Redis will
# automatically allow writes again.
#
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
-stop-writes-on-bgsave-error <% if @stop_writes_on_bgsave_error -%>yes<% else -%>no<% end %>
+stop-writes-on-bgsave-error <%= bool2str($stop_writes_on_bgsave_error, 'yes', 'no') %>
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
-rdbcompression <% if @rdbcompression -%>yes<% else -%>no<% end %>
+rdbcompression <%= bool2str($rdbcompression, 'yes', 'no') %>
# Since verison 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant to corruption but there is a performance
# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
# for maximum performances.
#
# RDB files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip the check.
rdbchecksum yes
# The filename where to dump the DB
-<% if @dbfilename %>dbfilename <%= @dbfilename %><% else %># dbfilename dump.rdb<% end %>
+<% if $dbfilename { %>dbfilename <%= $dbfilename %><% } else { %># dbfilename dump.rdb<% } %>
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# Also the Append Only File will be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
-dir <%= @workdir %>
+dir <%= $workdir %>
################################# REPLICATION #################################
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. Note that the configuration is local to the slave
# so for example it is possible to configure the slave to save the DB with a
# different interval, or to listen to another port, and so on.
#
# slaveof
-<% if @slaveof -%>slaveof <%= @slaveof %><% end -%>
+<% if $slaveof { -%>slaveof <%= $slaveof %><% } -%>
# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the slave to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the slave request.
#
# masterauth
-<% if @masterauth -%>masterauth <%= @masterauth %><% end -%>
+<% if $masterauth { -%>masterauth <%= $masterauth %><% } -%>
# When a slave loses the connection with the master, or when the replication
# is still in progress, the slave can act in two different ways:
#
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
# still reply to client requests, possibly with out of date data, or the
# data set may just be empty if this is the first synchronization.
#
# 2) if slave-serve-stale data is set to 'no' the slave will reply with
# an error "SYNC with master in progress" to all the kind of commands
# but to INFO and SLAVEOF.
#
-slave-serve-stale-data <% if @slave_serve_stale_data -%>yes<% else -%>no<% end %>
+slave-serve-stale-data <%= bool2str($slave_serve_stale_data, 'yes', 'no') %>
# You can configure a slave instance to accept writes or not. Writing against
# a slave instance may be useful to store some ephemeral data (because data
# written on a slave will be easily deleted after resync with the master) but
# may also cause problems if clients are writing to it because of a
# misconfiguration.
#
# Since Redis 2.6 by default slaves are read-only.
#
# Note: read only slaves are not designed to be exposed to untrusted clients
# on the internet. It's just a protection layer against misuse of the instance.
# Still a read only slave exports by default all the administrative commands
# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
# security of read only slaves using 'rename-command' to shadow all the
# administrative / dangerous commands.
-slave-read-only <% if @slave_read_only -%>yes<% else -%>no<% end %>
+slave-read-only <%= bool2str($slave_read_only, 'yes', 'no') %>
# Slaves send PINGs to server in a predefined interval. It's possible to change
# this interval with the repl_ping_slave_period option. The default value is 10
# seconds.
#
-repl-ping-slave-period <%= @repl_ping_slave_period %>
+repl-ping-slave-period <%= $repl_ping_slave_period %>
# The following option sets a timeout for both Bulk transfer I/O timeout and
# master data or ping response timeout. The default value is 60 seconds.
#
# It is important to make sure that this value is greater than the value
# specified for repl-ping-slave-period otherwise a timeout will be detected
# every time there is low traffic between the master and the slave.
#
-repl-timeout <%= @repl_timeout %>
+repl-timeout <%= $repl_timeout %>
# Disable TCP_NODELAY on the slave socket after SYNC?
#
# If you select "yes" Redis will use a smaller number of TCP packets and
# less bandwidth to send data to slaves. But this can add a delay for
# the data to appear on the slave side, up to 40 milliseconds with
# Linux kernels using a default configuration.
#
# If you select "no" the delay for data to appear on the slave side will
# be reduced but more bandwidth will be used for replication.
#
# By default we optimize for low latency, but in very high traffic conditions
# or when the master and slaves are many hops away, turning this to "yes" may
# be a good idea.
-repl-disable-tcp-nodelay <% if @repl_disable_tcp_nodelay -%>yes<% else -%>no<% end -%>
+repl-disable-tcp-nodelay <%= bool2str($repl_disable_tcp_nodelay, 'yes', 'no') -%>
# Set the replication backlog size. The backlog is a buffer that accumulates
# slave data when slaves are disconnected for some time, so that when a slave
# wants to reconnect again, often a full resync is not needed, but a partial
# resync is enough, just passing the portion of data the slave missed while
# disconnected.
#
# The bigger the replication backlog, the longer the time the slave can be
# disconnected and later be able to perform a partial resynchronization.
#
# The backlog is only allocated once there is at least a slave connected.
#
-repl-backlog-size <%= @repl_backlog_size %>
+repl-backlog-size <%= $repl_backlog_size %>
# After a master has no longer connected slaves for some time, the backlog
# will be freed. The following option configures the amount of seconds that
# need to elapse, starting from the time the last slave disconnected, for
# the backlog buffer to be freed.
#
# A value of 0 means to never release the backlog.
#
-repl-backlog-ttl <%= @repl_backlog_ttl %>
+repl-backlog-ttl <%= $repl_backlog_ttl %>
# The slave priority is an integer number published by Redis in the INFO output.
# It is used by Redis Sentinel in order to select a slave to promote into a
# master if the master is no longer working correctly.
#
# A slave with a low priority number is considered better for promotion, so
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
# pick the one wtih priority 10, that is the lowest.
#
# However a special priority of 0 marks the slave as not able to perform the
# role of master, so a slave with priority of 0 will never be selected by
# Redis Sentinel for promotion.
#
# By default the priority is 100.
-slave-priority <%= @slave_priority %>
+slave-priority <%= $slave_priority %>
# It is possible for a master to stop accepting writes if there are less than
# N slaves connected, having a lag less or equal than M seconds.
#
# The N slaves need to be in "online" state.
#
# The lag in seconds, that must be <= the specified value, is calculated from
# the last ping received from the slave, that is usually sent every second.
#
# This option does not GUARANTEE that N replicas will accept the write, but
# will limit the window of exposure for lost writes in case not enough slaves
# are available, to the specified number of seconds.
#
# For example to require at least 3 slaves with a lag <= 10 seconds use:
#
# min-slaves-to-write 3
# min-slaves-max-lag 10
#
# Setting one or the other to 0 disables the feature.
#
# By default min-slaves-to-write is set to 0 (feature disabled) and
# min-slaves-max-lag is set to 10.
-min-slaves-to-write <%= @min_slaves_to_write %>
-min-slaves-max-lag <%= @min_slaves_max_lag %>
+min-slaves-to-write <%= $min_slaves_to_write %>
+min-slaves-max-lag <%= $min_slaves_max_lag %>
################################## SECURITY ###################################
# Require clients to issue AUTH before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
-<% if @requirepass -%>requirepass <%= @requirepass %><% end -%>
+<% if $requirepass { -%>requirepass <%= $requirepass %><% } -%>
# Command renaming.
#
# It is possible to change the name of dangerous commands in a shared
# environment. For instance the CONFIG command may be renamed into something
# of hard to guess so that it will be still available for internal-use
# tools but not available for general clients.
#
# Example:
#
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# It is also possible to completely kill a command renaming it into
# an empty string:
#
# rename-command CONFIG ""
-<% @rename_commands.each do |from,to| -%>
-rename-command <%= from %> <%= to %>
-<% end -%>
+<% $rename_commands.each |$from, $to| { -%>
+rename-command <%= $from %> <%= $to %>
+<% } -%>
################################### LIMITS ####################################
# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# able ot configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
#
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
-maxclients <%= @maxclients %>
+maxclients <%= $maxclients %>
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys
# accordingly to the eviction policy selected (see maxmemmory-policy).
#
# If Redis can't remove keys according to the policy, or if the policy is
# set to 'noeviction', Redis will start to reply with errors to commands
# that would use more memory, like SET, LPUSH, and so on, and will continue
# to reply to read-only commands like GET.
#
# This option is usually useful when using Redis as an LRU cache, or to set
# an hard memory limit for an instance (using the 'noeviction' policy).
#
# WARNING: If you have slaves attached to an instance with maxmemory on,
# the size of the output buffers needed to feed the slaves are subtracted
# from the used memory count, so that network problems / resyncs will
# not trigger a loop where keys are evicted, and in turn the output
# buffer of slaves is full with DELs of keys evicted triggering the deletion
# of more keys, and so forth until the database is completely emptied.
#
# In short... if you have slaves attached it is suggested that you set a lower
# limit for maxmemory so that there is some free RAM on the system for slave
# output buffers (but this is not needed if the policy is 'noeviction').
#
# maxmemory
-<% if @maxmemory -%>maxmemory <%= @maxmemory %><% end -%>
+<% if $maxmemory { -%>maxmemory <%= $maxmemory %><% } -%>
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached? You can select among five behavior:
#
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys-random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
#
# Note: with all the kind of policies, Redis will return an error on write
# operations, when there are not suitable keys for eviction.
#
# At the date of writing this commands are: set setnx setex append
# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
# getset mset msetnx exec sort
#
# The default is:
#
# maxmemory-policy volatile-lru
-<% if @maxmemory_policy -%>maxmemory-policy <%= @maxmemory_policy %><% end -%>
+<% if $maxmemory_policy { -%>maxmemory-policy <%= $maxmemory_policy %><% } -%>
# LRU and minimal TTL algorithms are not precise algorithms but approximated
# algorithms (in order to save memory), so you can select as well the sample
# size to check. For instance for default Redis will check three keys and
# pick the one that was used less recently, you can change the sample size
# using the following configuration directive.
#
# maxmemory-samples 3
-<% if @maxmemory_samples -%>maxmemory-samples <%= @maxmemory_samples %><% end -%>
+<% if $maxmemory_samples { -%>maxmemory-samples <%= $maxmemory_samples %><% } -%>
############################## APPEND ONLY MODE ###############################
# By default Redis asynchronously dumps the dataset on disk. This mode is
# good enough in many applications, but an issue with the Redis process or
# a power outage may result into a few minutes of writes lost (depending on
# the configured save points).
#
# The Append Only File is an alternative persistence mode that provides
# much better durability. For instance using the default data fsync policy
# (see later in the config file) Redis can lose just one second of writes in a
# dramatic event like a server power outage, or a single write if something
# wrong with the Redis process itself happens, but the operating system is
# still running correctly.
#
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
#
# Please check http://redis.io/topics/persistence for more information.
-appendonly <% if @appendonly -%>yes<% else -%>no<% end -%>
+appendonly <%= bool2str($appendonly, 'yes', 'no') -%>
# The name of the append only file (default: "appendonly.aof")
-appendfilename <%= @appendfilename %>
+appendfilename <%= $appendfilename %>
# The fsync() call tells the Operating System to actually write data on disk
# instead to wait for more data in the output buffer. Some OS will really flush
# data on disk, some other OS will just try to do it ASAP.
#
# Redis supports three different modes:
#
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# always: fsync after every write to the append only log . Slow, Safest.
# everysec: fsync only one time every second. Compromise.
#
# The default is "everysec" that's usually the right compromise between
# speed and data safety. It's up to you to understand if you can relax this to
# "no" that will let the operating system flush the output buffer when
# it wants, for better performances (but if you can live with the idea of
# some data loss consider the default persistence mode that's snapshotting),
# or on the contrary, use "always" that's very slow but a bit safer than
# everysec.
#
# More details please check the following article:
# http://antirez.com/post/redis-persistence-demystified.html
#
# If unsure, use "everysec".
-appendfsync <%= @appendfsync %>
+appendfsync <%= $appendfsync %>
# When the AOF fsync policy is set to always or everysec, and a background
# saving process (a background save or AOF log background rewriting) is
# performing a lot of I/O against the disk, in some Linux configurations
# Redis may block too long on the fsync() call. Note that there is no fix for
# this currently, as even performing fsync in a different thread will block
# our synchronous write(2) call.
#
# In order to mitigate this problem it's possible to use the following option
# that will prevent fsync() from being called in the main process while a
# BGSAVE or BGREWRITEAOF is in progress.
#
# This means that while another child is saving the durability of Redis is
# the same as "appendfsync none", that in practical terms means that it is
# possible to lost up to 30 seconds of log in the worst scenario (with the
# default Linux settings).
#
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
-no-appendfsync-on-rewrite <% if @no_appendfsync_on_rewrite -%>yes<% else -%>no<% end -%>
+no-appendfsync-on-rewrite <%= bool2str($no_appendfsync_on_rewrite, 'yes', 'no') -%>
# Automatic rewrite of the append only file.
# Redis is able to automatically rewrite the log file implicitly calling
# BGREWRITEAOF when the AOF log size will growth by the specified percentage.
#
# This is how it works: Redis remembers the size of the AOF file after the
# latest rewrite (or if no rewrite happened since the restart, the size of
# the AOF at startup is used).
#
# This base size is compared to the current size. If the current size is
# bigger than the specified percentage, the rewrite is triggered. Also
# you need to specify a minimal size for the AOF file to be rewritten, this
# is useful to avoid rewriting the AOF file even if the percentage increase
# is reached but it is still pretty small.
#
# Specify a percentage of zero in order to disable the automatic AOF
# rewrite feature.
-auto-aof-rewrite-percentage <%= @auto_aof_rewrite_percentage %>
-auto-aof-rewrite-min-size <%= @auto_aof_rewrite_min_size %>
+auto-aof-rewrite-percentage <%= $auto_aof_rewrite_percentage %>
+auto-aof-rewrite-min-size <%= $auto_aof_rewrite_min_size %>
# An AOF file may be found to be truncated at the end during the Redis
# startup process, when the AOF data gets loaded back into memory.
# This may happen when the system where Redis is running
# crashes, especially when an ext4 filesystem is mounted without the
# data=ordered option (however this can't happen when Redis itself
# crashes or aborts but the operating system still works correctly).
#
# Redis can either exit with an error when this happens, or load as much
# data as possible (the default now) and start if the AOF file is found
# to be truncated at the end. The following option controls this behavior.
#
# If aof-load-truncated is set to yes, a truncated AOF file is loaded and
# the Redis server starts emitting a log to inform the user of the event.
# Otherwise if the option is set to no, the server aborts with an error
# and refuses to start. When the option is set to no, the user requires
# to fix the AOF file using the "redis-check-aof" utility before to restart
# the server.
#
# Note that if the AOF file will be found to be corrupted in the middle
# the server will still exit with an error. This option only applies when
# Redis will try to read more data from the AOF file but not enough bytes
# will be found.
-aof-load-truncated <% if @aof_load_truncated -%>yes<% else -%>no<% end -%>
+aof-load-truncated <%= bool2str($aof_load_truncated, 'yes', 'no') -%>
################################ LUA SCRIPTING ###############################
# Max execution time of a Lua script in milliseconds.
#
# If the maximum execution time is reached Redis will log that a script is
# still in execution after the maximum allowed time and will start to
# reply to queries with an error.
#
# When a long running script exceed the maximum execution time only the
# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
# used to stop a script that did not yet called write commands. The second
# is the only way to shut down the server in the case a write commands was
# already issue by the script but the user don't want to wait for the natural
# termination of the script.
#
# Set it to 0 or a negative value for unlimited execution without warnings.
lua-time-limit 5000
################################## SLOW LOG ###################################
# The Redis Slow Log is a system to log queries that exceeded a specified
# execution time. The execution time does not include the I/O operations
# like talking with the client, sending the reply and so forth,
# but just the time needed to actually execute the command (this is the only
# stage of command execution where the thread is blocked and can not serve
# other requests in the meantime).
#
# You can configure the slow log with two parameters: one tells Redis
# what is the execution time, in microseconds, to exceed in order for the
# command to get logged, and the other parameter is the length of the
# slow log. When a new command is logged the oldest one is removed from the
# queue of logged commands.
# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
-slowlog-log-slower-than <%= @slowlog_log_slower_than %>
+slowlog-log-slower-than <%= $slowlog_log_slower_than %>
# There is no limit to this length. Just be aware that it will consume memory.
# You can reclaim memory used by the slow log with SLOWLOG RESET.
-slowlog-max-len <%= @slowlog_max_len %>
+slowlog-max-len <%= $slowlog_max_len %>
################################ LATENCY MONITOR ##############################
# The Redis latency monitoring subsystem samples different operations
# at runtime in order to collect data related to possible sources of
# latency of a Redis instance.
#
# Via the LATENCY command this information is available to the user that can
# print graphs and obtain reports.
#
# The system only logs operations that were performed in a time equal or
# greater than the amount of milliseconds specified via the
# latency-monitor-threshold configuration directive. When its value is set
# to zero, the latency monitor is turned off.
#
# By default latency monitoring is disabled since it is mostly not needed
# if you don't have latency issues, and collecting data has a performance
# impact, that while very small, can be measured under big load. Latency
# monitoring can easily be enalbed at runtime using the command
# "CONFIG SET latency-monitor-threshold " if needed.
-latency-monitor-threshold <%= @latency_monitor_threshold %>
+latency-monitor-threshold <%= $latency_monitor_threshold %>
############################# Event notification ##############################
# Redis can notify Pub/Sub clients about events happening in the key space.
# This feature is documented at http://redis.io/topics/notifications
#
# For instance if keyspace events notification is enabled, and a client
# performs a DEL operation on key "foo" stored in the Database 0, two
# messages will be published via Pub/Sub:
#
# PUBLISH __keyspace@0__:foo del
# PUBLISH __keyevent@0__:del foo
#
# It is possible to select the events that Redis will notify among a set
# of classes. Every class is identified by a single character:
#
# K Keyspace events, published with __keyspace@__ prefix.
# E Keyevent events, published with __keyevent@__ prefix.
# g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
# $ String commands
# l List commands
# s Set commands
# h Hash commands
# z Sorted set commands
# x Expired events (events generated every time a key expires)
# e Evicted events (events generated when a key is evicted for maxmemory)
# A Alias for g$lshzxe, so that the "AKE" string means all the events.
#
# The "notify-keyspace-events" takes as argument a string that is composed
# of zero or multiple characters. The empty string means that notifications
# are disabled.
#
# Example: to enable list and generic events, from the point of view of the
# event name, use:
#
# notify-keyspace-events Elg
#
# Example 2: to get the stream of the expired keys subscribing to channel
# name __keyevent@0__:expired use:
#
# notify-keyspace-events Ex
#
# By default all notifications are disabled because most users don't need
# this feature and the feature has some overhead. Note that if you don't
# specify at least one of K or E, no events will be delivered.
-notify-keyspace-events <% if @notify_keyspace_events -%><%= @notify_keyspace_events %><% else -%>""<% end -%>
+notify-keyspace-events <% if $notify_keyspace_events { -%><%= $notify_keyspace_events %><% } else { -%>""<% } -%>
############################### ADVANCED CONFIG ###############################
# Hashes are encoded using a memory efficient data structure when they have a
# small number of entries, and the biggest entry does not exceed a given
# threshold. These thresholds can be configured using the following directives.
-hash-max-ziplist-entries <%= @hash_max_ziplist_entries %>
-hash-max-ziplist-value <%= @hash_max_ziplist_value %>
+hash-max-ziplist-entries <%= $hash_max_ziplist_entries %>
+hash-max-ziplist-value <%= $hash_max_ziplist_value %>
# Similarly to hashes, small lists are also encoded in a special way in order
# to save a lot of space. The special representation is only used when
# you are under the following limits:
-list-max-ziplist-entries <%= @list_max_ziplist_entries %>
-list-max-ziplist-value <%= @list_max_ziplist_value %>
+list-max-ziplist-entries <%= $list_max_ziplist_entries %>
+list-max-ziplist-value <%= $list_max_ziplist_value %>
# Sets have a special encoding in just one case: when a set is composed
# of just strings that happens to be integers in radix 10 in the range
# of 64 bit signed integers.
# The following configuration setting sets the limit in the size of the
# set in order to use this special memory saving encoding.
-set-max-intset-entries <%= @set_max_intset_entries %>
+set-max-intset-entries <%= $set_max_intset_entries %>
# Similarly to hashes and lists, sorted sets are also specially encoded in
# order to save a lot of space. This encoding is only used when the length and
# elements of a sorted set are below the following limits:
-zset-max-ziplist-entries <%= @zset_max_ziplist_entries %>
-zset-max-ziplist-value <%= @zset_max_ziplist_value %>
+zset-max-ziplist-entries <%= $zset_max_ziplist_entries %>
+zset-max-ziplist-value <%= $zset_max_ziplist_value %>
# HyperLogLog sparse representation bytes limit. The limit includes the
# 16 bytes header. When an HyperLogLog using the sparse representation crosses
# this limit, it is converted into the dense representation.
#
# A value greater than 16000 is totally useless, since at that point the
# dense representation is more memory efficient.
#
# The suggested value is ~ 3000 in order to have the benefits of
# the space efficient encoding without slowing down too much PFADD,
# which is O(N) with the sparse encoding. The value can be raised to
# ~ 10000 when CPU is not a concern, but space is, and the data set is
# composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
-hll-sparse-max-bytes <%= @hll_sparse_max_bytes %>
+hll-sparse-max-bytes <%= $hll_sparse_max_bytes %>
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
# order to help rehashing the main Redis hash table (the one mapping top-level
# keys to values). The hash table implementation Redis uses (see dict.c)
# performs a lazy rehashing: the more operation you run into an hash table
# that is rehashing, the more rehashing "steps" are performed, so if the
# server is idle the rehashing is never complete and some more memory is used
# by the hash table.
#
# The default is to use this millisecond 10 times every second in order to
# active rehashing the main dictionaries, freeing memory when possible.
#
# If unsure:
# use "activerehashing no" if you have hard latency requirements and it is
# not a good thing in your environment that Redis can reply form time to time
# to queries with 2 milliseconds delay.
#
# use "activerehashing yes" if you don't have such hard requirements but
# want to free memory asap when possible.
-activerehashing <% if @activerehashing -%>yes<% else -%>no<% end -%>
+activerehashing <%= bool2str($activerehashing, 'yes', 'no') -%>
# The client output buffer limits can be used to force disconnection of clients
# that are not reading data from the server fast enough for some reason (a
# common reason is that a Pub/Sub client can't consume messages as fast as the
# publisher can produce them).
#
# The limit can be set differently for the three different classes of clients:
#
# normal -> normal clients
# slave -> slave clients and MONITOR clients
# pubsub -> clients subcribed to at least one pubsub channel or pattern
#
# The syntax of every client-output-buffer-limit directive is the following:
#
# client-output-buffer-limit
#
# A client is immediately disconnected once the hard limit is reached, or if
# the soft limit is reached and remains reached for the specified number of
# seconds (continuously).
# So for instance if the hard limit is 32 megabytes and the soft limit is
# 16 megabytes / 10 seconds, the client will get disconnected immediately
# if the size of the output buffers reach 32 megabytes, but will also get
# disconnected if the client reaches 16 megabytes and continuously overcomes
# the limit for 10 seconds.
#
# By default normal clients are not limited because they don't receive data
# without asking (in a push way), but just after a request, so only
# asynchronous clients may create a scenario where data is requested faster
# than it can read.
#
# Instead there is a default limit for pubsub and slave clients, since
# subscribers and slaves receive data in a push fashion.
#
# Both the hard or the soft limit can be disabled just setting it to zero.
client-output-buffer-limit normal 0 0 0
-client-output-buffer-limit slave <%= @output_buffer_limit_slave %>
-client-output-buffer-limit pubsub <%= @output_buffer_limit_pubsub %>
+client-output-buffer-limit slave <%= $output_buffer_limit_slave %>
+client-output-buffer-limit pubsub <%= $output_buffer_limit_pubsub %>
# Redis calls an internal function to perform many background tasks, like
# closing connections of clients in timeout, purging expired keys that are
# never requested, and so forth.
#
# Not all tasks are performed with the same frequency, but Redis checks for
# tasks to perform accordingly to the specified "hz" value.
#
# By default "hz" is set to 10. Raising the value will use more CPU when
# Redis is idle, but at the same time will make Redis more responsive when
# there are many keys expiring at the same time, and timeouts may be
# handled with more precision.
#
# The range is between 1 and 500, however a value over 100 is usually not
# a good idea. Most users should use the default of 10 and raise this up to
# 100 only in environments where very low latency is required.
-hz <%= @hz %>
+hz <%= $hz %>
# When a child rewrites the AOF file, if the following option is enabled
# the file will be fsync-ed every 32 MB of data generated. This is useful
# in order to commit the file to the disk more incrementally and avoid
# big latency spikes.
-aof-rewrite-incremental-fsync <% if @aof_rewrite_incremental_fsync -%>yes<% else -%>no<% end -%>
+aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes', 'no') -%>
# Redis Cluster Settings
-<% if @cluster_enabled -%>
+<% if $cluster_enabled { -%>
cluster-enabled yes
-cluster-config-file <%= @cluster_config_file %>
-cluster-node-timeout <%= @cluster_node_timeout %>
-cluster-slave-validity-factor <%= @cluster_slave_validity_factor %>
-cluster-require-full-coverage <% if @cluster_require_full_coverage -%>yes<% else -%>no<% end %>
-cluster-migration-barrier <%= @cluster_migration_barrier %>
-<% end -%>
+cluster-config-file <%= $cluster_config_file %>
+cluster-node-timeout <%= $cluster_node_timeout %>
+cluster-slave-validity-factor <%= $cluster_slave_validity_factor %>
+cluster-require-full-coverage <%= bool2str($cluster_require_full_coverage, 'yes', 'no') %>
+cluster-migration-barrier <%= $cluster_migration_barrier %>
+<% } -%>
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you
# have a standard template that goes to all Redis server but also need
# to customize a few per-server settings. Include files can include
# other files, so use this wisely.
#
# include /path/to/local.conf
# include /path/to/other.conf
-<% if @extra_config_file -%>
-include <%= @extra_config_file %>
-<% end -%>
+<% if $extra_config_file { -%>
+include <%= $extra_config_file %>
+<% } -%>