Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
Redis Setup and Connecting
Run Redis locally, in Docker, or use a managed service, then connect with redis-cli β the interactive command-line client.
Getting Redis running
bash
docker run -d -p 6379:6379 redis # run in Docker (default port 6379)
redis-cli # connect
127.0.0.1:6379> PING
PONGPING β PONG confirms the connection. Redis listens on port 6379 by default.
Basic CLI usage
redis-cli
redis-cli SET greeting "hello" # run a command directly
redis-cli GET greeting # "hello"
# inside the interactive shell:
127.0.0.1:6379> SELECT 1 # switch to database 1 (0-15 available)
127.0.0.1:6379> DBSIZE # number of keys
127.0.0.1:6379> FLUSHDB # clear the current database (careful!)Connection string
Apps connect with a URL: redis://:password@host:6379/0 (or rediss:// for TLS). It carries host, port, password, and database number.
Managed Redis
Note: In production, managed options β Redis Cloud, AWS ElastiCache, Azure Cache for Redis β handle persistence, failover, and scaling for you, so you rarely run Redis by hand.
Tip: RedisInsight is a free official GUI for browsing keys, running commands, and visualizing memory usage β handy while you're learning the data types.
Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified