Redis5.0.0プロファイル


# redis   5.0.0
 
#            ,Redis                     。 :
./redis-server /path/to/redis.conf
 
#     :          ,          , 1k、5GB、4M ,         :
#            。 1GB、1gB、1Gb    。
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
 
#########################    #########################
 
#   redis server                ,        
#     server      include    CONFIG REWRITE    。
#               。            include     ,
#        
# include /path/to/local.conf
# include /path/to/other.conf
 
#########################    ######################### 
#        。           ,    。      loadmodule  。
# loadmodule /path/to/my_module.so
# loadmodule /path/to/other_module.so
 
#########################    #########################
 
#    bind  redis          。            。
# Examples:
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#                  。
bind 127.0.0.1
 
#         。    ,      bind  ip redis    ,          。
protected-mode yes
 
#     ,    6379
#   port   0 redis     tcp socket
port 6379
 
#             backlog            。  Linux           /proc/sys/net/core/somaxconn  ,        somaxconn tcp_max_syn_backlog            。
tcp-backlog 511
 
#       Unix       。     ,        Redis    Unix socket
# unixsocket /tmp/redis.sock
# unixsocketperm 700
 
#              (0    )
timeout 0
 
# tcp-keepalive  。    ,
#    SO_KEEPALIVE              ACK,    :
# 1)          
# 2)                    
#  Linux ,      (   )    ACK     。
#   :                 。
#                    
tcp-keepalive 300
 
#########################    #########################
 
#    Redis        。         'yes'
#           Redis         /var/run/redis.pid
daemonize no
 
#     upstart systemd      。  no      ,     upstart, systemd, auto
supervised no
 
# pid   redis     ,     。         。
pidfile /var/run/redis_6379.pid
 
 
#       。   debug, verbose, notice, warning
loglevel notice
 
#     。          。    redis       ,           /dev/null
logfile ""
 
#           。
# syslog-enabled no
 
#         。
# syslog-ident redis
 
#   syslog  。   user LOCAL0 ~ LOCAL7  。
# syslog-facility local0
 
#        。       DB 0
#     SELECT where dbid is a number between 0 and 'databases'-1             。
databases 16
 
# redis       Logo
always-show-logo yes
#########################     #########################
#      :
#                    :
#  900 (15  )  ,   1   
#  300 (5  )  ,   10   
#  60   ,   10000   
#            "save"         。
#               save             save  , : save ""
save 900 1
save 300 10
save 60 10000
 
#             RDB              ,redis         ,
#           。               ,redis           。
#              。
stop-writes-on-bgsave-error yes
 
#      .rdb      LZF     ,     yes。     cpu         no。
rdbcompression yes
 
#     5 RDB   CRC64              。           ,
#        RDB   ,        (  10%),             。
#         RDB     0    ,            
rdbchecksum yes
 
# rdb    
dbfilename dump.rdb
 
#       ,         "dbfilename"   。        。
#              ,     。
dir ./
 
#########################      #########################
 
#       。
# 1) redis        ,           slave       master      。
# 2)          ,slave            。
# 3)       ,slave           。
# replicaof  
 
# master    
# masterauth 
 
#    slave   master   ,         ,slave        :
# 1)    replica-serve-stale-data     "yes" (   ),slave          ,       ,             。
# 2)    replica-serve-stale-data     "no",slave   "   master  (SYNC with master in progress)"       ,   INFO   SLAVEOF   。
replica-serve-stale-data yes
 
#      salve         。   slave               (    salve#      master          ),                          。
#  Redis2.6     slave   
#   :   slave                      。               。
#      slave           config,debug 。        'rename-command'                  slave    。
replica-read-only yes
 
#     :    socket,      
repl-diskless-sync no
 
#            ,          ,   master       socket  RDB   slave。
#     5 ,   0         。
repl-diskless-sync-delay 5
 
# slave          master  ping  。  10 。
# repl-ping-replica-period 10
 
#        
# 1)slave  master SYNC         ,    
# 2) slave  ,master  ,    、ping 
# 3) master  ,slave  , master  REPLCONF ACK pings#           repl-ping-slave-period,                    
# repl-timeout 60
 
