Configuration and option reference

Copy Markdown View Source

RedisServerWrapper has three configuration layers:

  1. RedisServerWrapper.Config is a typed Redis configuration builder.
  2. Server, Cluster, and Sentinel accept curated operational options and own lifecycle/topology directives.
  3. :extra is a token-safe escape hatch for Redis directives that do not have typed fields.

The wrapper does not claim that every Redis directive is a typed option. Use the tables below to determine what is emitted, what controls redis-cli, and what a topology owns.

Typed Config options

RedisServerWrapper.Config.new/1 validates these keys and RedisServerWrapper.Config.to_config_string/1 renders the Redis directives. Unless noted, the same key can be passed to RedisServerWrapper.Server.start/1 or RedisServerWrapper.Server.start_link/1.

Endpoint, auth, and logging

OptionDefaultMeaning
port6379Plain TCP listener, 0..65_535; 0 disables plaintext TCP.
bind"127.0.0.1"One address, a whitespace-separated string, or a list of addresses.
control_hostnilConcrete host used by redis-cli and lifecycle probes. Derived from the first bind address; required when that address is a wildcard. Not emitted to Redis.
usernamenilNamed ACL user. Requires a string password; disables the default user unless the name is "default".
passwordnilrequirepass when no username is set, otherwise the named ACL user's password.
loglevel:noticeOne of :debug, :verbose, :notice, or :warning.
logfilenilRedis log path. Server supplies a generated private node-directory path when omitted.
daemonizefalseDirect Config value. Server overrides it from managed: foreground for true/:forcola, daemonized for false.
pidfilenilDirect Config value. Server always supplies a generated node-directory path.
dirnilRedis working directory. Server always supplies its generated node directory.

At least one of port > 0, tls_port, or unixsocket must be enabled.

Persistence, memory, and TCP

OptionDefaultMeaning
save:default:default leaves Redis defaults untouched; :disabled emits an empty save; a list of {positive_seconds, positive_changes} emits explicit policies.
appendonlyfalseEnables AOF persistence.
appendfsync:everysecOne of :always, :everysec, or :no.
maxmemorynilRedis memory limit string, for example "256mb".
maxmemory_policynilRedis eviction policy string, for example "allkeys-lru".
tcp_backlognilNon-negative Redis TCP listen backlog.
timeoutnilRedis idle-client timeout when using Config directly. On Server, the timeout keyword is instead the wrapper startup timeout; use of the Redis directive through Server is intentionally unavailable because :extra cannot override wrapper-owned timeout.
tcp_keepalivenilNon-negative Redis TCP keepalive interval.
unixsocketnilStandalone Unix socket path, at most 103 bytes for portable macOS/Linux support.
unixsocketpermnilRedis socket mode string, for example "700".

TLS

OptionDefaultMeaning
tls_portnilTLS listener, 1..65_535. Enables TLS configuration and makes TLS the lifecycle connection.
tls_cert_filenilRequired TLS server certificate when tls_port is set.
tls_key_filenilRequired TLS server private key when tls_port is set.
tls_ca_cert_filenilTrusted CA file used by Redis and redis-cli; mutually exclusive with tls_ca_cert_dir.
tls_ca_cert_dirnilTrusted CA directory; mutually exclusive with tls_ca_cert_file. Exactly one CA source is required.
tls_auth_clientsnilnil, "yes", "no", or "optional". Redis's default is client-certificate authentication.
tls_client_cert_filenilredis-cli client certificate. Required with its key when client auth is nil/"yes". Not emitted to Redis.
tls_client_key_filenilredis-cli client private key. Not emitted to Redis.
tls_server_namenilredis-cli SNI/hostname-verification name. Not emitted to Redis.
tls_insecurefalseDisables redis-cli certificate verification. Not emitted to Redis.
tls_replicationfalseEmits tls-replication yes; Sentinel sets this for TLS data nodes.
tls_clusterfalseEmits tls-cluster yes; Cluster sets this for TLS nodes.

