redis.conf配置文件详细讲解(二)
4. 常用配置说明####GENERAL #####################################
# Bydefault Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid filein /var/run/redis.pid when daemonized.
daemonize no
#If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstartby putting Redis into SIGSTOP mode
# supervised systemd - signal systemdby writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB orNOTIFY_SOCKET environment variables
#Note: these supervision methods only signal "process is ready."
# They do not enable continuous livenesspings back to your supervisor.
supervised no
#If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
#
# Whenthe server runs non daemonized, no pid file is created if none is
# specified in the configuration. Whenthe server is daemonized, the pid file
# is used even if not specified,defaulting to "/var/run/redis.pid".
#
#Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server willstart and run normally.
pidfile /var/run/redis_6379.pid
# Specifythe server verbosity level.
# Thiscan be one of:
# debug (a lot of information, useful fordevelopment/testing)
# verbose (many rarely useful info, butnot a mess like the debug level)
# notice (moderately verbose, what youwant in production probably)
# warning (only very important / criticalmessages are logged)
loglevel notice
# Specifythe log file name. Also the empty string can be used to force
# Redis to log on the standard output.Note that if you use standard
# output for logging but daemonize, logswill be sent to /dev/null
logfile ""
# Toenable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslogparameters to suit your needs.
# syslog-enabled no
# Specifythe syslog> # syslog-ident redis
# Specifythe syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
# Setthe number of databases. The default database is DB 0, you can select
# a different one on a per-connectionbasis using SELECTwhere
# dbid is a number between 0 and'databases'-1
databases 16
5. 快照设置说明
###### SNAPSHOTTING ################################
#
#Save the DB on disk:
#
# save
#
# Will save the DB if both the given numberof seconds and the given
#number of write operations against the DB occurred.
#
# In the example below the behaviour will beto save:
#after 900 sec (15 min) if at least 1 key changed
#after 300 sec (5 min) if at least 10 keys changed
#after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving completely bycommenting out all "save" lines.
#
# It is also possible to remove all thepreviously configured save
#points by adding a save directive with a single empty string argument
#like in the following example:
#
#save ""
save 900 1
save 300 10
save 60 10000
# Bydefault Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and thelatest background save failed.
# This will make the user aware (in ahard way) that data is not persisting
# on disk properly, otherwise chances arethat no one will notice and some
# disaster will happen.
#
# Ifthe background saving process will start working again Redis will
# automatically allow writes again.
#
# Howeverif you have setup your proper monitoring of the Redis server
# and persistence, you may want todisable this feature so that Redis will
# continue to work as usual even if thereare problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes
#Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it'salmost always a win.
# If you want to save some CPU in thesaving child set it to 'no' but
# the dataset will likely be bigger ifyou have compressible values or keys.
rdbcompression yes
#Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant tocorruption but there is a performance
# hit to pay (around 10%) when saving andloading RDB files, so you can disable it
# for maximum performances.
#
#RDB files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip thecheck.
rdbchecksum yes
# Thefilename where to dump the DB
dbfilename dump.rdb
# Theworking directory.
#
# TheDB will be written inside this directory, with the filename specified
# above using the 'dbfilename'configuration directive.
#
# TheAppend Only File will also be created inside this directory.
#
# Notethat you must specify a directory here, not a file name.
dir ./
6. 主从复制设置说明
######## REPLICATION #################################
# Master-Slavereplication. Use slaveof to make a Redis instance a copy of
# another Redis server. A few things tounderstand ASAP about Redis replication.
#
# 1)Redis replication is asynchronous, but you can configure a master to
# stop accepting writes if it appears to be not connected with at least
# a given number of slaves.
#2) Redis slaves are able to perform a partial resynchronization with the
# master if the replication link is lost for a>
# time. You may want to configure the replication backlog> # sections of this file) with a sensible value depending on your needs.
#3) Replication is automatic and does not need user intervention. After a
# network partition slaves automatically try to reconnect to masters
# and resynchronize with them.
#
#slaveof
#If the master is password protected (using the "requirepass"configuration
# directive below) it is possible to tellthe slave to authenticate before
# starting the replicationsynchronization process, otherwise the master will
# refuse the slave request.
#
# masterauth
# Whena slave loses its connection with the master, or when the replication
# is still in progress, the slave can actin two different ways:
#
# 1)if slave-serve-stale-data is set to 'yes' (the default) the slave will
# still reply to client requests, possibly with out of date data, or the
# data set may just be empty if this is the first synchronization.
#
#2) if slave-serve-stale-data is set to 'no' the slave will reply with
# an error "SYNC with master in progress" to all the kind ofcommands
# but to INFO and SLAVEOF.
#
slave-serve-stale-data yes
# Youcan configure a slave instance to accept writes or not. Writing against
# a slave instance may be useful to storesome ephemeral data (because data
# written on a slave will be easilydeleted after resync with the master) but
# may also cause problems if clients arewriting to it because of a
# misconfiguration.
#
#Since Redis 2.6 by default slaves are read-only .
#
# Note:read only slaves are not designed to be exposed to untrusted clients
# on the internet. It's just a protectionlayer against misuse of the instance.
# Still a read only slave exports bydefault all the administrative commands
# such as CONFIG, DEBUG, and so forth. Toa limited extent you can improve
# security of read only slaves using'rename-command' to shadow all the
# administrative / dangerous commands.
slave-read-only yes
#Replication SYNC strategy: disk or socket.
#
# -------------------------------------------------------
#WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY
# -------------------------------------------------------
#
# Newslaves and reconnecting slaves that are not able to continue the replication
# process just receiving differences,need to do what is called a "full
# synchronization". An RDB file istransmitted from the master to the slaves.
# The transmission can happen in twodifferent ways:
#
# 1)Disk-backed: The Redis master creates a new process that writes the RDB
# file on disk. Later the fileis transferred by the parent
# process to the slavesincrementally.
#2) Diskless: The Redis master creates a new process that directly writes the
# RDB file to slave sockets,without touching the disk at all.
#
# Withdisk-backed replication, while the RDB file is generated, more slaves
# can be queued and served with the RDBfile as soon as the current child producing
# the RDB file finishes its work. Withdiskless replication instead once
# the transfer starts, new slavesarriving will be queued and a new transfer
# will start when the current oneterminates.
#
#When diskless replication is used, the master waits a configurable amount of
# time (in seconds) before starting thetransfer in the hope that multiple slaves
# will arrive and the transfer can beparallelized.
#
# Withslow disks and fast (large bandwidth) networks, diskless replication
# works better.
repl-diskless-sync no
# Whendiskless replication is enabled, it is possible to configure the delay
# the server waits in order to spawn thechild that transfers the RDB via socket
# to the slaves .
#
# Thisis important since once the transfer starts, it is not possible to serve
# new slaves arriving, that will bequeued for the next RDB transfer, so the server
# waits a delay in order to let moreslaves arrive.
#
# Thedelay is specified in seconds, and by default is 5 seconds. To disable
# it entirely just set it to 0 secondsand the transfer will start ASAP.
repl-diskless-sync-delay 5
# Slavessend PINGs to server in a predefined interval. It's possible to change
# this interval with the repl_ping_slave_periodoption. The default value is 10
# seconds.
#
# repl-ping-slave-period 10
# Thefollowing option sets the replication timeout for:
#
# 1)Bulk transfer I/O during SYNC, from the point of view of slave.
# 2) Master timeout from the point ofview of slaves (data, pings).
# 3) Slave timeout from the point of viewof masters (REPLCONF ACK pings).
#
#It is important to make sure that this value is greater than the value
# specified for repl-ping-slave-periodotherwise a timeout will be detected
# every time there is low traffic betweenthe master and the slave.
#
# repl-timeout 60
# DisableTCP_NODELAY on the slave socket after SYNC?
#
#If you select "yes" Redis will use a smaller number of TCP packetsand
# less bandwidth to send data to slaves.But this can add a delay for
# the data to appear on the slave side,up to 40 milliseconds with
# Linux kernels using a defaultconfiguration.
#
# Ifyou select "no" the delay for data to appear on the slave side will
# be reduced but more bandwidth will beused for replication.
#
#By default we optimize for low latency, but in very high traffic conditions
# or when the master and slaves are manyhops away, turning this to "yes" may
# be a good> repl-disable-tcp-nodelay no
#Set the replication backlog> # slave data when slaves are disconnectedfor some time, so that when a slave
# wants to reconnect again, often a fullresync is not needed, but a partial
# resync is enough, just passing theportion of data the slave missed while
# disconnected.
#
# Thebigger the replication backlog, the longer the time the slave can be
# disconnected and later be able toperform a partial resynchronization.
#
#The backlog is only allocated once there is at least a slave connected .
#
# repl-backlog-size 1mb
# Aftera master has no longer connected slaves for some time, the backlog
# will be freed. The following optionconfigures the amount of seconds that
# need to elapse, starting from the timethe last slave disconnected, for
# the backlog buffer to be freed.
#
# Avalue of 0 means to never> #
# repl-backlog-ttl 3600
# Theslave priority is an integer number published by Redis in the INFO output.
# It is used by Redis Sentinel in orderto select a slave to promote into a
# master if the master is no longerworking correctly.
#
# Aslave with a low priority number is considered better for promotion, so
# for instance if there are three slaveswith priority 10, 100, 25 Sentinel will
# pick the one with priority 10, that isthe lowest.
#
# Howevera special priority of 0 marks the slave as not able to perform the
# role of master, so a slave withpriority of 0 will never be selected by
# Redis Sentinel for promotion.
#
#By default the priority is 100.
slave-priority 100
# Itis possible for a master to stop accepting writes if there are less than
# N slaves connected, having a lag lessor equal than M seconds.
#
# TheN slaves need to be in "online" state.
#
# Thelag in seconds, that must be
页:
[1]