#    slave     SYNC     TCP_NODELAY
#     yes,Redis      TCP      slaves    。          slave    ,Linux          40  。
#     no,     salve                。
#             ,                 ,     “yes”。
repl-disable-tcp-nodelay no
 
#        backlog  。backlog   slave             salve     ,    slave      ,        ,            ,         #     slave           。
#    backlog  ,slave                      。
# backlog             slave  。
# repl-backlog-size 1mb
 
#  master           slave  ,backlog    。            
# slave          ,backlog      。
# 0      backlog
# repl-backlog-ttl 3600
 
# slave            Redis Info   。  master       ,sentinel        slave   master。
#        salve        master,       slave      10,100,25,sentinel           10 slave。
# 0          ,    slave    master,        0 slave     # sentinel     master。
#       100
slave-priority 100
 
#   master  N       M     slave,          。
# N slave   “oneline”  。
#         ,           ,       slave    ping(      )    。
#       N slave       ,            。
#       3       10  slave      :
# min-replicas-to-write 3
# min-replicas-max-lag 10
 
#        0       。
#    min-replicas-to-write   0(     )   min-replicas-max-lag   10。
 
# A Redis master is able to list the address and port of the attached
# replicas in different ways. For example the "INFO replication" section
# offers this information, which is used, among other tools, by
# Redis Sentinel in order to discover replica instances.
# Another place where this info is available is in the output of the
# "ROLE" command of a master.
#
# The listed IP and address normally reported by a replica is obtained
# in the following way:
#
#   IP: The address is auto detected by checking the peer address
#   of the socket used by the replica to connect with the master.
#
#   Port: The port is communicated by the replica during the replication
#   handshake, and is normally the port that the replica is using to
#   listen for connections.
#
# However when port forwarding or Network Address Translation (NAT) is
# used, the replica may be actually reachable via different IP and port
# pairs. The following two options can be used by a replica in order to
# report to its master a specific set of IP and port, so that both INFO
# and ROLE will report those values.
#
# There is no need to use both the options if you need to override just
# the port or the IP address.
#
# replica-announce-ip 5.5.5.5
# replica-announce-port 1234
 
#########################    #########################
 
#                       。
# requirepass foobared
 
#      
#       ,           。  ,     CONFIG              ,             。
#   :
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#                      
# rename-command CONFIG ""
#    :          AOF                 。
 
#########################    #########################
 
#               。       10000    ,    Redis       
#                ,                        32(  Redis                   )
#         ,Redis             'max number of clients reached'
# maxclients 10000
 
#                。          ,Redis          (  :maxmemmory-policy)  key。
#         Redis    key,        "noeviction",Redis                 。  ,SET,LPUSH  ,        Get       。
#    Redis  LRU  ,                 (   "noeviction"   )   ,           。
#   :    slave         ,master   slave                   。     key ,         /           key   ,   slaves         key    DEL  ,         key,              。
#   ,         slave,         maxmemory  ,              slave      (             "noeviction"       )
# maxmemory 
 
#       :         ,Redis      key。
# volatile-lru ->   LRU           key
# allkeys-lru ->   LRU      key
# volatile-lfu ->   LFU           key
# allkeys-lfu ->   LFU      key
# volatile-random ->             key
# allkeys-random ->       key
# volatile-ttl ->        key(minor TTL)
# noeviction ->      key,        
#   :       ,  Redis           key             。#          :set setnx setex append incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby getset mset msetnx exec sort
#     :
# maxmemory-policy noeviction
 
# LRU   TTL           ,     (     ),            。   :  Redis   3 key        ,                    。
#     5,                CPU。
# maxmemory-samples 5
 
# Starting from Redis 5, by default a replica will ignore its maxmemory setting
# (unless it is promoted to master after a failover or manually). It means
# that the eviction of keys will be just handled by the master, sending the
# DEL commands to the replica as keys evict in the master side.
#
# This behavior ensures that masters and replicas stay consistent, and is usually
# what you want, however if your replica is writable, or you want the replica to have
# a different memory setting, and you are sure all the writes performed to the
# replica are idempotent, then you may change this default (but be sure to understand
# what you are doing).
#
# Note that since the replica by default does not evict, it may end using more
# memory than the one set via maxmemory (there are certain buffers that may
# be larger on the replica, or data structures may sometimes take more memory and so
# forth). So make sure you monitor your replicas and make sure they have enough
# memory to never hit a real out-of-memory condition before the master hits
# the configured maxmemory setting.
#
# replica-ignore-maxmemory yes
 
