Skip to content

Instantly share code, notes, and snippets.

@akshendra
Created June 18, 2018 11:07
Show Gist options
  • Save akshendra/315dfb59909b50c76ce55e99e403fe86 to your computer and use it in GitHub Desktop.
Save akshendra/315dfb59909b50c76ce55e99e403fe86 to your computer and use it in GitHub Desktop.
Cluster configuration for redis
################################## NETWORK #####################################
bind 0.0.0.0
protected-mode no
port 6379
tcp-backlog 511
## Close the connection after a client is idle for N seconds (0 to disable)
timeout 0
## ACK time period
tcp-keepalive 300
################################# GENERAL #####################################
daemonize yes
## Interaction with systemd or upstart
supervised no
## For daemon mode
pidfile "/var/run/redis_6379.pid"
loglevel notice
logfile "/var/log/redis_6379.log"
## To enable logging to the system logger, just set 'syslog-enabled' to yes,
syslog-enabled no
syslog-ident redis
syslog-facility local0
databases 16
always-show-logo yes
################################ SNAPSHOTTING ################################
# RDB saving
# save 900 1
# save 300 10
# save 60 10000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum no
dbfilename "dump.rdb"
dir "/var/lib/redis/6379"
################################# REPLICATION #################################
# slaveof <masterip> <masterport>
# masterauth <master-password>
slave-serve-stale-data no
slave-read-only yes
## used by sentinel
slave-priority 100
# slave-announce-ip 5.5.5.5
# slave-announce-port 1234
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-ping-slave-period 10
repl-timeout 300
repl-disable-tcp-nodelay no
## save in buffer what the slave needs, in case slaves get disconnected
repl-backlog-size 1mb
repl-backlog-ttl 3600
## master will write only if there are 3 slaves with lag less than 10
# min-slaves-to-write 3
# min-slaves-max-lag 10
################################## SECURITY ###################################
# requirepass foobared
# rename-command CONFIG ""
################################### CLIENTS ####################################
# maxclients 10000
############################## MEMORY MANAGEMENT ################################
# maxmemory <bytes>
## Policy to use to remove the keys, when memory is full
# maxmemory-policy noeviction
# maxmemory-samples 5
############################# LAZY FREEING ####################################
## Asynchonoushly deleting keys and data
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del yes
slave-lazy-flush no
############################## APPEND ONLY MODE ###############################
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
################################ LUA SCRIPTING ###############################
lua-time-limit 5000
################################ REDIS CLUSTER ###############################
cluster-enabled yes
cluster-config-file nodes.conf
## If a node is unreachable for below time, it will be considered lost
cluster-node-timeout 5000
cluster-slave-validity-factor 0
cluster-migration-barrier 1
cluster-require-full-coverage no
########################## CLUSTER DOCKER/NAT support ########################
# cluster-announce-ip 10.1.1.5
# cluster-announce-port 6379
# cluster-announce-bus-port 16379
################################## SLOW LOG ###################################
## 1 ms
slowlog-log-slower-than 1000
slowlog-max-len 128
################################ LATENCY MONITOR ##############################
## If operation time greater than given time, latency will log it. 0 is disable
latency-monitor-threshold 0
############################# EVENT NOTIFICATION ##############################
notify-keyspace-events ""
############################### ADVANCED CONFIG ###############################
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment