Skip to content

Redis - Server

Redis server commands are used to manage, monitor, and configure the Redis instance itself. They are essential tools for administrators and developers to ensure the health, performance, and stability of the server.

The INFO command provides a comprehensive report on the server’s state. You can request all information or specify a section (e.g., INFO memory, INFO clients). Below is an example output from a modern Redis 7.x server.

127.0.0.1:6379> INFO
# Server
redis_version:7.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:e753424d9c44569e
redis_mode:standalone
os:Linux 5.15.0-52-generic x86_64
arch_bits:64
...
# Clients
connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0
...
# Memory
used_memory:996568
used_memory_human:973.21K
used_memory_rss:4087808
used_memory_rss_human:3.90M
...
# Persistence
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1668541334
...
aof_enabled:1
aof_rewrite_in_progress:0
...
# Replication
role:master
connected_slaves:0
...
# Keyspace
db0:keys=10,expires=2,avg_ttl=3599988

The following table lists critical server commands, grouped by function.

CommandDescription
INFO [section]Provides detailed information and statistics about the server.
CONFIG GET Gets the value of a configuration parameter (e.g., CONFIG GET port).
CONFIG SET Sets a configuration parameter on-the-fly without a server restart.
TIMEReturns the current server time as a UNIX timestamp and microseconds.
SHUTDOWN [NOSAVE|SAVE]Shuts down the server. Can optionally prevent or force a final save to disk.
CommandDescription
FLUSHDBRemoves all keys from the currently selected database. Use with caution.
FLUSHALLRemoves all keys from all databases. Extremely destructive; use with extreme caution.
DBSIZEReturns the total number of keys in the selected database.
CommandDescription
REPLICAOF Makes the server a replica of another instance. This is the modern replacement for SLAVEOF.
REPLICAOF no onePromotes a replica to a master.
ROLEReturns the role of the instance (master, replica, or sentinel) and replication status.
SLAVEOF Deprecated since Redis 5. Use REPLICAOF instead.
CommandDescription
MONITORStreams all commands processed by the server in real-time. Excellent for debugging.
SLOWLOG GET [count]Shows the Redis slow queries log, helping identify performance bottlenecks.
CLIENT LISTGets the list of client connections to the server.
LASTSAVEReturns the UNIX timestamp of the last successful RDB save.

Beyond a Single Server: Modern Architectures

Section titled “Beyond a Single Server: Modern Architectures”

While these commands help manage a single Redis server, modern applications often require high availability and horizontal scaling. For these needs, Redis offers advanced solutions:

• Redis Sentinel: A separate system that provides high availability for Redis. It monitors master and replica instances and can automatically perform a failover if the master becomes unavailable. • Redis Cluster: Provides a way to run a Redis installation where data is automatically sharded across multiple nodes. This allows for horizontal scaling of both data storage and throughput.