CONFIG REWRITE to persist across server restarts.
Key Concepts
Runtime Config
Parameters that can be changed without restarting Redis. Most settings support runtime modification.
Persistent Config
Configuration stored in redis.conf. Use CONFIG REWRITE to save runtime changes permanently.
Read-Only Parameters
Some parameters cannot be changed at runtime and require a server restart.
Categories
Configurations are grouped by function: Memory, Persistence, Networking, Security, and more.
Required Permissions
| Action | Permission |
|---|---|
| View configuration | iam:project:infrastructure:redis:read |
| Modify configuration | iam:project:infrastructure:redis:write |
Configuration Categories
| Category | Description | Examples |
|---|---|---|
| Memory | Memory limits and management | maxmemory, hash-max-ziplist-entries |
| Persistence | AOF and RDB settings | appendonly, save, rdb-compression |
| Networking | Connection and timeout settings | bind, port, tcp-keepalive, timeout |
| Security | Authentication and access control | requirepass, protected-mode |
| Replication | Master-replica configuration | replicaof, min-replicas-to-write |
| Clients | Client connection limits | maxclients, client-output-buffer-limit |
| Logging | Slow log and latency tracking | slowlog-log-slower-than, slowlog-max-len |
How to View Configuration
How to Modify Configuration
Common Settings
Memory Configuration
| Parameter | Description | Default |
|---|---|---|
maxmemory | Maximum memory limit (0 = unlimited) | 0 |
maxmemory-policy | Eviction policy when limit is reached | noeviction |
hash-max-ziplist-entries | Max entries for ziplist encoding | 512 |
hash-max-ziplist-value | Max value size for ziplist encoding | 64 |
Eviction Policies
| Policy | Description |
|---|---|
| noeviction | Return error when memory limit reached |
| allkeys-lru | Evict least recently used keys |
| allkeys-lfu | Evict least frequently used keys |
| volatile-lru | Evict LRU keys with TTL set |
| volatile-lfu | Evict LFU keys with TTL set |
| allkeys-random | Evict random keys |
| volatile-random | Evict random keys with TTL set |
| volatile-ttl | Evict keys with shortest TTL |
Client Configuration
| Parameter | Description | Default |
|---|---|---|
maxclients | Maximum concurrent connections | 10000 |
timeout | Client idle timeout in seconds (0 = disabled) | 0 |
tcp-keepalive | TCP keepalive interval in seconds | 300 |
Slow Log Configuration
| Parameter | Description | Default |
|---|---|---|
slowlog-log-slower-than | Log commands slower than N microseconds | 10000 |
slowlog-max-len | Maximum slow log entries to keep | 128 |
Set
slowlog-log-slower-than to 0 to log all commands, or -1 to disable slow logging.Persistence Configuration
| Parameter | Description | Default |
|---|---|---|
appendonly | Enable AOF persistence | no |
appendfsync | AOF fsync policy (always, everysec, no) | everysec |
save | RDB snapshot triggers | Various |
How to Persist Configuration Changes
Runtime changes are lost on restart unless persisted.Troubleshooting
Cannot modify configuration
Cannot modify configuration
- You need write permission
- Some parameters are read-only and require restart
- The server may be in read-only mode
- Check if the parameter name is correct
Changes not persisting after restart
Changes not persisting after restart
- Run
CONFIG REWRITEto save changes to redis.conf - Verify Redis has write access to the config file
- Check if Redis was started with a config file
CONFIG REWRITE failed
CONFIG REWRITE failed
- Redis may not have write permission to config file
- Redis may have been started without a config file
- File system may be read-only
- Check Redis logs for specific error
Parameter not found
Parameter not found
- Check Redis version (some parameters are version-specific)
- Verify parameter name spelling
- Some parameters are aliases (e.g., slaveof vs replicaof)
Invalid value error
Invalid value error
- Check the expected value format
- Memory values use K, M, G suffixes (e.g., 100mb)
- Boolean values use yes/no, not true/false
- Time values may be in seconds or milliseconds
Server performance degraded after change
Server performance degraded after change
- Revert the change using the same edit process
- Common causes: maxmemory too low, aggressive eviction
- Check Redis INFO for memory and eviction stats
- Monitor slow log for performance impact
FAQ
What's the difference between runtime and static configuration?
What's the difference between runtime and static configuration?
Runtime (dynamic) configuration can be changed while Redis is running using CONFIG SET. Static configuration requires editing redis.conf and restarting the server. Most parameters support runtime modification.
How do I find the current redis.conf location?
How do I find the current redis.conf location?
Run
CONFIG GET dir to get the working directory and CONFIG GET dbfilename for the database file. The redis.conf is typically in the same directory or /etc/redis/.What happens if maxmemory is set too low?
What happens if maxmemory is set too low?
Depending on maxmemory-policy: noeviction returns errors on writes, eviction policies delete keys to free memory. Monitor evicted_keys in INFO stats to detect excessive eviction.
Should I enable AOF or RDB persistence?
Should I enable AOF or RDB persistence?
RDB provides point-in-time snapshots, good for backups but potential data loss. AOF logs every write, better durability but larger files. Many production systems use both.
What's a good value for slowlog-log-slower-than?
What's a good value for slowlog-log-slower-than?
Default is 10000 microseconds (10ms). For production, 1000-10000 is typical. Set lower for debugging, higher if slow log fills too quickly. Use 0 to log everything.
How do I reset a parameter to default?
How do I reset a parameter to default?
Use CONFIG SET with the default value. Alternatively, restart Redis without the parameter in redis.conf to restore defaults.
Can configuration changes affect running operations?
Can configuration changes affect running operations?
Most changes are immediate and safe. Memory-related changes may trigger eviction. Persistence changes may affect disk I/O. Test in non-production first.
Why do some parameters show empty values?
Why do some parameters show empty values?
Empty values typically mean the parameter uses a default or is disabled. For example, an empty
bind means Redis listens on all interfaces.Best Practices
Before Making Changes
- Document current values before modifying
- Understand the impact of each parameter
- Test changes in non-production environments first
- Have a rollback plan ready
Memory Configuration
- Set maxmemory to leave headroom for overhead
- Choose appropriate eviction policy for your use case
- Monitor memory usage after changes
- Consider fragmentation when setting limits
Performance Tuning
- Start with defaults, adjust based on monitoring
- Use slow log to identify bottlenecks
- Tune tcp-keepalive based on network environment
- Adjust maxclients based on expected load
Persistence Settings
- Balance durability vs performance with appendfsync
- Configure save points based on data change rate
- Monitor disk I/O after persistence changes
- Test backup and recovery procedures
Security Settings
- Enable protected-mode in production
- Set strong requirepass for authentication
- Consider ACL for fine-grained access (Redis 6+)
- Limit bind addresses to required interfaces