Skip to main content

Configuration

Redis Configuration Configuration File Location Linux: /etc/redis/redis.conf

Windows: redis.windows.conf

macOS: /usr/local/etc/redis.conf

Basic Configuration

bash
# redis.conf - Basic settings
port 6379
bind 127.0.0.1
timeout 300
tcp-keepalive 300
daemonize yes
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16

Security Configuration

bash
# redis.conf - Security settings
requirepass your_strong_password
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""
bind 127.0.0.1
protected-mode yes
# SSL/TLS configuration (Redis 6.0+)
port 0
tls-port 6380
tls-cert-file /path/to/redis.crt
tls-key-file /path/to/redis.key
tls-ca-cert-file /path/to/ca.crt

Persistence Configuration

bash
# RDB persistence
save 900 1
save 300 10
save 60 10000
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis/
# AOF persistence
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

Performance Configuration

bash
# redis.conf - Performance tuning
maxmemory 2gb
maxmemory-policy allkeys-lru
maxclients 10000
tcp-backlog 511
timeout 0
tcp-keepalive 300
hz 10
# Memory optimization
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