redisプロファイル
17036 ワード
# Redis configuration file example
################################## INCLUDES ###################################
# ( ) ,
# include /path/to/local.conf
# include /path/to/other.conf
################################ GENERAL #####################################
# ,no/yes
daemonize no
#pidfile ,redis pidfile, , redis server pidfile
pidfile /var/run/redis.pid
#
port 6379
# TCP listen() backlog.
# , , backlog,linux /proc/sys/net/core/somaxconn=128,
#backlog : 、
# , linux /proc/sys/net/core/somaxconn, 。
# /proc/sys/net/core/somaxconn :sysctl -w net.core.somaxconn=65535,sysctl -p
tcp-backlog 511
# Examples:
# ,redis server 。
# , IP IP。
# bind 192.168.1.100 10.0.0.1
# 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 700
# , 。 0
timeout 0
# TCP keepalive.
# 0, , SO_KEEPALIVE , , 60S。
tcp-keepalive 0
# Specify the server verbosity level.
# : degug >verbose>notic>warning
loglevel notice
#
logfile ""
# , select <dbid> , dibi 0 -1
databases 16
################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
#
# :save <seconds> <changes> , key ,
# 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
# ,redis ,redis , , redis ,
stop-writes-on-bgsave-error yes
#
rdbcompression yes
# rdb
rdbchecksum yes
#
dbfilename dump.rdb
#
dir ./
################################# REPLICATION #################################
# redis server redis server ,masterip IP,masterport
#
# slaveof <masterip> <masterport>
# redis
# masterauth <master-password>
# , :
# 1) slave-serve-stale-data yes( ) ,
# 2) slave-serve-stale-data no , INFO SLAVOF
# "SYNC with master in progress"
slave-serve-stale-data yes
#
slave-read-only yes
# PINGs, 10
# repl-ping-slave-period 10
# The following option sets the replication timeout for:
#
# ping , 60
# repl-timeout repl-ping-slave-period
# repl-timeout 60
# slave socket SYNC TCP_NODELAY
# “ yes ” ,Redis TCP slave ,
# slave , Linux kernel , 40 .
# "no" , slave , .
repl-disable-tcp-nodelay no
# , , ,
# repl_backlog redis buffer, Slave Master
# buffer 。repl_backlog redis NULL,
# Slave , buffer, 1024*1024( 1Mb)。
#repl_backlog_size buffer ( 1024*1024, 1Mb)。
# buffer , buffer buffer 。
#repl_backlog_idx ( buffer)。repl_backlog_off ,
# 。 Master Slave , repl_backlog , 1 。
#
# cach_master , repl_backlog , Slave Master ,
#maste repl_backlog , 。
# Slave ,Slave 。 ,Slave
#runid( ) reploff Master ,Master Slave
#repl_backlog , repl_backlog_off Slave reploff repl_backlog
# , Slave, 。 Slave 。
# repl-backlog-size 1mb
# repl_backlog Slave ()
# repl-backlog-ttl 3600
# master , slave ,
# slave master , 0 master 。
slave-priority 100
# N slave , <=M , master 。
# 3 slave , <=10 :
# min-slaves-to-write 0 ( ), min-slaves-max-lag 10
# min-slaves-to-write 3
# min-slaves-max-lag 10
################################## SECURITY ###################################
# 。
# : redis , ,
# 150K ,
# requirepass foobared
# .
# 。 CONFIG 。
# :
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# , "" , :
# rename-command CONFIG ""
################################### LIMITS ####################################
# , ,
#Redis Redis ,
# maxclients 0 , 。
# , Redis max number of clients reached
#
# maxclients 10000
# Redis , Redis , , Redis Key
# Redis , ”noeviction” , , SET, LPUSH 。
# : Redis vm , Key , Value swap
# LRU 。
# maxmemory redis memcached , DB 。
# Redis ,
# maxmemory <bytes>
# : ,Redis key。 :
#
# volatile-lru -> LRU 。
# allkeys-lru -> LRU key。
# volatile-random -> key。
# allkeys->random -> 。
# volatile-ttl -> ( TTL)
# noeviction -> , 。
#
# : , Redis key 。
# maxmemory-policy volatile-lru
# LRU TTL , ( ), 。
# : Redis key , 。
# maxmemory-samples 3
############################## APPEND ONLY MODE ###############################
# ,Redis 。 , Redis , 。
# : ,Redis appendonly.aof 。
# Redis 。
#
# , ( "save" , )。
# , Redis dump.rdb 。
#
# : BGREWRITEAOF , 。
appendonly no
# APPEND ONLY
appendfilename "appendonly.aof"
# fsync() , 。
# ; , 。
#
# Redis :
#
# no: , 。 。
# always: aof 。 , 。
# everysec: 。 。
#
# "everysec" 。
# , "no" ( , );
# , "always" 、 。
#
# , "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
aof-load-truncated yes
################################ LUA SCRIPTING ###############################
# Lua 5000 (5 ), 0 。
lua-time-limit 5000
################################## SLOW LOG ###################################
# Redis 。 I/O 。
# : , 。 ( )
#
# : , , 。
#
# , 1000000 1 。 , , 0 。
slowlog-log-slower-than 10000
# 。 , 。
slowlog-max-len 128
################################ LATENCY MONITOR ##############################
latency-monitor-threshold 0
############################# Event notification ##############################
# CPU , , 。
#notify-keyspace-events , :
#
#K , __keyspace@<db>__
#E , __keyevent@<db>__
#g DEL 、 EXPIRE 、 RENAME
#$
#l
#s
#h
#z
#x :
#e (evict) : maxmemory
#A g$lshzxe
# K E , , , 。
# , , Kl , 。
# "AKE" 。
notify-keyspace-events ""
############################### ADVANCED CONFIG ###############################
# Hashes are encoded using a memory efficient data structure when they have a
# small number of entries, and the biggest entry does not exceed a given
# threshold. These thresholds can be configured using the following directives.
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
# Similarly to hashes, small lists are also encoded in a special way in order
# to save a lot of space. The special representation is only used when
# you are under the following limits:
list-max-ziplist-entries 512
list-max-ziplist-value 64
# Sets have a special encoding in just one case: when a set is composed
# of just strings that happens to be integers in radix 10 in the range
# of 64 bit signed integers.
# The following configuration setting sets the limit in the size of the
# set in order to use this special memory saving encoding.
set-max-intset-entries 512
# Similarly to hashes and lists, sorted sets are also specially encoded in
# order to save a lot of space. This encoding is only used when the length and
# elements of a sorted set are below the following limits:
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
# HyperLogLog sparse representation bytes limit. The limit includes the
# 16 bytes header. When an HyperLogLog using the sparse representation crosses
# this limit, it is converted into the dense representation.
#
# A value greater than 16000 is totally useless, since at that point the
# dense representation is more memory efficient.
#
# The suggested value is ~ 3000 in order to have the benefits of
# the space efficient encoding without slowing down too much PFADD,
# which is O(N) with the sparse encoding. The value can be raised to
# ~ 10000 when CPU is not a concern, but space is, and the data set is
# composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
hll-sparse-max-bytes 3000
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
# order to help rehashing the main Redis hash table (the one mapping top-level
# keys to values). The hash table implementation Redis uses (see dict.c)
# performs a lazy rehashing: the more operation you run into a hash table
# that is rehashing, the more rehashing "steps" are performed, so if the
# server is idle the rehashing is never complete and some more memory is used
# by the hash table.
#
# The default is to use this millisecond 10 times every second in order to
# active rehashing the main dictionaries, freeing memory when possible.
#
# If unsure:
# use "activerehashing no" if you have hard latency requirements and it is
# not a good thing in your environment that Redis can reply form time to time
# to queries with 2 milliseconds delay.
#
# use "activerehashing yes" if you don't have such hard requirements but
# want to free memory asap when possible.
activerehashing yes
# The client output buffer limits can be used to force disconnection of clients
# that are not reading data from the server fast enough for some reason (a
# common reason is that a Pub/Sub client can't consume messages as fast as the
# publisher can produce them).
#
# The limit can be set differently for the three different classes of clients:
#
# normal -> normal clients including MONITOR clients
# slave -> slave clients
# pubsub -> clients subscribed to at least one pubsub channel or pattern
#
# The syntax of every client-output-buffer-limit directive is the following:
#
# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
#
# A client is immediately disconnected once the hard limit is reached, or if
# the soft limit is reached and remains reached for the specified number of
# seconds (continuously).
# So for instance if the hard limit is 32 megabytes and the soft limit is
# 16 megabytes / 10 seconds, the client will get disconnected immediately
# if the size of the output buffers reach 32 megabytes, but will also get
# disconnected if the client reaches 16 megabytes and continuously overcomes
# the limit for 10 seconds.
#
# By default normal clients are not limited because they don't receive data
# without asking (in a push way), but just after a request, so only
# asynchronous clients may create a scenario where data is requested faster
# than it can read.
#
# Instead there is a default limit for pubsub and slave clients, since
# subscribers and slaves receive data in a push fashion.
#
# Both the hard or the soft limit can be disabled by setting them to zero.
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Redis calls an internal function to perform many background tasks, like
# closing connections of clients in timeout, purging expired keys that are
# never requested, and so forth.
#
# Not all tasks are performed with the same frequency, but Redis checks for
# tasks to perform accordingly to the specified "hz" value.
#
# By default "hz" is set to 10. Raising the value will use more CPU when
# Redis is idle, but at the same time will make Redis more responsive when
# there are many keys expiring at the same time, and timeouts may be
# handled with more precision.
#
# The range is between 1 and 500, however a value over 100 is usually not
# a good idea. Most users should use the default of 10 and raise this up to
# 100 only in environments where very low latency is required.
hz 10
# When a child rewrites the AOF file, if the following option is enabled
# the file will be fsync-ed every 32 MB of data generated. This is useful
# in order to commit the file to the disk more incrementally and avoid
# big latency spikes.
aof-rewrite-incremental-fsync yes