To run TLS-only, set port: 0. To use both plaintext and TLS listeners, leave a positive port; lifecycle commands still use TLS whenever tls_port is set.

Replication and Cluster directives

OptionDefaultMeaning
replicaofnil{host, port} for a standalone replica. Sentinel owns this for its replicas.
masterusernilACL username used for replication; requires replicaof and masterauth.
masterauthnilReplication password; requires replicaof.
cluster_enabledfalseEmits cluster-enabled yes. Cluster owns this for its nodes.
cluster_config_filenilRedis Cluster state filename. Cluster generates a per-node filename.
cluster_node_timeoutnilNon-negative Cluster node timeout in milliseconds.
cluster_announce_hostnamenilExplicit Cluster announcement hostname.
cluster_announce_portnilExplicit Cluster data port, 1..65_535.
cluster_announce_bus_portnilExplicit Cluster bus port, 1..65_535.

Modules and raw directives

OptionDefaultMeaning
loadmodule[]Module paths or {path, [string_args]} tuples. Every token is quoted/escaped when needed.
extra[]{directive, string_or_nonempty_string_vector} tuples for untyped Redis directives.

Use an argument vector for multi-token directives:

extra: [
  {"notify-keyspace-events", "KEA"},
  {"client-output-buffer-limit", ["pubsub", "32mb", "8mb", "60"]}
]

Directive names are case-insensitive and must contain letters, numbers, and hyphens. :extra cannot replace wrapper-owned fields, including endpoint, auth, TLS, persistence, replication, Cluster, module, PID, directory, and process-lifecycle directives. Unknown Redis directives are accepted by the builder and may still be rejected by the selected Redis version.

Server options

Server.start/1 and Server.start_link/1 accept the Config keys above plus:

OptionDefaultMeaning
namenilGenServer registration name. Removed before Config construction.
redis_server_bindistribution defaultExecutable name or path.
redis_cli_bin"redis-cli"Executable name or path used for readiness, commands, and shutdown.
distribution:core:core, :full, or :legacy_stack; see the support policy.
timeout10_000Wrapper startup/readiness timeout in milliseconds. This shadows the Config field with the same name.
managedtruetrue for a foreground Port, :forcola for guaranteed owner-death cleanup, or false for a detached Redis daemon.

Server owns daemonize, pidfile, and dir even if values are supplied. It honors an explicit logfile, otherwise it generates one beside redis.conf. Only managed: false can be detached with Server.detach/1.

Cluster options

Cluster accepts exactly this topology surface; it does not forward every Config field.

OptionDefaultMeaning
namenilCluster GenServer registration name.
masters3Positive master count.
replicas_per_master0Non-negative replica count for each master.
base_port7100First data/TLS port. Nodes use consecutive ports.
bind"127.0.0.1"Node listen address(es).
control_hostfirst bindConcrete host for commands and Cluster announcements.
username / passwordnilPassword-only or named ACL authentication on every node.
tlsfalseCreates TLS-only Cluster nodes when true.
TLS certificate/client optionsnil / falsetls_cert_file, tls_key_file, one CA source, tls_auth_clients, client certificate/key, tls_server_name, and tls_insecure.
redis_server_bindistribution defaultRedis executable name/path.
redis_cli_bin"redis-cli"CLI executable name/path.
distribution:core:core, :full, or :legacy_stack.
timeout10_000Per-node process-readiness timeout.
convergence_timeoutvalue of timeoutBounded wait for every node to report a healthy agreed topology.
cluster_node_timeout5_000Positive Cluster node timeout in milliseconds.
loadmodule[]Modules loaded into every node.
extra[]Raw non-reserved Redis directives loaded into every node.
managedtrueLifecycle backend forwarded to every node. Only false supports Cluster.detach/1.

For N = masters * (1 + replicas_per_master), Cluster uses data ports base_port..base_port+N-1 and bus ports exactly 10,000 higher. Both ranges are validated for overlap and overflow. Unix sockets are rejected.