######################### APPEND ONLY MODE #########################
# Redis has two primitives to delete keys. One is called DEL and is a blocking
# deletion of the object. It means that the server stops processing new commands
# in order to reclaim all the memory associated with an object in a synchronous
# way. If the key deleted is associated with a small object, the time needed
# in order to execute the DEL command is very small and comparable to most other
# O(1) or O(log_N) commands in Redis. However if the key is associated with an
# aggregated value containing millions of elements, the server can block for
# a long time (even seconds) in order to complete the operation.
#
# For the above reasons Redis also offers non blocking deletion primitives
# such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and
# FLUSHDB commands, in order to reclaim memory in background. Those commands
# are executed in constant time. Another thread will incrementally free the
# object in the background as fast as possible.
#
# DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled.
# It's up to the design of the application to understand when it is a good
# idea to use one or the other. However the Redis server sometimes has to
# delete keys or flush the whole database as a side effect of other operations.
# Specifically Redis deletes objects independently of a user call in the
# following scenarios:
#
# 1) On eviction, because of the maxmemory and maxmemory policy configurations,
#    in order to make room for new data, without going over the specified
#    memory limit.
# 2) Because of expire: when a key with an associated time to live (see the
#    EXPIRE command) must be deleted from memory.
# 3) Because of a side effect of a command that stores data on a key that may
#    already exist. For example the RENAME command may delete the old key
#    content when it is replaced with another one. Similarly SUNIONSTORE
#    or SORT with STORE option may delete existing keys. The SET command
#    itself removes any old content of the specified key in order to replace
#    it with the specified string.
# 4) During replication, when a replica performs a full resynchronization with
#    its master, the content of the whole database is removed in order to
#    load the RDB file just transferred.
#
# In all the above cases the default is to delete objects in a blocking way,
# like if DEL was called. However you can configure each case specifically
# in order to instead release memory in a non-blocking way like if UNLINK
# was called, using the following configuration directives:
 
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
 
 
#      ,Redis             。               , Redis                       (       save  )。
# AOF                 ,               (       )。
#                Redis                       ,Redis    1     。
# AOF RDB               。
#   AOF  ,      Redis   AOF  ,           。
appendonly no
 
# AOF   (  :"appendonly.aof")
appendfilename "appendonly.aof"
 
# fsync()                   ,                。
#                    ;            。
# Redis         :
# no:     ,               。   。
# always:           aof  。 ,     。
# everysec:     。    。
#     "everysec"                         。
# appendfsync always
appendfsync everysec
# appendfsync no
 
#   AOF         "always"    "everysec",         (       AOF   )       I/O  。  Linux      Redis   fsync()         。
#   ,              ,        fsync()         write(2)  。
#         ,         。     BGSAVE   BGREWRITEAOF      fsync()。
#                   ,  Redis   "    "   。
#       ,            30       。(  Linux  )
#         "yes"       ,   "no",               。
no-appendfsync-on-rewrite no
 
#     AOF  。  AOF            ,Redis     BGREWRITEAOF     AOF    。#     :Redis       AOF     (           ,        AOF  )
#               。            ,        。                ,                          。
#       0   AOF      。
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
 
#      yes,           AOF   redis        ,redis          。     no,erdis      。     "redis-check-aof"      。
aof-load-truncated yes
 
# [RDB file][AOF tail]
#    Redis   AOF   “REDIS”     ,
#         RDB  ,      AOF
#   。
aof-use-rdb-preamble yes
######################### LUA   #########################
 
# Lua          ,     
lua-time-limit 5000
 
#########################    #########################
 
#          ,redis            
# cluster-enabled yes
 
#   redis            。           redis           。
# cluster-config-file nodes-6379.conf
 
#          。              。
# cluster-node-timeout 15000
 
