redis3.0プロファイルredis.conf詳細

12380 ワード

# redis3.0    redis.conf  
# Redis configuration file example.
# ./redis-server /path/to/redis.conf

##################################    ###################################
#              redis                。
# include /path/to/local.conf
# include /path/to/other.conf


################################      #####################################

#           ,   no 
daemonize yes

#3.2    ,        ,    。
#          bind   。      ,redis        ,      。
#         bind,    。      ,   no。
protected-mode yes

#          ,      pid,   /var/run/redis.pid 
pidfile /var/run/redis/redis-server.pid

#    ,   6379。       0,Redis     TCP   。
port 6379

#      TCP        (        )   ,          Linux     /proc/sys/net/core/somaxconn ,   511, Linux       128。                   ,              。           128,                  。        2048    。 /etc/sysctl.conf   :net.core.somaxconn = 2048,        sysctl -p。
tcp-backlog 511

#   redis         IP      ,       ,         
bind 127.0.0.1

#  unix socket  redis        。
# unixsocket /var/run/redis/redis.sock

#  unix socket       
# unixsocketperm 700

#              timeout,        , 0            ,    0。
timeout 0

#tcp keepalive  。      0,     tcp SO_KEEPALIVE ,
#  keepalive     :       、                             。
# Linux   ,   keepalive,redis        ack。               。
tcp-keepalive 0

#           。
loglevel notice
# 4    :
# debug :(    ,   /    )
# verbose :(         ,    debug     )
# notice :(     ,             )
# warning :(     /          )

#          。      ,            。     redis     /dev/null。
logfile /var/log/redis/redis-server.log

#      syslog  
# syslog-enabled no

#syslog    。
# syslog-ident redis

#     、  
# syslog-facility local0

#      ,         DB 0。    ”SELECT “      db
databases 16


################################     (RDB        ) ################################

#  rdb              ,        redis                         。

#     
#    “save”                   
#   sedis          。
save 900 1 			# 900 (15  )   1 key   (        --   ) 
save 300 10			# 300 (5  )   10 key   (        --   ) 
save 60 10000		# 60 (1  )   10000 key   (        --   )

# RDB        ,            。
# yes:      ,no:        ,    info  rdb_last_bgsave_status  RDB        
stop-writes-on-bgsave-error yes

#dump       ,   yes
#rdb      LZF    ,yes:  ,      cpu   。no:   ,         
rdbcompression yes

#    rdb  。 rdb          , rdb        CRC64    。
#           ,     rdb     ,    10%     ,          ,       。
rdbchecksum yes

#    rdb    ,    dump.rdb 
dbfilename dump.rdb

#  (dump.rdb)      ,     ./
dir /var/lib/redis

#################################        #################################

#      ,        ,      IP   
# slaveof  

#  master   requirepass,  slave   master,   master     。
# masterauth      master   ,       master     。
# masterauth 

#                  ,          :
# 1)   slave-serve-stale-data   yes(    ),             。
# 2)   slave-serve-stale-data   no,  INFO SLAVOF                 ”SYNC with master in progress”。
slave-serve-stale-data yes

#      ,         (yes),     NO,   (   )。
slave-read-only yes

#    socket      。  redis        ,disk socket。
#     slave        slave      ,        ,master   rdb  。
#  2   :disk   master         rdb       ,      rdb     slave。
# socket master        ,   rdb   socket     slave。
# disk     ,   rdb      ,  slave      rdb  。
# socket        slave    。       ,          socket  。
repl-diskless-sync no

#diskless       ,     0。      ,        slave          rdb  。          ,    slave   。
repl-diskless-sync-delay 5

#slave               ping  。         repl_ping_slave_period    ,  10 。
# repl-ping-slave-period 10

#        。master slave         。
# master   slave         repl-timeout,   slave  ,   slave  。
# slave      master       repl-timeout,   master  。
#       repl-timeout       repl-ping-slave-period    ,          。
# repl-timeout 60

#       tcp   tcp nodelay  ,   yes  no。   no,   tcp nodelay。
#   master   yes   tcp nodelay  ,       slave   ,               。
#              。           ,              ,    yes。
repl-disable-tcp-nodelay no

#        ,           ,           。
#    slave     ,       master   ,          ,               slave,          。
#         ,slave         ,         slave          。
#   slave     ,        ,  1m。
# repl-backlog-size 5mb

#master  slave               ,repl-backlog-ttl         。    。
# repl-backlog-ttl 3600

#  master   ,Sentinel   slave        master。
#        slave,  master。    0,       。
slave-priority 100

# redis      master       ,     min-slaves-to-write,   slave     N,mater     。
# master          slave         。          N slave       master    ,            slave   ,master           。   0      。
# min-slaves-to-write 3

#    min-slaves-max-lag  slave       slave。
# min-slaves-max-lag 10

#   1       0      。
# Setting one or the other to 0 disables the feature.
# By default min-slaves-to-write is set to 0 (feature disabled) and
# min-slaves-max-lag is set to 10.

#################################    #################################

# requirepass         AUTH       ,        。  redis             。
#           ,       ,             。
#   requirepass       ,  redis   ,      15w   ,           ,              。
# requirepass foobared

#              。  CONFIG                  ,        ,           。
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52

#        ,        
# rename-command CONFIG ""


###################################    ####################################

#      redis          。   10000      。
#   redis                      slave   ,  maxclients       32。
#      maxclients,redis        ’max number of clients reached’,     。
# maxclients 10000

#redis         。     ,    maxmemory-policy      。
#   slave           maxmemory  。             ,     maxmemory      。
# maxmemory 

