Configuration
Redis Configuration
可於Redis網站下載各版本的redis.conf檔案,在檔案中以記載了每個參數的基本解釋。有關
Maxmemory policies
有關記憶體配置政策,可以參考GCP網站,包含如何分配Redis存取記憶記憶體的比例,以及超出記憶體上限限制後的刪除規則,亦整理於下方表格。
Parameter
Description
Acceptable values
activedefrag
Redis version 4.0, or later. Works to free up instance memory tied up by standard OSS Redis memory fragmentation behavior.
no
(default)
yes
lfu-decay-time
Redis version 4.0, or later. The time, in minutes, before the LFU frequency counter for a given key will be divided by two (or, if the counter is < 10, decremented by 1). See the REDIS.CONF file for additional information.
Positive integers of the 'long' data type (default=1)
lfu-log-factor
Redis version 4.0, or later. Determines how the frequency counter represents key hits. Before you modify the default configuration, read about how the lfu-log-factor
configuration works in the REDIS.CONF file.
Positive integers of the 'long' data type (default=10)
maxmemory-gb
Designates an adjustable limit at which your eviction policy takes effect. For example, if you have a 10 GB instance and you set maxmemory-gb
to 8
, your eviction policy takes effect when your data occupies 8 GB of your instance memory. This leaves you 2 GB of memory as overhead. By default maxmemory-gb
is set to your instance capacity. For details on how to best use the maxmemory-gb
configuration, see the Memorystore memory management best practices.You can only modify the maxmemory-gb
configuration using the gcloud
command-line tool. The configuration is not available in the Google Cloud Console
Number of GB expressed as a whole number or decimal.
Examples:
10
designates a maxmemory-gb
of 10 GB.
1.5
designates a maxmemory-gb
of 1.5 GB.
maxmemory-gb
can be reduced to a minimum of 20% of your instance capacity.
maxmemory-policy
Specifies the behavior Redis follows when the instance data reaches the maxmemory-gb
limit. Refer to Maxmemory policies for a description of the behavior of each policy.
For additional information about the open source Redis maxmemory policies, see the open source Redis LRU cache page
noeviction
allkeys-lru
volatile-lru
(default)
allkeys-random
volatile-random
volatile-ttl
volatile-lfu
(Redis version 4.0 and higher)
allkeys-lfu
(Redis version 4.0 and higher)
notify-keyspace-events
Allows clients to subscribe to notifications on certain keyspace events. See the Redis Keyspace Notifications page on the Redis site for more information.
""
(default)
K
Keyspace events, published with __keyspace@__ prefix.
E
Keyevent events, published with __keyevent@__ prefix.
g
Generic commands (non-type specific) like DEL, EXPIRE, or RENAME
$
String commands
l
List commands
s
Set commands
h
Hash commands
z
Sorted set commands
x
Expired events (events generated every time a key expires)
e
Evicted events (events generated when a key is evicted for maxmemory)
A
Alias for g$lshzxe, so that the "AKE" string means all the events.
stream-node-max-bytes
Redis version 5.0, or later. The Redis stream data structure uses a radix tree to store items. The stream-node-max-bytes
parameter designates the maximum number of bytes available to store items in a single tree node. Once this limit is reached new items are stored in a new tree node.
Integers 0 and higher. (default=4096) 0 designates a tree node of unlimited size.
stream-node-max-entries
Redis version 5.0, or later. The Redis stream data structure uses a radix tree to store items. The stream-node-max-entries
parameter designates the number of items that can be stored in a single node. When this limit is reached, new items are stored in a new tree node.
Integers 0 and higher. (default=100) 0 designates a tree node with an unlimited number of items.
timeout
The number of seconds before idle client connections are terminated. However, if timeout
is set to 0
idle clients do not timeout and remain connected until the client issues the termination.You can only modify the timeout
configuration using the gcloud
command-line tool. The configuration is not available in the Google Cloud Console
0 (default) Integers >= 120 Unit = seconds
補充:GCP Redis不可修改的參數
Parameter
Default
lua-time-limit
5000
hash-max-ziplist-entries
2048
hash-max-ziplist-value
1024
list-max-ziplist-size
-2
list-compress-depth .
0
set-max-intset-entries
512
zset-max-ziplist-entries
1024
zset-max-ziplist-value
1024
hll-sparse-max-byte
3000
activerehashing
是
hz
10
databases
16
maxclients
65000
slowlog-log-slower-than
10000
slowlog-max-len
128
Last updated
Was this helpful?