redis.conf配置详解(四)

2014-11-24 11:41:16 · 作者: · 浏览: 8
lue for your application, # but the default is large in order to work in most conditions. vm-pages 134217728 # Max number of VM I/O threads running at the same time. # This threads are used to read/write data from/to swap file, since they # also encode and decode objects from disk to memory or the reverse, a bigger # number of threads can help with big objects even if they can't help with # I/O itself as the physical device may not be able to couple with many # reads/writes operations at the same time. # # The special value of 0 turn off threaded I/O and enables the blocking # Virtual Memory implementation. vm-max-threads 4 ############################### ADVANCED CONFIG ############################### # 当hash中包含超过指定元素个数并且最大的元素没有超过临界时, # hash将以一种特殊的编码方式(大大减少内存使用)来存储,这里可以设置这两个临界值 # Redis Hash对应Value内部实际就是一个HashMap,实际这里会有2种不同实现, # 这个Hash的成员比较少时Redis为了节省内存会采用类似一维数组的方式来紧凑存储,而不会采用真正的HashMap结构,对应的value redisObject的encoding为zipmap, # 当成员数量增大时会自动转成真正的HashMap,此时encoding为ht。 hash-max-zipmap-entries 512 hash-max-zipmap-value 64 # list数据类型多少节点以下会采用去指针的紧凑存储格式。 # list数据类型节点值大小小于多少字节会采用紧凑存储格式。 list-max-ziplist-entries 512 list-max-ziplist-value 64 # set数据类型内部数据如果全部是数值型,且包含多少节点以下会采用紧凑格式存储。 set-max-intset-entries 512 # zsort数据类型多少节点以下会采用去指针的紧凑存储格式。 # zsort数据类型节点值大小小于多少字节会采用紧凑存储格式。 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 # Redis将在每100毫秒时使用1毫秒的CPU时间来对redis的hash表进行重新hash,可以降低内存的使用 # # 当你的使用场景中,有非常严格的实时性需要,不能够接受Redis时不时的对请求有2毫秒的延迟的话,把这项配置为no。 # # 如果没有这么严格的实时性要求,可以设置为yes,以便能够尽可能快的释放内存 activerehashing yes ################################## INCLUDES ################################### # 指定包含其它的配置文件,可以在同一主机上多个Redis实例之间使用同一份配置文件,而同时各个实例又拥有自己的特定配置文件 # include /path/to/local.conf # include /path/to/other.conf

redis.conf 默认配置:
# Redis configuration file example  
  
# Note on units: when memory size is needed, it is possible to specify  
# it in the usual form of 1k 5GB 4M and so forth:  
#  
# 1k => 1000 bytes  
# 1kb => 1024 bytes  
# 1m => 1000000 bytes  
# 1mb => 1024*1024 bytes  
# 1g => 1000000000 bytes  
# 1gb => 1024*1024*1024 bytes  
#  
# units are case insensitive so 1GB 1Gb 1gB are all the same.  
  
# By default Redis does not run as a daemon. Use 'yes' if you need it.  
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.  
daemonize no  
  
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by  
# default. You can specify a custom pid file location here.  
pidfile /var/run/redis.pid  
  
# Accept connections on the specified port, default is 6379.  
# If port 0 is specified Redis will not listen on a TCP socket.  
port 6379  
  
# If you want you can bind a single interface, if the bind option is not  
# specified all the interfaces will listen for incoming connections.  
#  
# bind 127.0.0.1  
  
# Specify the path for the unix socket that will be used to listen for  
# incoming connections. There is no default, so Redis will not listen  
# on a unix socket when not specified.  
#  
# unixsocket /tmp/redis.sock  
# unixsocketperm 755  
  
# Close the connection after a client is idle for N seconds (0 to disable)  
timeout 0  
  
# TCP keepalive.  
#  
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence  
# of communication. This is useful for two reasons:  
#  
# 1) Detect dead peers.  
# 2) Take the connection alive from the poi