Redis.config構成の詳細
11702 ワード
#Redisプロファイル
# , 1k, 5GB, 4M , ( )
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# . 1gb 1Gb 1GB 1gB
# daemonize no ,redis , , yes
daemonize yes
# redis ,Redis pid /var/run/redis.pid, 。
# redis , pid
pidfile /var/run/redis.pid
# redis , 6379
port 6379
# redis IP , , ,
#
# 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
# , 。 ,
# 0
timeout 0
#
# Redis :debug、verbose、notice、warning, verbose
# debug ,
# varbose , debug
# notice verbose,
# warning
loglevel debug
# log
# stdout, , /dev/null
#logfile stdout
logfile /var/log/redis/redis.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# syslog-enabled no
# Specify the syslog identity.
# syslog-ident redis
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
#
# 16, 0, 0-(database-1)
databases 16
################################ #################################
#
# , :
#
# save
#
# , , rdb。
# ,
#
# ,
#
# save 900 1 900 1 key
# save 300 10 300 300 key
# save 60 10000 60 10000 key
save 900 1
save 300 10
save 60 10000
# ( rdb ) , yes
rdbcompression yes
# , dump.rdb
dbfilename dump.rdb
#
#
# 。
# redis , , ,
# , 。
#
# AOF
#
#
dir ./
################################# #################################
# . .
# slav , master IP , Redis , master
#
# slaveof
# master ( requirepass )
# slav 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
# PINGs. repl-ping-slave-period , 10
#
# repl-ping-slave-period 10
# repl-timeout ping , 60
# repl-timeout repl-ping-slave-period
# repl-timeout 60
################################## ###################################
# 。
# : redis , , 150K ,
#
# requirepass foobared
# .
#
# 。 CONFIG 。
#
# :
#
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# , "" , :
#
# rename-command CONFIG ""
################################### ####################################
# , ,Redis Redis ,
# maxclients 0, 。
# ,Redis max number of clients reached
#
# maxclients 128
# Redis ,Redis , ,Redis Key
# Redis list
#
# , , ,
#
# :Redis vm , Key ,Value swap
#
# maxmemory redis memcached , DB。
# Redis ,
# maxmemory
# Redis ?
#
# volatile-lru -> LRU key (LRU: Least Recently Used )
# allkeys-lru -> LRU key
# volatile-random -> key
# allkeys->random -> remove a random key, any key
# volatile-ttl -> key(minor TTL)
# noeviction -> ,
#
# : , key , Redis
#
# : 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 volatile-lru
# LRU minimal TTL , ( ), 。
# Redis 3 , maxmemory-samples
#
# maxmemory-samples 3
############################## AOF ###############################
# ,redis , , , 、 , 。
# redis 。
# append only ,redis appendonly.aof , redis , 。
# appendonly.aof , redis BGREWRITEAOF , appendonly.aof 。
# asynchronous dumps AOF
appendonly no
# AOF ( : "appendonly.aof")
# appendfilename appendonly.aof
# Redis AOF :
#
# no: , . Faster.
# always: always . Slow, Safest.
# everysec: , . Compromise.
#
# "everysec", 。
# Redis , "no",
# "always"
#
# "everysec".
# appendfsync always
appendfsync everysec
# appendfsync no
# AOF always everysec , ( AOF ) I/O
# Linux fsync() 。 , fsync
#
# , no-appendfsync-on-rewrite
#
# This means that while another child is saving the durability of Redis is
# the same as "appendfsync none", that in pratical terms means that it is
# possible to lost up to 30 seconds of log in the worst scenario (with the
# default Linux settings).
#
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
no-appendfsync-on-rewrite no
# Automatic rewrite of the append only file.
# AOF
# AOF Redis BGREWRITEAOF
#
# :Redis ( , )
#
# 。 ,
# AOF , AOF
# percentage 0
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
################################## SLOW LOG ###################################
# Redis Slow Log 。 I/O , ,
#
# slow log: Redis slowlog-log-slower-than( ),
# slow log 。
# , 1000000 。
# , 0
slowlog-log-slower-than 10000
# ,
# SLOWLOG RESET
slowlog-max-len 1024
################################ VM ###############################
### WARNING! Virtual Memory is deprecated in Redis 2.4
### The use of Virtual Memory is strongly discouraged.
# Virtual Memory allows Redis to work with datasets bigger than the actual
# amount of RAM needed to hold the whole dataset in memory.
# In order to do so very used keys are taken in memory while the other keys
# are swapped into a swap file, similarly to what operating systems do
# with memory pages.
#
# To enable VM just set 'vm-enabled' to yes, and set the following three
# VM parameters accordingly to your needs.
vm-enabled no
# vm-enabled yes
# This is the path of the Redis swap file. As you can guess, swap files
# can't be shared by different Redis instances, so make sure to use a swap
# file for every redis process you are running. Redis will complain if the
# swap file is already in use.
#
# The best kind of storage for the Redis swap file (that's accessed at random)
# is a Solid State Disk (SSD).
#
# *** WARNING *** if you are using a shared hosting the default of putting
# the swap file under /tmp is not secure. Create a dir with access granted
# only to Redis user and configure Redis to create the swap file there.
vm-swap-file /tmp/redis.swap
# vm-max-memory configures the VM to use at max the specified amount of
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
# is, if there is still enough contiguous space in the swap file.
#
# With vm-max-memory 0 the system will swap everything it can. Not a good
# default, just specify the max amount of RAM you can in bytes, but it's
# better to leave some margin. For instance specify an amount of RAM
# that's more or less between 60 and 80% of your free RAM.
vm-max-memory 0
# Redis swap files is split into pages. An object can be saved using multiple
# contiguous pages, but pages can't be shared between different objects.
# So if your page is too big, small objects swapped out on disk will waste
# a lot of space. If you page is too small, there is less space in the swap
# file (assuming you configured the same number of total swap file pages).
#
# If you use a lot of small objects, use a page size of 64 or 32 bytes.
# If you use a lot of big objects, use a bigger page size.
# If unsure, use the default :)
vm-page-size 32
# Number of total memory pages in the swap file.
# Given that the page table (a bitmap of free/used pages) is taken in memory,
# every 8 pages on disk will consume 1 byte of RAM.
#
# The total swap size is vm-page-size * vm-pages
#
# With the default of 32-bytes memory pages and 134217728 pages Redis will
# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
#
# It's better to use the smallest acceptable value 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