tools

Config Checker Reads redis.conf the Way Each Redis and Valkey Version Does, and Finds Every Line That Would Stop the Server

A Redis server reads its config file once, when it starts, and stops at the first line it can’t use. It prints that line and exits. Fix it, restart, and it stops at the next one. On a server that should have come back five minutes ago, with a supervisor restarting it in a loop, that’s a slow way to find a typo.

The Config Checker reads a redis.conf or valkey.conf the way the version you pick reads it at startup. If the server wouldn’t start, you get the error it prints, word for word, at the same line, and then every other line it would stop at, each as if the ones before it were fixed. One pass finds them all.

The Config Checker with a file full of mistakes: Redis 8.10.2 stops at line 2, maxmemory 2 gb, with wrong number of arguments, and a table of the lines it would stop at next, among them a maxmemory-policy of lru, a save line with one number and a requirepass with an open quote.

It runs in your browser and doesn’t send anything anywhere, and the page’s security policy stops it from fetching or loading anything from another site. Config files hold passwords, so that matters.

The Same File, Fifteen Servers

A file that works with one version can stop another. Redis 7.0 stopped accepting gopher-enabled. Redis 8.0 no longer stops at a name it doesn’t know: it takes it for a module’s setting, reads on, and stops later while starting, when no module claims it. Valkey 9.0 reads "abc"def as one value where every other version refuses the line. The checker shows what all 15 versions, Redis 6.2 to 8.10 and Valkey 7.2 to 9.1, do with your file, side by side. Before an upgrade, that table is the one to read.

When the Server Starts but Doesn’t Do What You Meant

Plenty of lines pass and still surprise. A setting given twice keeps its last value. slave-read-only still works, under its new name. hz 1000 is quietly held at 500. The checker lists every setting the file changes with the value CONFIG GET would report, sizes in bytes and old names under new ones, and flags the ones worth a second look: no password with protected mode off, nothing saved to disk, no memory limit, an eviction policy that makes writes fail when memory runs out, DEBUG switched on.

It also reads the other side. Paste the output of CONFIG GET * from a running server, and it shows which settings differ from that version’s defaults, working out the version from the setting names if you don’t know it.

Checked Against 66,000 Config Files

The checker’s knowledge comes from the servers themselves: each version’s table of settings, read from its source code, and the defaults each built server reports. Then the 15 servers were started with 66,000 config files, built to find the edges: limits and one past them, numbers that overflow, memory units, signs, odd quoting, odd bytes, old names and settings that act on each other. For every file the checker gives the server’s answer, the same text byte for byte at the same line, or the same value for every setting, about 2,500,000 values in all.

Try It

The checker is one JavaScript file with no dependencies, open source under the Apache License 2.0. A deploy script can run it before a restart:

version=$(redis-server --version | grep -o 'v=[0-9.]*' | cut -c3-)
node config/cli.js /etc/redis/redis.conf --server "redis $version" || exit 1

The manual, the tests and the files they replay are in the config folder on GitHub.