Sentinel options

Sentinel accepts exactly this topology surface:

OptionDefaultMeaning
namenilSentinel topology GenServer registration name.
master_name"mymaster"Name monitored by Sentinel.
master_port6390Master data/TLS port.
replicas2Non-negative replica count.
replica_base_portmaster_port + 1First consecutive replica port.
sentinels3Positive Sentinel control-process count.
sentinel_base_port26_389First consecutive Sentinel control port.
quorum2Positive quorum, no greater than sentinels.
down_after_ms5_000Sentinel down-after-milliseconds value.
failover_timeout_ms10_000Sentinel failover-timeout value.
bind"127.0.0.1"Listen address(es) for data and control processes.
control_hostfirst bindConcrete host used for replication, monitoring, and commands.
username / passwordnilPassword-only or named ACL auth for data/control nodes and monitoring.
tlsfalseCreates TLS-only Redis and Sentinel listeners when true.
TLS certificate/client optionsnil / falseSame TLS fields accepted by Cluster.
redis_server_bindistribution defaultUsed to start both Redis and --sentinel processes.
redis_cli_bin"redis-cli"CLI executable name/path.
distribution:core:core, :full, or :legacy_stack.
timeout10_000Per-process readiness timeout.
convergence_timeoutvalue of timeoutBounded replication and Sentinel-discovery wait.
loadmodule[]Modules loaded into master and replicas, never Sentinel control processes.
managedtrueLifecycle backend used by data and control processes. Only false supports Sentinel.detach/1.

All master, replica, and Sentinel port ranges must be valid, free, and non-overlapping. Unix sockets and arbitrary :extra data-node directives are not part of the Sentinel surface.

Manager options

Manager always launches detached (managed: false) processes and records their credentials/endpoints in its state file. It intentionally exposes a narrower surface than Server, Cluster, and Sentinel.

Manager.start_basic/1

OptionDefaultMeaning
namegeneratedPersistent instance name.
port6379Plain listener; use 0 with TLS or a Unix socket.
passwordgeneratedOmit to generate; pass nil explicitly for no auth.
usernamenilNamed ACL user paired with password.
bind / control_hostloopback / derivedServer listen and control addresses.
persistfalseEnables default RDB policy and AOF.
maxmemorynilRedis memory limit.
loadmodule[]Modules loaded into the server.
distribution:coreRedis distribution selection.
extra[]Raw non-reserved Redis directives.
Unix/TLS optionsunsetunixsocket, unixsocketperm, tls_port, certificate/CA/client fields, tls_server_name, and tls_insecure.

The tls boolean is ignored for basic instances; setting tls_port selects TLS. Manager does not forward custom binary paths, startup timeouts, or other typed Config fields.

Manager.start_cluster/1

Accepted keys are name, masters, replicas_per_master, base_port, password, username, bind, control_host, loadmodule, distribution, tls, and the TLS certificate/client fields. Defaults match Cluster. Manager does not forward Cluster extra, timeout, node-timeout, binary, or managed options.

Manager.start_sentinel/1

Accepted keys are name, master_port, replicas, sentinels, quorum, sentinel_base_port, password, username, bind, control_host, loadmodule, distribution, tls, and the TLS certificate/client fields. Defaults match Sentinel except Manager derives quorum as min(2, sentinels). Manager does not forward replica_base_port, timing, binary, raw Config, or managed options.

Manager state and operations

The application environment key :redis_server_wrapper, :manager_state_file changes the default ~/.config/redis-server-wrapper/instances.json path.

The public operations are:

  • list/1 (optionally :basic, :cluster, or :sentinel);
  • info/1 for stored data plus live status;
  • credentials/1 for intentionally retrieving unredacted auth/URL data;
  • stop/1 and stop_all/0 for ownership-checked destructive shutdown;
  • cleanup/0 for removing stopped entries without signaling live processes.

See security and data safety before using persistent Manager instances outside an isolated developer machine.