📚 Redis Infrastructure Basics
1. What is Redis?
- Redis is an open-source, in-memory data structure store used as a database, cache, and message broker.
- Supports data types like:
- Strings
- Lists
- Sets
- Sorted Sets
- Hashes
- Bitmaps, HyperLogLogs, Geospatial indexes, Streams
- Extremely fast (operations in microseconds) because it keeps data entirely in memory.
2. Basic Single-Instance Deployment
- Easiest way to use Redis:
- One Redis server running on one machine (or VM/container).
- Configuration file:
redis.conf
- Key configs:
port, bind, timeout, maxmemory, appendonly, etc.
Example start command:
redis-server /path/to/redis.conf
Example simple client connect:
redis-cli
Limitations:
- Single point of failure (SPOF).
- Limited to memory of a single machine.
3. Redis Persistence Options
Redis can save data to disk (important for durability):
| Mode |
How it works |
Notes |
| RDB (snapshot) |
Save a point-in-time snapshot at intervals |
Fast startup, but might lose recent writes |
| AOF (append-only file) |
Log every write operation to a file |
Safer but slower |