#       ,       master slave         master。  slave master      :(node-timeout * slave-validity-factor) + repl-ping-slave-period       master。
#  node-timeout 30 ,slave-validity-factor 10,   default repl-ping-slave-period 10 ,      310 slave     master。
#    slave-validity-factor            slave  master,                 master。
#             ,     0, slave   master          master
# cluster-replica-validity-factor 10
 
#      master              slave   ,slave       master。   1(       3   ,1 master+2 slaves,master  ,    1 slave      1 slave    )
#         0,          1
# cluster-migration-barrier 1
 
#        redis          1 hash slot   ,         。
#     slot         。
#                      ,   no。
# cluster-require-full-coverage yes
 
#      yes ,   replicas    master            
#   ,master            ,         。
# cluster-replica-no-failover no
 
########################## CLUSTER DOCKER/NAT support  ########################
 
# In certain deployments, Redis Cluster nodes address discovery fails, because
# addresses are NAT-ted or because ports are forwarded (the typical case is
# Docker and other containers).
#
# In order to make Redis Cluster working in such environments, a static
# configuration where each node knows its public address is needed. The
# following two options are used for this scope, and are:
#
# * cluster-announce-ip
# * cluster-announce-port
# * cluster-announce-bus-port
#
# Each instruct the node about its address, client port, and cluster message
# bus port. The information is then published in the header of the bus packets
# so that other nodes will be able to correctly map the address of the node
# publishing the information.
#
# If the above options are not used, the normal Redis Cluster auto-detection
# will be used instead.
#
# Note that when remapped, the bus port may not be at the fixed offset of
# clients port + 10000, so you can specify any port and bus-port depending
# on how they get remapped. If the bus-port is not set, a fixed offset of
# 10000 will be used as usually.
#
# Example:
#
# cluster-announce-ip 10.1.1.5
# cluster-announce-port 6379
# cluster-announce-bus-port 6380
 
#########################       #########################
 
#      ,             。              IO         ,          。
# 1000000  1 ,   0       
slowlog-log-slower-than 10000
 
#     ,   SLOWLOG RESET    
slowlog-max-len 128
 
 
 
######################### LATENCY MONITOR #########################
# redis                 ,               。
#    LATENCY                  ,    
#                        (  )   ,
#          latency-monitor-threshold      ,
#     0 ,            
latency-monitor-threshold 0
 
 
#########################      #########################
# K 	     ,      __keyspace@__    
# E 	     ,      __keyevent@__    
# g 	DEL 、 EXPIRE 、 RENAME              
# $ 	        
# l 	       
# s 	       
# h 	       
# z 	         
# x 	    :            
# e 	  (evict)  :       maxmemory          
# A 	   g$lshzxe    
#  Example: to enable list and generic events, from the point of view of the
#           event name, use:
#
#  notify-keyspace-events Elg
#
#  Example 2: to get the stream of the expired keys subscribing to channel
#             name __keyevent@0__:expired use:
#
#  notify-keyspace-events Ex
# Redis    Pub/Sub              ,    
notify-keyspace-events ""
 
############################### ADVANCED CONFIG ###############################
 
#  hash     entry ,     entry              ,         
#        。              
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
 
 
#        ,              quicklist    ziplist  。  ,       
#  5   ,    quicklist   ziplist    5    。
#        ,              quicklist    ziplist  。  ,    -1 -5
#     ,       :
#    -5:   quicklist    ziplist      64 Kb。( :1kb => 1024 bytes)
#    -4:   quicklist    ziplist      32 Kb。
#    -3:   quicklist    ziplist      16 Kb。
#    -2:   quicklist    ziplist      8 Kb。(-2 Redis      )
#    -1:   quicklist    ziplist      4 Kb。
list-max-ziplist-size -2
 
#         quicklist           。
#  :         quicklist         ,    ziplist        。
#    ,  quicklist    ziplist,     ,        。
#   list-compress-depth       :
#    0:      ,      。  Redis    。
#    1:   quicklist    1      ,       。
#    2:   quicklist    2      ,       。
#    3:   quicklist    3      ,       。
#        …
#   0     ,     quicklist               ,              。
list-compress-depth 0
 
 
# set          : set       64               。
#              set                。
set-max-intset-entries 512
 
#  hash list  ,                        。
#                         
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
 
