Skip to content
Latchkey

redis-cli CONFIG GET and SET: Tune Redis in CI

redis-cli CONFIG GET reads runtime parameters by name or glob, and CONFIG SET changes them live without restarting the server.

Tests sometimes need a specific Redis configuration: an eviction policy, a memory cap, or persistence off. CONFIG GET/SET applies it at runtime.

What it does

CONFIG GET returns the current value of one or more parameters, accepting glob patterns to match families like maxmemory*. CONFIG SET changes a parameter immediately for the running server (not all parameters are settable at runtime). The pair lets a CI step assert or adjust config without editing redis.conf.

Common usage

Terminal
redis-cli CONFIG GET maxmemory
redis-cli CONFIG GET 'maxmemory*'
# set an eviction policy and a cap for a load test
redis-cli CONFIG SET maxmemory 256mb
redis-cli CONFIG SET maxmemory-policy allkeys-lru
# disable AOF persistence during a fast test
redis-cli CONFIG SET appendonly no

Options

CommandWhat it does
CONFIG GET <param>Return the current value of a parameter
CONFIG GET '<glob>'Match a family, e.g. maxmemory* or save
CONFIG SET <param> <value>Change a parameter at runtime
CONFIG REWRITEPersist runtime changes back to the config file
CONFIG RESETSTATReset INFO stats counters

In CI

CONFIG SET changes are in-memory only; they vanish on restart unless you CONFIG REWRITE, which is fine for an ephemeral test container. Some parameters (for example certain cluster and networking settings) cannot be changed at runtime and require a config file or restart. Quote glob patterns so the shell does not expand them.

Common errors in CI

"ERR Unknown option or number of arguments for CONFIG SET" means a misspelled parameter or a non-settable one. "ERR CONFIG SET failed - Unable to set ..." can mean a value out of range, such as a maxmemory below current usage. "NOAUTH Authentication required" means CONFIG needs a password; add -a or REDISCLI_AUTH. In protected mode, CONFIG may be disabled to outside clients.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →