Redis Configuration

Configuring Redis server

Get Configuration

CONFIG GET * # get all config
CONFIG GET maxmemory # get specific config
INFO # server info

Set Configuration

CONFIG SET maxmemory 100mb # set memory limit
CONFIG REWRITE # save config to redis.conf

Memory Management

maxmemory 256mb # max memory limit
maxmemory-policy allkeys-lru # eviction policy

Eviction Policies

noeviction # return errors when memory limit reached
allkeys-lru # evict least recently used keys
volatile-lru # evict LRU keys with expire set
allkeys-random # evict random keys
volatile-ttl # evict keys with shortest TTL

Security

requirepass password # set password
AUTH password # authenticate
rename-command FLUSHDB '' # disable command

Connection

bind 127.0.0.1 # bind to IP
port 6379 # port number
timeout 300 # client timeout (seconds)
maxclients 10000 # max simultaneous clients