# HyperLogLog           。     
# 16     。 HyperLogLog        
#     ,          。
#    16000      ,     
#              。
#     3000  ,         ,        
hll-sparse-max-bytes 3000
 
# Streams       /  。                      。      
#             ,                    
#        。            0,    ,          
#       max-bytes   0, max-entries       
stream-node-max-bytes 4096
stream-node-max-entries 100
 
#       , 100 CPU     1      Redis     (       )
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
 
#              。              ,
#                                      
#   ,        ,         ,               。
# client-query-buffer-limit 1gb
 
#  Redis   ,    ,        strings,     512 MB。
#   ,   z     
# proto-max-bulk-len 512mb
 
#      ,“hz”     10。      Redis        CPU ,       key
#       Redis      ,            
hz 10
 
# Normally it is useful to have an HZ value which is proportional to the
# number of clients connected. This is useful in order, for instance, to
# avoid too many clients are processed for each background task invocation
# in order to avoid latency spikes.
#
# Since the default HZ value by default is conservatively set to 10, Redis
# offers, and enables by default, the ability to use an adaptive HZ value
# which will temporary raise when there are many connected clients.
#
# When dynamic HZ is enabled, the actual configured HZ will be used as
# as a baseline, but multiples of the configured HZ value will be actually
# used as needed once more clients are connected. In this way an idle
# instance will use very little CPU time while a busy instance will be
# more responsive.
dynamic-hz yes
 
#         AOF   ,         ,      32M      
aof-rewrite-incremental-fsync yes
 
 
#  redis  RDB   ,         ,   32 MB  ,    fsync-ed。 
#     ,                       。
rdb-save-incremental-fsync yes
 
# Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good
# idea to start with the default settings and only change them after investigating
# how to improve the performances and how the keys LFU change over time, which
# is possible to inspect via the OBJECT FREQ command.
#
# There are two tunable parameters in the Redis LFU implementation: the
# counter logarithm factor and the counter decay time. It is important to
# understand what the two parameters mean before changing them.
#
# The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis
# uses a probabilistic increment with logarithmic behavior. Given the value
# of the old counter, when a key is accessed, the counter is incremented in
# this way:
#
# 1. A random number R between 0 and 1 is extracted.
# 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1).
# 3. The counter is incremented only if R < P.
#
# The default lfu-log-factor is 10. This is a table of how the frequency
# counter changes with a different number of accesses with different
# logarithmic factors:
#
# +--------+------------+------------+------------+------------+------------+
# | factor | 100 hits   | 1000 hits  | 100K hits  | 1M hits    | 10M hits   |
# +--------+------------+------------+------------+------------+------------+
# | 0      | 104        | 255        | 255        | 255        | 255        |
# +--------+------------+------------+------------+------------+------------+
# | 1      | 18         | 49         | 255        | 255        | 255        |
# +--------+------------+------------+------------+------------+------------+
# | 10     | 10         | 18         | 142        | 255        | 255        |
# +--------+------------+------------+------------+------------+------------+
# | 100    | 8          | 11         | 49         | 143        | 255        |
# +--------+------------+------------+------------+------------+------------+
#
# NOTE: The above table was obtained by running the following commands:
#
#   redis-benchmark -n 1000000 incr foo
#   redis-cli object freq foo
#
# NOTE 2: The counter initial value is 5 in order to give new objects a chance
# to accumulate hits.
#
# The counter decay time is the time, in minutes, that must elapse in order
# for the key counter to be divided by two (or decremented if it has a value
# less <= 10).
#
# The default value for the lfu-decay-time is 1. A Special value of 0 means to
# decay the counter every time it happens to be scanned.
#
# lfu-log-factor 10
# lfu-decay-time 1
 
########################### ACTIVE DEFRAGMENTATION #######################
 
#         
# activedefrag yes
 
#                 
# active-defrag-ignore-bytes 100mb
 
#               
# active-defrag-threshold-lower 10
 
#                
# active-defrag-threshold-upper 100
 
#  CPU               
# active-defrag-cycle-min 5
 
#            
# active-defrag-cycle-max 75
 
#             set / hash / zset / list   
# active-defrag-max-scan-fields 1000