# Redis Configuration for Production Stack # Based on Redis 7.x best practices # Network Configuration bind 0.0.0.0 port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 # General Settings daemonize no supervised no pidfile /var/run/redis.pid loglevel notice databases 16 # Persistence Configuration # RDB Snapshots # After 900 sec (15 min) if at least 1 key changed save 900 1 # After 300 sec (5 min) if at least 10 keys changed save 300 10 # After 60 sec if at least 10000 keys changed save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /data # AOF Persistence (Append Only File) appendonly yes appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb # Memory Management maxmemory 512mb maxmemory-policy allkeys-lru maxmemory-samples 5 # Lazy Freeing (async deletion) lazyfree-lazy-eviction yes lazyfree-lazy-expire yes lazyfree-lazy-server-del yes replica-lazy-flush yes # Security # NOTE: Password should be set via REDIS_PASSWORD environment variable # requirepass will be set via redis-cli CONFIG SET after startup protected-mode yes # Limits maxclients 10000 # Slow Log slowlog-log-slower-than 10000 slowlog-max-len 128 # Advanced Config hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-size -2 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 # Performance Tuning activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit replica 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 # Disable dangerous commands (optional) # rename-command FLUSHDB "" # rename-command FLUSHALL "" # rename-command CONFIG ""