redis config file location ubuntu?
redis config file location /etc//redis/redis.conf
wordpress redis configuration
- Install : apt install redis
- 2. configure
sudo nano /etc/redis/redis.conf
maxmemory 256mb
maxmemory-policy allkeys-lru
LRU means least recently used key will be evicted if memory reaches to max.
redist basic configuration settings mandator to work as expected
maxmemory: default unlimited
eviction policy // defaut no eviction
Binding localhost or remote IP. //default same as localhost
part 2 redis configuration with php or wordpresss
apt install php-redis
or php7.4-redis
edit wp config
detailed at Redis installation on wordpress
lru = least recently used.
redis configuration file default 6.0
self documented here
where is redis config located?
linux & mac
/etc/redis/redis.conf
How do I configure Redis?
you can edit redis.conf for permanent changes, use redis command line to store in memory. below are list of redis configurable variables.
you can also check redis performance metrics.
important configuration settings in redis config file
maxmemory
eviction policy
RDB persistent
Binding localhost or remote IP.
redis slow logs
latency: in case of remote
Cluster or master
redis configuration settings all
network
keepalive
binding local or remote
snapshot
RDB
AOF – append only file
replication
latency
slowlogs
security
ACL rules
clinets
max client setttings
default 10000
memory
max memory
hard memory limit
deafult no limit:
maxmemory:0
used_memory_human:39.47M
maxmemory-policy noeviction default
LAZY FREEING
THREADED I/O
By default threading is disabled, we suggest enabling it only in machines
# that have at least 4 or more cores
KERNEL OOM CONTROL
Redis actively control the oom_score_adj value for all its processes
APPEND ONLY MOD
Append Only File is an alternative persistence mode fsync polcy
LUA SCRIPTING
Max execution time of a Lua script in milliseconds.
lua-time-limit 5000 // default
REDIS CLUSTER
CLUSTER DOCKER/NAT support
LATENCY MONITOR
By default latency monitoring is disabled
EVENT NOTIFICATION
Pub/Sub clients
GOPHER SERVER
old server 1990s
ADVANCED CONFIG
definetely look at
ACTIVE DEFRAGMENTATION
Active (online) defragmentation allows a Redis server to compact the
# spaces left between small allocations and deallocations of data in memory,
# thus allowing to reclaim back memory.
disabled by default
Redis config command
127.0.0.1:6379> CONFIG GET *
1) “dbfilename”
2) “dump.rdb”
3) “requirepass”
4) “”
5) “masterauth”
6) “”
7) “cluster-announce-ip”
8) “”
9) “unix socket”
10) “”
11) “logfile”
12) “/var/log/redis/redis-server.log”
13) “pidfile”
14) “/var/run/redis/redis-server.pid”
15) “slave-announce-ip”
16) “”
17) “maxmemory”
18) “0”
19) “proto-max-bulk-len”
20) “536870912”
21) “client-query-buffer-limit”
22) “1073741824”
23) “maxmemory-samples”
24) “5”
25) “lfu-log-factor”
26) “10”
27) “lfu-decay-time”
28) “1”
29) “timeout”
30) “0”
31) “active-defrag-threshold-lower”
32) “10”
33) “active-defrag-threshold-upper”
34) “100”
35) “active-defrag-ignore-bytes”
36) “104857600”
37) “active-defrag-cycle-min”
38) “25”
39) “active-defrag-cycle-max”
40) “75”
41) “auto-aof-rewrite-percentage”
42) “100”
43) “auto-aof-rewrite-min-size”
44) “67108864”
45) “hash-max-ziplist-entries”
46) “512”
47) “hash-max-ziplist-value”
48) “64”
49) “list-max-ziplist-size”
50) “-2”
51) “list-compress-depth”
52) “0”
53) “set-max-intset-entries”
54) “512”
55) “zset-max-ziplist-entries”
56) “128”
57) “zset-max-ziplist-value”
58) “64”
59) “hll-sparse-max-bytes”
60) “3000”
61) “lua-time-limit”
62) “5000”
63) “slowlog-log-slower-than”
64) “10000”
65) “latency-monitor-threshold”
66) “0”
67) “slowlog-max-len”
68) “128”
69) “port”
70) “6379”
71) “cluster-announce-port”
72) “0”
73) “cluster-announce-bus-port”
74) “0”
75) “tcp-backlog”
76) “511”
77) “databases”
78) “16”
79) “repl-ping-slave-period”
80) “10”
81) “repl-timeout”
82) “60”
83) “repl-backlog-size”
84) “1048576”
85) “repl-backlog-ttl”
86) “3600”
87) “maxclients”
88) “10000”
89) “watchdog-period”
90) “0”
91) “slave-priority”
92) “100”
93) “slave-announce-port”
94) “0”
95) “min-slaves-to-write”
96) “0”
97) “min-slaves-max-lag”
98) “10”
99) “hz”
100) “10”
101) “cluster-node-timeout”
102) “15000”
103) “cluster-migration-barrier”
104) “1”
105) “cluster-slave-validity-factor”
106) “10”
107) “repl-diskless-sync-delay”
108) “5”
109) “tcp-keepalive”
110) “300”
111) “cluster-require-full-coverage”
112) “yes”
113) “cluster-slave-no-failover”
114) “no”
115) “no-appendfsync-on-rewrite”
116) “no”
117) “slave-serve-stale-data”
118) “yes”
119) “slave-read-only”
120) “yes”
121) “stop-writes-on-bgsave-error”
122) “yes”
123) “daemonize”
124) “yes”
125) “rdbcompression”
126) “yes”
127) “rdbchecksum”
128) “yes”
129) “activerehashing”
130) “yes”
131) “activedefrag”
132) “no”
133) “protected-mode”
134) “yes”
135) “repl-disable-tcp-nodelay”
136) “no”
137) “repl-diskless-sync”
138) “no”
139) “aof-rewrite-incremental-fsync”
140) “yes”
141) “aof-load-truncated”
142) “yes”
143) “aof-use-rdb-preamble”
144) “no”
145) “lazyfree-lazy-eviction”
146) “no”
147) “lazyfree-lazy-expire”
148) “no”
149) “lazyfree-lazy-server-del”
150) “no”
151) “slave-lazy-flush”
152) “no”
153) “maxmemory-policy”
154) “noeviction”
155) “loglevel”
156) “notice”
157) “supervised”
158) “no”
159) “appendfsync”
160) “everysec”
161) “syslog-facility”
162) “local0”
163) “appendonly”
164) “no”
165) “dir”
166) “/var/lib/redis”
167) “save”
168) “”
169) “client-output-buffer-limit”
170) “normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60”
171) “unixsocketperm”
172) “0”
173) “slaveof”
174) “”
175) “notify-keyspace-events”
176) “”
177) “bind”
178) “127.0.0.1 ::1”
127.0.0.1:6379>
redis tcp keep alive for local host
From version 3.2 onwards, Redis has TCP keepalive ( SO_KEEPALIVE socket option) enabled by default and set to about 300 seconds.
redis.conf sample text
redsconf.txt file
monitor redis by using redis commands