设为首页 收藏本站
查看: 430|回复: 0

[经验分享] redis.conf配置文件详细讲解(二)

[复制链接]

尚未签到

发表于 2018-11-4 11:00:35 | 显示全部楼层 |阅读模式
  4.      常用配置说明
  ####GENERAL #####################################[l1]
  # 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.[l2]
  daemonize no
  #If you run Redis from upstart or systemd, Redis can interact with your
  # supervision tree. Options:[l3]
  #   supervised no      - no supervision interaction[l4]
  #   supervised upstart - signal upstartby putting Redis into SIGSTOP mode[l5]
  #   supervised systemd - signal systemdby writing READY=1 to $NOTIFY_SOCKET[l6]
  #   supervised auto    - detect upstart or systemd method based on
  #                        UPSTART_JOB orNOTIFY_SOCKET environment variables[l7]
  #Note: these supervision methods only signal "process is ready."[l8]
  #       They do not enable continuous livenesspings back to your supervisor.[l9]
  supervised no
  #If a pid file is specified, Redis writes it where specified at startup
  # and removes it at exit.[l10]
  #
  # 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".[l11]
  #
  #Creating a pid file is best effort: if Redis is not able to create it
  # nothing bad happens, the server willstart and run normally.[l12]
  pidfile /var/run/redis_6379.pid
  # Specifythe server verbosity level.[l13]
  # 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)[l14]
  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[l15]
  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[l16]

  # Specifythe syslog>  # syslog-ident redis
  # Specifythe syslog facility. Must be USER or between LOCAL0-LOCAL7.[l18]
  # syslog-facility local0
  # Setthe number of databases. The default database is DB 0, you can select
  # a different one on a per-connectionbasis using SELECT  where
  # dbid is a number between 0 and'databases'-1[l19]
  databases 16
  5.      快照设置说明
  ###### SNAPSHOTTING[l20]   ################################
  #
  #Save the DB on disk:[l21]
  #
  #   save  [l22]
  #
  #   Will save the DB if both the given numberof seconds and the given
  #  number of write operations against the DB occurred.[l23]
  #
  #   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[l24]
  #
  #   Note: you can disable saving completely bycommenting out all "save" lines.[l25]
  #
  #   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 ""[l26]
  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.[l27]
  #
  # Ifthe background saving process will start working again Redis will
  # automatically allow writes again.[l28]
  #
  # 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.[l29]
  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.[l30]
  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.[l31]
  #
  #RDB files created with checksum disabled have a checksum of zero that will
  # tell the loading code to skip thecheck.[l32]
  rdbchecksum yes
  # Thefilename where to dump the DB[l33]
  dbfilename dump.rdb
  # Theworking directory.[l34]
  #
  # TheDB will be written inside this directory, with the filename specified
  # above using the 'dbfilename'configuration directive.[l35]
  #
  # TheAppend Only File will also be created inside this directory.[l36]
  #
  # Notethat you must specify a directory here, not a file name.[l37]
  dir ./
  6.      主从复制设置说明
  ######## REPLICATION[l38] #################################
  # Master-Slavereplication. Use slaveof to make a Redis instance a copy of
  # another Redis server. A few things tounderstand ASAP about Redis replication.[l39]
  #
  # 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.[l40]
  #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.[l41]
  #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.[l42]
  #
  #slaveof  [l43]
  #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.[l44]
  #
  # masterauth
  # Whena slave loses its connection with the master, or when the replication
  # is still in progress, the slave can actin two different ways:[l45]
  #
  # 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.[l46]
  #
  #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.[l47]
  #
  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.[l48]
  #
  #Since Redis 2.6 by default slaves are read-only[l49] .
  #
  # 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.[l50]
  slave-read-only yes
  #Replication SYNC strategy: disk or socket.[l51]
  #
  # -------------------------------------------------------
  #WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY[l52]
  # -------------------------------------------------------
  #
  # 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:[l53]
  #
  # 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.[l54]
  #2) Diskless: The Redis master creates a new process that directly writes the
  #             RDB file to slave sockets,without touching the disk at all.[l55]
  #
  # 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.[l56]
  #
  #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.[l57]
  #
  # Withslow disks and fast (large bandwidth) networks, diskless replication
  # works better.[l58]
  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[l59] .
  #
  # 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.[l60]
  #
  # 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.[l61]
  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.[l62]
  #
  # repl-ping-slave-period 10
  # Thefollowing option sets the replication timeout for:[l63]
  #
  # 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).[l64]
  #
  #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.[l65]
  #
  # repl-timeout 60
  # DisableTCP_NODELAY on the slave socket after SYNC?[l66]
  #
  #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.[l67]
  #
  # Ifyou select "no" the delay for data to appear on the slave side will
  # be reduced but more bandwidth will beused for replication.[l68]
  #
  #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.[l70]
  #
  # Thebigger the replication backlog, the longer the time the slave can be
  # disconnected and later be able toperform a partial resynchronization.[l71]
  #
  #The backlog is only allocated once there is at least a slave connected[l72] .
  #
  # 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.[l73]
  #

  # 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.[l75]
  #
  # 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.[l76]
  #
  # 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.[l77]
  #
  #By default the priority is 100.[l78]
  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.[l79]
  #
  # TheN slaves need to be in "online" state.[l80]
  #
  # Thelag in seconds, that must be

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-630578-1-1.html 上篇帖子: redis参数配置说明 下篇帖子: redis.conf配置文件详细讲解(三)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表