#      maxmemory      。
# maxmemory-policy noeviction
#       :
#volatile-lru:  LRU            key。
#volatile-random:            key。
#volatile-ttl:       key,           (  TTL)
#allkeys-lru:  LRU      key。
#allkeys-random:      key。
#noeviction:     key,         。
#         ,  redis     key  ,     ,       。redis        ,   get  。
#      :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。

#lru      。  lru  ttl    ,             sample key,         key  。
# maxmemory-samples 5


############################       (AOF        )  #############################

#aof                。     redis    aof,      appendonly    。

#                 ,    no 。
#      ,                   。
#   redis            save      ,                    。
appendonly no

#       ,    appendonly.aof 
appendfilename appendonly.aof

#aof        
appendfsync everysec
# 3    :
# no      fsync,              ,    。
# always          fsync,          。
# everysec         fsync,        1s  。

#  aof      rdb     ,     IO,    everysec always aof    ,
#   fsync()          ,no-appendfsync-on-rewrite          no。
#             ,         yes,       no,                  。
#    yes  rewrite        fsync,       , rewrite      ,   no,  yes。
# Linux   fsync   30 。    30   。
no-appendfsync-on-rewrite no

# aof      。   aof            aof              ,
#   aof            Redis    bgrewriteaof         。
#   AOF             AOF       (   100) ,            。
auto-aof-rewrite-percentage 100

#         aof    ,                        
auto-aof-rewrite-min-size 64mb

# aof            , redis     ,aof          。
#        redis            ,   ext4        data=ordered  (redis                   。)      ,     redis  ,           。
#       yes,    aof        ,       log      load。
#    no,      redis-check-aof  AOF     。
aof-load-truncated yes


################################ LUA   ###############################
#           (  ),redis   log,    error。            。  SCRIPT KILL SHUTDOWN NOSAVE   。         write     。       write,         。
lua-time-limit 5000


################################ redis   ###############################
#    ,          。
# cluster-enabled yes

#         ,                 ,          。            ,       Redis     ,  Redis               ,                     
# cluster-config-file nodes-6379.conf

#         。         
# cluster-node-timeout 15000

  #          ,  slave       master,    slave   master         ,        ,   slave       master。        > slave   master         。     :
  #  slave        (node-timeout * slave-validity-factor) + repl-ping-slave-period
  #            ,   slave-validity-factor 10,     repl-ping-slave-period 10 ,     310 slave            
  #                        ,            ,      ,                 ,       
  #     0,              ,            
  # cluster-slave-validity-factor 10
  
  #master slave      ,slave         master ,         2,            2          ,            。
  #            ,       ,      ,          。
  
  # cluster-migration-barrier 1
  #     ,     slot     ,      ok,      。   no,   slot             。        ,          ,    mster        ,            。
  #   key         ,        ”yes”(   ),            ;        ”no”,            key     

################################## SLOW LOG ###################################
###slog log     redis             。             ,    slow log ,slog log      ,    IO  。
#     slowlog-log-slower-than       slowlog  ,     ,  1000000  1 。  ,            , 0          。
slowlog-log-slower-than 10000

#       。               ,           。        。          。      SLOWLOG RESET      。
slowlog-max-len 128


################################      ##############################
#           redis            , LATENCY  redis            。                。0  ,      。            ,       ,     CONFIG SET      。
latency-monitor-threshold 0


#############################      ##############################

#                     ,              Redis       。                  CPU ,        ,         。
#notify-keyspace-events                ,                 :
##K      ,      __keyspace@__    
##E      ,      __keyevent@__    
##g DEL 、 EXPIRE 、 RENAME              
##$         
##l        
##s        
##h        
##z          
##x     :            
##e   (evict)  :       maxmemory          
##A    g$lshzxe    
#             K    E,    ,          ,            。        http://redis.io/topics/notifications

notify-keyspace-events ""



###############################      ###############################
#       hash-max-ziplist-entries  ziplist,  hash-max-ziplist-entries hash
hash-max-ziplist-entries 512

#value      hash-max-ziplist-value  ziplist,  hash-max-ziplist-value hash。
hash-max-ziplist-value 64


#       list-max-ziplist-entries ziplist,  list-max-ziplist-entries list。
list-max-ziplist-entries 512

#value      list-max-ziplist-value  ziplist,  list-max-ziplist-value list。
list-max-ziplist-value 64


#       set-max-intset-entries iniset,  set-max-intset-entries set。
set-max-intset-entries 512


#       zset-max-ziplist-entries ziplist,  zset-max-ziplist-entries zset。
zset-max-ziplist-entries 128

#value      zset-max-ziplist-value ziplist,  zset-max-ziplist-value zset。
zset-max-ziplist-value 64


#value      hll-sparse-max-bytes        (sparse),  hll-sparse-max-bytes         (dense)。   16000  value      ,   value   3000。   CPU    ,        ,     10000  。
hll-sparse-max-bytes 3000

#Redis   100     1   CPU    redis hash     hash,         。        ,           ,     Redis        2       ,      no。              ,     yes,             。
activerehashing yes

##                                   ,              。
#  normal client,   0    hard limit,   0    0    soft limit,normal client      ,        ,          。
client-output-buffer-limit normal 0 0 0

#  slave client MONITER client,  client-output-buffer    256mb,     64mb  60 ,                。
client-output-buffer-limit slave 256mb 64mb 60

#  pubsub client,  client-output-buffer    32mb,     8mb  60 ,                。
client-output-buffer-limit pubsub 32mb 8mb 60

#redis        1s  hz。
hz 10

# aof     ,     aof-rewrite-incremental-fsync  ,    32MB    fsync。               ,           。
aof-rewrite-incremental-fsync yes