Open-Source Wikis

/

Redis

/

How to contribute

/

Tooling

redis/redis

Tooling

The repository ships a number of helper scripts and code generators. They are not optional in the build flow — commands.def is generated and req-res-log-validator.py is invoked by CI.

Code generation

utils/generate-command-code.py

Reads every JSON file under src/commands/ and produces src/commands.def, a single ~12,000-line table that the server reads at startup. The Makefile target is:

make -C src commands.def

When you add or modify a command spec, run that command before committing or CI will fail with a stale commands.def.

The script also emits command-help.def (driven by argument descriptions) and the data structures consumed by COMMAND INFO/COMMAND DOCS.

utils/generate-commands-json.py

Produces a flat commands.json payload from the per-command files. Useful for clients that want a single-document description of the entire command set.

utils/generate-fmtargs.py

Generates the printf-like fmtargs.h macro family that lets addReplyArrayLen and friends format dispatchable strings without repetition.

utils/generate-module-api-doc.rb

A Ruby script that walks src/redismodule.h for RedisModule_* declarations and emits markdown documentation. The output is published to redis.io.

Validators

utils/req-res-log-validator.py

When redis-server is built with REDIS_CFLAGS=-DLOG_REQ_RES, every reply the server sends is logged in JSON form. The validator script consumes the log + the command JSON specs and checks that each reply matches the documented schema.

CI runs this in daily.yml:

./runtest --log-req-res
./utils/req-res-log-validator.py /path/to/log

A schema mismatch means either the JSON spec is wrong or the C implementation drifted. Fixing it is part of the PR that introduced the change.

utils/reply_schema_linter.js

A node script that statically lints the JSON schemas embedded in src/commands/*.json. CI gate: .github/workflows/reply-schemas-linter.yml.

utils/build-static-symbols.tcl

Used during release builds to extract the list of C symbols that should be exported by redis-server for use by loadable modules. Modules link against this static symbol surface.

.codespell/

codespell configuration that the spell-check.yml workflow uses to flag typos in source comments and docs. Add false-positives to the per-project .codespell/exclude.txt (or wherever the existing ignore lives).

Bench helpers

utils/lru/

Small driver programs to test the LRU/LFU eviction algorithms outside the server.

utils/srandmember/

Standalone driver for benchmarking SRANDMEMBER distribution.

utils/hyperloglog/

Tools for analysing HyperLogLog accuracy and behaviour at large cardinalities.

utils/speed-regression.tcl

A Tcl driver that runs the standard benchmark suite and checks for regressions. Run between releases.

Operations

utils/install_server.sh

Interactive script to install redis-server as a SysV-style service. Prompts for port, config path, log path, and data directory. The corresponding template lives in utils/redis_init_script.tpl.

utils/systemd-redis_server.service and utils/systemd-redis_multiple_servers@.service

Drop-in systemd unit files. The first is single-instance; the second is templated (systemctl start redis_multiple_servers@7000).

utils/create-cluster/

Scripts to spin a six-node Redis cluster on localhost for development:

cd utils/create-cluster
./create-cluster start    # start six redis-server processes
./create-cluster create   # form the cluster
./create-cluster stop     # SIGTERM all six
./create-cluster clean    # rm the working dirs and PID files

utils/gen-test-certs.sh

Generates the certificate set used by the TLS test lane. Output goes to tests/tls/.

utils/redis-copy.rb, utils/redis-sha1.rb

Two old Ruby utilities — redis-copy.rb migrates keys between two instances; redis-sha1.rb computes a hash of an entire keyspace. Both predate --cluster mode in redis-cli and are kept for backwards compatibility.

utils/whatisdoing.sh

A gdb/pstack wrapper that prints the current call stack of all threads in a running redis-server. Useful when the watchdog is not enabled but the server is unresponsive.

CI workflows

Workflow Triggers What it does
ci.yml Every push and PR Build + unit + moduleapi + clang-tidy + reply-schema linter on Ubuntu LTS.
daily.yml Nightly Full matrix: 8+ OSes, ASAN/MSAN/UBSAN/valgrind, TLS, IO threads, Sentinel, cluster, FreeBSD cross-build.
coverity.yml Daily Submits a build to Coverity Scan.
codeql-analysis.yml Push, PR, weekly GitHub CodeQL security scan.
codecov.yml Daily Generates coverage and uploads to Codecov.
external.yml Manual Runs the suite against an external Redis instance (workflow dispatch).
post-release-automation.yml Tag push Releases binaries, publishes Docker images, fans out to redis-snap/redis-rpm/redis-debian.
reply-schemas-linter.yml Push, PR Lints src/commands/*.json reply schemas.
spell-check.yml Push, PR codespell on source/docs.
redis_docs_sync.yaml Daily Syncs commands JSON to the redis-doc repository.

Other build flags worth knowing

  • make REDIS_CFLAGS=-DREDIS_TEST — embed the C-level unit tests.
  • make REDIS_CFLAGS=-DLOG_REQ_RES — log every command and reply for schema validation.
  • make NO_LICENSE_CHECK=1 — skip the licence-header check that older builds enforce.
  • make USE_BACKTRACE=yes — link libexecinfo for richer crash dumps on systems without it by default.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Tooling – Redis wiki | Factory