Using redis-cli

View saved

Open the CLI

Connect to localhost by default, or pass host and port.

redis-cli
redis-cli -h 127.0.0.1 -p 6379

Run commands

Type a command and arguments. Quotes help with spaces.

SET user:1:name "Ada"
GET user:1:name
DEL user:1:name

Inspect without blocking

Avoid KEYS * on large production datasets—it can stall Redis. Prefer SCAN for iteration.

SCAN 0 MATCH user:* COUNT 20
DBSIZE
INFO server

Select a database index

Redis has numbered logical databases (0 by default). Many teams use one DB and key prefixes instead.

SELECT 0
FLUSHDB  # deletes keys in the current DB — learning only

Comments

One comment per signed-in account. Comments are saved with this page’s URL.