New article
Redis complete tutorial: installation, first commands and real examples
A practical Redis guide to understand what it is, how to install it on macOS, Linux and Windows, and how to use strings, expirations, counters, lists and hashes from the CLI.
What matters before you install Redis
Content adapted to the current official Redis installation docs valid as of April 1, 2026.
Redis is not used like a classic relational database
The key idea is simple: operate on keys, keep values compact and use expiration intentionally for cache, sessions and fast counters.
The current official installation path depends on the platform
The official Redis docs still point to Linux, macOS, Windows compatibility through Memurai, and source installation for manual builds.
The fastest way to learn Redis is with redis-cli
A few commands are enough to understand strings, hashes, lists, counters, expiration and common inspection patterns.
Redis is strongest when you need very fast access by key, controlled expiration and simple data structures
It is common to use Redis for cache, sessions, rate limiting, queues, ephemeral state and counters. It can persist data, but in many projects its first practical value is reducing latency and load in front of slower systems.
What Redis is
Redis is an in-memory data store oriented around keys. Instead of thinking in joins, you think in direct access to keys and in native structures like strings, hashes, lists, sets and sorted sets.
When it fits well
Caching database queries, storing sessions, invalidating tokens, building request counters, keeping temporary shopping cart state or protecting APIs with rate limiting.
Where to be careful
Redis is not the natural replacement for a relational model full of complex joins. If the value of the system depends on relational integrity and long historical analytics, Redis is usually complementary, not the whole database.
Install with Homebrew
brew install redis
brew services start redis
redis-cli pingFor a local macOS setup this is the shortest path. After starting the service, `redis-cli ping` should answer `PONG`.
Use the package manager or compile from source
sudo apt update
sudo apt install redis-server
redis-cli pingIn Linux, official docs separate distribution packages from source installation. For Debian or Ubuntu, installing `redis-server` is the usual entry point.
Use the official Windows compatibility path
Official docs point to Memurai for Windows compatibility.
Alternative for development: run Redis in WSL or Docker.If you work daily in Windows, WSL is often the most predictable developer setup. The current Redis install docs explicitly point Windows users to Memurai.
Compile Redis manually
wget https://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
sudo make installThis route is useful when you want more control, need to test source builds or work on environments where packages are not enough.
Basic commands with redis-cli
redis-cli ping
SET site:name "1938"
GET site:name
DEL site:nameThis is the minimal loop: verify the server, write a key, read it and delete it.
Store data with expiration
SET page:home "<html>...</html>" EX 60
TTL page:home
GET page:homeThis pattern is one of the main reasons to add Redis to a web architecture: keep fast data for a short time and let it expire automatically.
Count requests or events
INCR stats:visits
INCRBY stats:api:requests 5
GET stats:visitsCounters are trivial in Redis and are frequently used for analytics, quotas and lightweight monitoring.
Represent a small user object
HSET user:42 name "Ana" role "admin" plan "pro"
HGET user:42 name
HGETALL user:42Hashes are useful when several fields belong to the same key and you do not need a full relational record with joins.
Simple queue example
LPUSH queue:emails "send-welcome:42"
LPUSH queue:emails "send-reset:18"
RPOP queue:emailsA list is enough for many simple queue scenarios, especially in internal tools or small background jobs.
Basic rate limiting by IP
MULTI
INCR rate:ip:203.0.113.10
EXPIRE rate:ip:203.0.113.10 60
EXECThe idea is straightforward: count requests per IP and expire the key after one minute. If the value crosses your threshold, reject the request.
Verification and first checks
After installation, the first useful check is still `redis-cli ping`. If the answer is not `PONG`, check whether the service is started, whether the port is open and whether your local host and port match the expected values.
Security basics
Redis official docs warn against exposing an unhardened instance to the internet. In practice, keep it behind a firewall, bind only to the interfaces you need and configure authentication if clients must connect remotely.
Official references
redis.io/docs/latest/operate/oss_and_stack/install/archive/install-redis/
redis.io/docs/latest/operate/oss_and_stack/install/archive/install-redis/install-redis-from-source/
Next database reads
If Redis is already clear, the next useful step is to compare it with document, wide-column or graph databases depending on your real use case.