Skip to content

Latest commit

 

History

History
3089 lines (1765 loc) · 81.6 KB

REFERENCE.md

File metadata and controls

3089 lines (1765 loc) · 81.6 KB

Reference

Table of Contents

Classes

Public Classes

Private Classes

  • redis::config: This class provides configuration for Redis.
  • redis::dnfmodule: Manage the DNF module
  • 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: Allows the configuration of multiple redis configurations on one machine

Functions

  • redis::get: Returns the value of the key being looked up or undef if the key does not exist.

Data types

Tasks

  • redis_cli: Executes a redis-cli command on the target system

Classes

redis

This class installs redis

Examples

Default install
include redis
Slave Node
class { '::redis':
  bind    => '10.0.1.2',
  slaveof => '10.0.1.1 6379',
}
Binding on multiple interfaces
class { 'redis':
  bind => ['127.0.0.1', '10.0.0.1', '10.1.0.1'],
}
Binding on all interfaces
class { 'redis':
  bind => [],
}

Parameters

The following parameters are available in the redis class:

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']

bin_path

Data type: Stdlib::Absolutepath

Directory containing redis binary executables.

Default value: $redis::params::bin_path

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: '0640'

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.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[Variant[String[1], Sensitive[String[1]], Deferred]]

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: Optional[Redis::MemoryPolicy]

How Redis will select what to remove when maxmemory is reached.

Default value: undef

maxmemory_samples

Data type: Optional[Integer[1, 10]]

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

modules

Data type: Array[Stdlib::Absolutepath]

Additional redis modules to load (.so path)

Default value: []

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

Default value: true

output_buffer_limit_slave

Data type: String[1]

Value of client-output-buffer-limit-slave in redis config

Default value: '256mb 64mb 60'

output_buffer_limit_pubsub

Data type: String[1]

Value of client-output-buffer-limit-pubsub in redis config

Default value: '32mb 8mb 60'

package_ensure

Data type: String[1]

Default action for package.

Default value: 'installed'

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: undef

redis_apt_repo

Data type: Boolean

If you want to use the redis apt repository.

Default value: false

apt_location

Data type: Stdlib::HTTPSUrl

Specify the URL of the apt repository.

Default value: 'https://packages.redis.io/deb/'

apt_repos

Data type: String[1]

Specify the repository to use for apt. Defaults to 'main'.

Default value: 'main'

apt_release

Data type: Optional[String]

Specify the os codename.

Default value: undef

apt_key_id

Data type: String[1]

Specify the PGP key id to use for apt.

Default value: '54318FA4052D1E61A6B6F7BB5F4349D6BF53AA0C'

apt_key_server

Data type: String[1]

Specify the PGP key server to use for apt.

Default value: 'hkp://keyserver.ubuntu.com/'

apt_key_options

Data type: Optional[String]

Passes additional options to apt-key adv --keyserver-options.

Default value: undef

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_announce_ip

Data type: Optional[Stdlib::Host]

The specific IP or hostname a replica will report to its master

Default value: undef

repl_announce_port

Data type: Optional[Stdlib::Port]

The specific port a replica will report to its master

Default value: undef

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[Variant[String, Deferred]]

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'

service_timeout_start

Data type: Optional[Integer[0]]

Specify the time after which a service startup should be considered as failed.

Default value: undef

service_timeout_stop

Data type: Optional[Integer[0]]

Specify the time after which a service stop should be considered as failed.

Default value: undef

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

replicaof

Data type: Optional[String[1]]

Use replicaof to make a Redis instance a copy of another Redis server.

Default value: undef

slowlog_log_slower_than

Data type: Integer[-1]

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

tls_port

Data type: Optional[Stdlib::Port]

Configure which TLS port to listen on.

Default value: undef

tls_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 certificate file to use for TLS connections.

Default value: undef

tls_key_file

Data type: Optional[Stdlib::Absolutepath]

Specify which privaye key file to use for TLS connections.

Default value: undef

tls_ca_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle file to use.

Default value: undef

tls_ca_cert_dir

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle directory to use.

Default value: undef

tls_auth_clients

Data type: Enum['yes', 'no', 'optional']

Specify if clients and replicas are required to authenticate using valid client side certificates.

Default value: 'no'

tls_replication

Data type: Boolean

Specify if TLS should be enabled on replication links.

Default value: false

tls_cluster

Data type: Boolean

Specify if TLS should be used for the bus protocol.

Default value: false

tls_ciphers

Data type: Optional[String[1]]

Configure allowed ciphers for TLS <= TLSv1.2.

Default value: undef

tls_ciphersuites

Data type: Optional[String[1]]

Configure allowed TLSv1.3 ciphersuites.

Default value: undef

tls_protocols

Data type: Optional[String[1]]

Configure allowed TLS protocol versions.

Default value: undef

tls_prefer_server_ciphers

Data type: Boolean

Specify if the server's preference should be used when choosing a cipher.

Default value: false

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: {}

io_threads

Data type: Optional[Integer[1]]

Number of threads to handle IO operations in Redis

Default value: undef

io_threads_do_reads

Data type: Optional[Boolean]

Enabled/disable io_threads to handle reads

Default value: undef

cluster_allow_reads_when_down

Data type: Optional[Boolean]

Allows nodes to serve read data while cluster status is down

Default value: undef

cluster_replica_no_failover

Data type: Optional[Boolean]

Disabled automatic failover for replica

Default value: undef

dynamic_hz

Data type: Optional[Boolean]

When dynamic HZ is enabled, the actual configured HZ will be used as a baseline, but multiples of the configured HZ value will be actually used as needed once more clients are connected.

Default value: undef

activedefrag

Data type: Optional[Boolean]

Enable/disable active defragmentation

Default value: undef

active_defrag_ignore_bytes

Data type: String[1]

Minimum amount of fragmentation waste to start active defrag Only set if activedefrag is true

Default value: '100mb'

active_defrag_threshold_lower

Data type: Integer[1, 100]

Minimum percentage of fragmentation to start active defrag Only set if activedefrag is true

Default value: 10

active_defrag_threshold_upper

Data type: Integer[1, 100]

Maximum percentage of fragmentation at which we use maximum effort Only set if activedefrag is true

Default value: 100

active_defrag_cycle_min

Data type: Integer[1, 100]

Minimal effort for defrag in CPU percentage, to be used when the lower threshold is reached Only set if activedefrag is true

Default value: 1

active_defrag_cycle_max

Data type: Integer[1, 100]

Maximal effort for defrag in CPU percentage, to be used when the upper threshold is reached Only set if activedefrag is true

Default value: 100

active_defrag_max_scan_fields

Data type: Integer[1]

Maximum number of set/hash/zset/list fields that will be processed from the main dictionary scan Only set if activedefrag is true

Default value: 1000

jemalloc_bg_thread

Data type: Optional[Boolean]

Jemalloc background thread for purging will be enabled by default

Default value: undef

rdb_save_incremental_fsync

Data type: Optional[Boolean]

When redis saves RDB file, if the following option is enabled the file will be fsync-ed every 32 MB of data generated.

Default value: undef

dnf_module_stream

Data type: Optional[String[1]]

Manage the DNF module and set the version. This only makes sense on distributions that use DNF package manager, such as EL8 or Fedora.

Default value: undef

manage_service_file

Data type: Boolean

Determine if the systemd service file should be managed

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.

Examples

include redis::administration
class {'redis::administration':
  enable_overcommit_memory => false,
}

Parameters

The following parameters are available in the redis::administration class:

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

Data type: Optional[String]

Use a specific Software Collection on Red Hat 7 based systems

Default value: undef

redis::sentinel

Install redis-sentinel

Examples

Basic inclusion
include redis::sentinel
Configuring options
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

