Overview
Redis is an incredibly fast, in-memory key-value store. Because it operates in memory, its configuration primarily revolves around two critical questions: what happens when memory runs out (Eviction), and what happens if the server crashes (Persistence)?
Memory Policies
Configure maxmemory and eviction algorithms (LRU/LFU) to prevent out-of-memory crashes.
Persistence
Tune AOF fsync intervals and RDB snapshot schedules to balance speed and data durability.
Security
Ensure protected mode is active and set up bind addresses to prevent unauthorized access.
Production Checklist
- Never Expose to the Internet: Redis was not designed to be exposed directly to the internet. Bind to a private network IP or localhost.
- Set maxmemory: Always set a
maxmemorylimit. Without it, Redis will continue allocating memory until the Linux OOM Killer abruptly terminates the process. - Disable Persistence for Cache: If using Redis strictly as a transient cache (data can be regenerated from a primary database), disable RDB and AOF to maximize IO performance.
- Use TLS: If your architecture requires Redis to communicate across different data centers or VPCs, enable TLS natively in
redis.conf.