Elixir wrapper for redis-server and redis-cli with GenServer-managed process lifecycles.
Manage Redis server processes for testing, development, and CI without Docker --
just redis-server and redis-cli on PATH.
Quick Start
# Single server
{:ok, server} = RedisServerWrapper.start_server(port: 6400, password: "secret")
RedisServerWrapper.Server.run(server, ["SET", "key", "value"])
RedisServerWrapper.Server.stop(server)
# Cluster
{:ok, cluster} = RedisServerWrapper.start_cluster(masters: 3, base_port: 7100)
RedisServerWrapper.Cluster.healthy?(cluster)
RedisServerWrapper.Cluster.stop(cluster)
# Sentinel
{:ok, sentinel} = RedisServerWrapper.start_sentinel(master_port: 6390, replicas: 2, sentinels: 3)
RedisServerWrapper.Sentinel.healthy?(sentinel)
RedisServerWrapper.Sentinel.stop(sentinel)Features
- Single server - start/stop with options, auto-cleanup on GenServer terminate
- Cluster - spin up N-master clusters with optional replicas
- Sentinel - full sentinel topology (master + replicas + sentinels)
- Custom binaries - point to any
redis-server/redis-clipath - Custom modules - load modules with argument-safe configuration on standalone servers, cluster nodes, and sentinel data nodes
- Untyped config escape hatch - pass additional non-reserved Redis
directives via the token-safe
:extraoption
Summary
Functions
Checks if redis-server is available on PATH (or at the given path).
Starts a Redis Cluster. See RedisServerWrapper.Cluster for options.
Starts a Redis Sentinel topology. See RedisServerWrapper.Sentinel for options.
Starts a single redis-server instance. See RedisServerWrapper.Server for options.
Returns the version of the same core redis-server binary selected by default startup, or of an explicitly supplied binary.
Functions
Checks if redis-server is available on PATH (or at the given path).
@spec start_cluster(keyword()) :: GenServer.on_start()
Starts a Redis Cluster. See RedisServerWrapper.Cluster for options.
@spec start_sentinel(keyword()) :: GenServer.on_start()
Starts a Redis Sentinel topology. See RedisServerWrapper.Sentinel for options.
@spec start_server(keyword()) :: GenServer.on_start()
Starts a single redis-server instance. See RedisServerWrapper.Server for options.
Returns the version of the same core redis-server binary selected by default startup, or of an explicitly supplied binary.