redis-cli INFO: Inspect Redis Server State in CI
redis-cli INFO prints a sectioned report of Redis server state: version, memory, clients, replication, persistence, and stats.
INFO is the introspection command. In CI it confirms a server is up, checks replication role, or reads memory before a load test.
What it does
INFO returns a text report grouped into sections (server, clients, memory, persistence, stats, replication, cpu, keyspace). Passing a section name limits output to that group. Each line is a key:value pair, so grepping a single field is straightforward in a script.
Common usage
redis-cli INFO server
# just the replication section
redis-cli INFO replication
# extract one field for a check
redis-cli INFO server | grep redis_version
redis-cli -h localhost -p 6379 INFO | grep '^role:'Options
| Section | What it reports |
|---|---|
| server | Version, mode, run id, uptime |
| replication | role (master/slave), connected replicas, offsets |
| memory | used_memory, maxmemory, fragmentation |
| persistence | RDB/AOF state, last save, loading flag |
| clients | connected_clients, blocked_clients |
| stats | total_connections, keyspace hits/misses |
In CI
INFO replication is the quickest way to assert a replica attached to its primary (look for role:slave and master_link_status:up). INFO persistence shows loading:1 while an RDB is still loading, which is a better readiness gate than a bare PING for a server restoring a dump. Pin the field with grep '^key:' to avoid matching substrings.
Common errors in CI
"Could not connect to Redis at localhost:6379: Connection refused" means the server is not up or the port is wrong. "NOAUTH Authentication required" means INFO needs a password; add -a or use REDISCLI_AUTH. An empty section means you misspelled the section name; INFO ignores unknown names and returns nothing for them.