Data type: Optional[Variant[String[1], Sensitive[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. This parameter takes effect only if an independent package is required for sentinel.

Default value: 'installed'

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_announce_hostnames

Data type: Optional[Enum['yes', 'no']]

Whether or not sentinels will announce hostnames instead of ip addresses to clients. This can be required for TLS.

Default value: undef

sentinel_announce_ip

Data type: Optional[Stdlib::Host]

Specify the IP or hostname that Sentinel will announce

Default value: undef

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

sentinel_resolve_hostnames

Data type: Optional[Enum['yes', 'no']]

Whether or not sentinels can resolve hostnames to ip addresses.

Default value: undef

sentinel_tls_port

Data type: Optional[Stdlib::Port::Unprivileged]

Configure which TLS port to listen on.

Default value: undef

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

tls_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 certificate file to use for TLS connections.

Default value: undef

tls_key_file

Data type: Optional[Stdlib::Absolutepath]

Specify which privaye key file to use for TLS connections.

Default value: undef

tls_ca_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle file to use.

Default value: undef

tls_ca_cert_dir

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle directory to use.

Default value: undef

tls_auth_clients

Data type: Enum['yes', 'no', 'optional']

Specify if clients and replicas are required to authenticate using valid client side certificates.

Default value: 'no'

tls_replication

Data type: Boolean

Specify if TLS should be enabled on replication links.

Default value: false

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

redis::instance {'6380':
  port => 6380,
}

Parameters

The following parameters are available in the redis::instance defined type:

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

managed_by_cluster_manager

Data type: Boolean

Choose if redis will be managed by a cluster manager such as pacemaker or rgmanager

Default value: $redis::managed_by_cluster_manager

manage_service_file

Data type: Boolean

Determine if the systemd service file should be managed

Default value: true

masterauth

Data type: Optional[Variant[String[1], Sensitive[String[1]], Deferred]]

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: Optional[Variant[Integer, String]]

Don't use more memory than the specified amount of bytes.

Default value: $redis::maxmemory

maxmemory_policy

Data type: Optional[Redis::MemoryPolicy]

How Redis will select what to remove when maxmemory is reached.

Default value: $redis::maxmemory_policy

maxmemory_samples

Data type: Optional[Integer[1, 10]]

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

modules

Data type: Array[Stdlib::Absolutepath]

Additional redis modules to load (.so path)

Default value: $redis::modules

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

notify_service

Data type: Boolean

You may disable instance service reloads when config file changes

Default value: true

pid_file

Data type: Stdlib::Absolutepath

Where to store the pid.

Default value: "/var/run/${service_name}/redis.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_announce_ip

Data type: Optional[Stdlib::Host]

The specific IP or hostname a replica will report to its master

Default value: $redis::repl_announce_ip

repl_announce_port

Data type: Optional[Stdlib::Port]

The specific port a replica will report to its master

Default value: $redis::repl_announce_port

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[Variant[String, Deferred]]

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

service_timeout_start

Data type: Optional[Integer[0]]

Specify the time after which a service startup should be considered as failed.

Default value: $redis::service_timeout_start

service_timeout_stop

Data type: Optional[Integer[0]]

Specify the time after which a service stop should be considered as failed.

Default value: $redis::service_timeout_stop

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

replicaof

Data type: Optional[String[1]]

Use replicaof to make a Redis instance a copy of another Redis server.

Default value: $redis::replicaof

slowlog_log_slower_than

Data type: Integer[-1]

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

tls_port

Data type: Optional[Stdlib::Port]

Configure which TLS port to listen on.

Default value: $redis::tls_port

tls_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 certificate file to use for TLS connections.

Default value: $redis::tls_cert_file

tls_key_file

Data type: Optional[Stdlib::Absolutepath]

Specify which privaye key file to use for TLS connections.

Default value: $redis::tls_key_file

tls_ca_cert_file

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle file to use.

Default value: $redis::tls_ca_cert_file

tls_ca_cert_dir

Data type: Optional[Stdlib::Absolutepath]

Specify which X.509 CA certificate(s) bundle directory to use.

Default value: $redis::tls_ca_cert_dir

tls_auth_clients

Data type: Enum['yes', 'no', 'optional']

Specify if clients and replicas are required to authenticate using valid client side certificates.

Default value: $redis::tls_auth_clients

tls_replication

Data type: Boolean

Specify if TLS should be enabled on replication links.

Default value: $redis::tls_replication

tls_cluster

Data type: Boolean

Specify if TLS should be used for the bus protocol.

Default value: $redis::tls_cluster

tls_ciphers

Data type: Optional[String[1]]

Configure allowed ciphers for TLS <= TLSv1.2.

Default value: $redis::tls_ciphers

tls_ciphersuites

Data type: Optional[String[1]]

Configure allowed TLSv1.3 ciphersuites.

Default value: $redis::tls_ciphersuites

tls_protocols

Data type: Optional[String[1]]

Configure allowed TLS protocol versions.

Default value: $redis::tls_protocols

tls_prefer_server_ciphers

Data type: Optional[Boolean]

Specify if the server's preference should be used when choosing a cipher.

Default value: $redis::tls_prefer_server_ciphers

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/${service_name}/redis.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

io_threads

Data type: Optional[Integer[1]]

Number of threads to handle IO operations in Redis

Default value: $redis::io_threads

io_threads_do_reads

Data type: Optional[Boolean]

Enabled/disable io_threads to handle reads

Default value: $redis::io_threads_do_reads

cluster_allow_reads_when_down

Data type: Optional[Boolean]

Allows nodes to serve read data while cluster status is down

Default value: $redis::cluster_allow_reads_when_down

cluster_replica_no_failover

Data type: Optional[Boolean]

Disabled automatic failover for replica

Default value: $redis::cluster_replica_no_failover

dynamic_hz

Data type: Optional[Boolean]

When dynamic HZ is enabled, the actual configured HZ will be used as a baseline, but multiples of the configured HZ value will be actually used as needed once more clients are connected.

Default value: $redis::dynamic_hz

activedefrag

Data type: Optional[Boolean]

Enable/disable active defragmentation

Default value: $redis::activedefrag

active_defrag_ignore_bytes

Data type: String[1]

Minimum amount of fragmentation waste to start active defrag Only set if activedefrag is true

Default value: $redis::active_defrag_ignore_bytes

active_defrag_threshold_lower

Data type: Integer[1, 100]

Minimum percentage of fragmentation to start active defrag Only set if activedefrag is true

Default value: $redis::active_defrag_threshold_lower

active_defrag_threshold_upper

Data type: Integer[1, 100]

Maximum percentage of fragmentation at which we use maximum effort Only set if activedefrag is true

Default value: $redis::active_defrag_threshold_upper

active_defrag_cycle_min

Data type: Integer[1, 100]

Minimal effort for defrag in CPU percentage, to be used when the lower threshold is reached Only set if activedefrag is true

Default value: $redis::active_defrag_cycle_min

active_defrag_cycle_max

Data type: Integer[1, 100]

Maximal effort for defrag in CPU percentage, to be used when the upper threshold is reached Only set if activedefrag is true

Default value: $redis::active_defrag_cycle_max

active_defrag_max_scan_fields

Data type: Integer[1]

Maximum number of set/hash/zset/list fields that will be processed from the main dictionary scan Only set if activedefrag is true

Default value: $redis::active_defrag_max_scan_fields

jemalloc_bg_thread

Data type: Optional[Boolean]

Jemalloc background thread for purging will be enabled by default

Default value: $redis::jemalloc_bg_thread

rdb_save_incremental_fsync

Data type: Optional[Boolean]

When redis saves RDB file, if the following option is enabled the file will be fsync-ed every 32 MB of data generated.

Default value: $redis::rdb_save_incremental_fsync

output_buffer_limit_slave

Data type: String[1]

Value of client-output-buffer-limit-slave in redis config

Default value: $redis::output_buffer_limit_slave

output_buffer_limit_pubsub

Data type: String[1]

Value of client-output-buffer-limit-pubsub in redis config

Default value: $redis::output_buffer_limit_pubsub

Functions

redis::get

Type: Ruby 4.x API

Returns the value of the key being looked up or undef if the key does not exist.

Examples

Get the version
$version = redis::get('version.myapp', 'redis://redis.example.com:6379')
$version_with_default = redis::get('version.myapp', 'redis://redis.example.com:6379', $::myapp_version)

redis::get(String[1] $key, Redis::RedisUrl $url, Optional[String] $default)

The redis::get function.

Returns: Optional[String] Returns the value of the key from Redis

Examples
Get the version
$version = redis::get('version.myapp', 'redis://redis.example.com:6379')
$version_with_default = redis::get('version.myapp', 'redis://redis.example.com:6379', $::myapp_version)
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 Enum['debug', 'verbose', 'notice', 'warning']

Redis::MemoryPolicy

This can be one of:

  • volatile-lru (Evict using approximated LRU, only keys with an expire set)
  • allkeys-lru (Evict any key using approximated LRU)
  • volatile-lfu (Evict using approximated LFU, only keys with an expire set)
  • allkeys-lfu (Evict any key using approximated LFU)
  • volatile-random (Remove a random key having 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 evict anything, just return an error on write operations)

Alias of Enum['volatile-lru', 'allkeys-lru', 'volatile-lfu', 'allkeys-lfu', 'volatile-random', 'allkeys-random', 'volatile-ttl', 'noeviction']

Redis::RedisUrl

validate URL matches redis protocol

Alias of 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