zoukankan      html  css  js  c++  java
  • Redis配置文件大解读

       1 # 1k => 1000 bytes
       2 # 1kb => 1024 bytes
       3 # 1m => 1000000 bytes
       4 # 1mb => 1024*1024 bytes
       5 # 1g => 1000000000 bytes
       6 # 1gb => 1024*1024*1024 bytes
       7 #
       8 # units are case insensitive so 1GB 1Gb 1gB are all the same.
       9 # 1.units单位: 配置大小单位 开头定义一些基本的度量单位 只支持bytes 不支持bit
      10 # 2.对大小写不敏感
      11 
      12 ################################## INCLUDES ###################################
      13 
      14 # Include one or more other config files here.  This is useful if you
      15 # have a standard template that goes to all Redis servers but also need
      16 # to customize a few per-server settings.  Include files can include
      17 # other files, so use this wisely.
      18 #
      19 # Notice option "include" won't be rewritten by command "CONFIG REWRITE"
      20 # from admin or Redis Sentinel. Since Redis always uses the last processed
      21 # line as value of a configuration directive, you'd better put includes
      22 # at the beginning of this file to avoid overwriting config change at runtime.
      23 #
      24 # If instead you are interested in using includes to override configuration
      25 # options, it is better to use include as the last line.
      26 #
      27 # include /path/to/local.conf
      28 # include /path/to/other.conf
      29 # 可以通过includes包含 redis.conf可以作为总闸,包含其他
      30 
      31 ################################## NETWORK #####################################
      32 
      33 # By default, if no "bind" configuration directive is specified, Redis listens
      34 # for connections from all the network interfaces available on the server.
      35 # It is possible to listen to just one or multiple selected interfaces using
      36 # the "bind" configuration directive, followed by one or more IP addresses.
      37 #
      38 # Examples:
      39 #
      40 # bind 192.168.1.100 10.0.0.1
      41 # bind 127.0.0.1 ::1
      42 #
      43 # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
      44 # internet, binding to all the interfaces is dangerous and will expose the
      45 # instance to everybody on the internet. So by default we uncomment the
      46 # following bind directive, that will force Redis to listen only into
      47 # the IPv4 lookback interface address (this means Redis will be able to
      48 # accept connections only from clients running into the same computer it
      49 # is running).
      50 #
      51 # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
      52 # JUST COMMENT THE FOLLOWING LINE.
      53 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      54 # 绑定端口啊网卡设备
      55 bind 127.0.0.1
      56 
      57 # Protected mode is a layer of security protection, in order to avoid that
      58 # Redis instances left open on the internet are accessed and exploited.
      59 #
      60 # When protected mode is on and if:
      61 #
      62 # 1) The server is not binding explicitly to a set of addresses using the
      63 #    "bind" directive.
      64 # 2) No password is configured.
      65 #
      66 # The server only accepts connections from clients connecting from the
      67 # IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
      68 # sockets.
      69 #
      70 # By default protected mode is enabled. You should disable it only if
      71 # you are sure you want clients from other hosts to connect to Redis
      72 # even if no authentication is configured, nor a specific set of interfaces
      73 # are explicitly listed using the "bind" directive.
      74 protected-mode yes
      75 
      76 # Accept connections on the specified port, default is 6379 (IANA #815344).
      77 # If port 0 is specified Redis will not listen on a TCP socket.
      78 port 6379
      79 
      80 # TCP listen() backlog.
      81 #
      82 # In high requests-per-second environments you need an high backlog in order
      83 # to avoid slow clients connections issues. Note that the Linux kernel
      84 # will silently truncate it to the value of /proc/sys/net/core/somaxconn so
      85 # make sure to raise both the value of somaxconn and tcp_max_syn_backlog
      86 # in order to get the desired effect.
      87 # 设置tcp的backlog,backlog是一个连接队列,backlog队列总和 = 未完成三次握手队列+已经完成三次握手队列
      88 tcp-backlog 511
      89 
      90 # Unix socket.
      91 #
      92 # Specify the path for the Unix socket that will be used to listen for
      93 # incoming connections. There is no default, so Redis will not listen
      94 # on a unix socket when not specified.
      95 # 配置unix socket来让redis支持监听本地连接
      96 # unixsocket /tmp/redis.sock
      97 # 配置unix socket使用文件的权限
      98 # unixsocketperm 700
      99 
     100 # Close the connection after a client is idle for N seconds (0 to disable)
     101 # 关闭连接 0代表不关闭disable
     102 timeout 0
     103 
     104 # TCP keepalive.
     105 #
     106 # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
     107 # of communication. This is useful for two reasons:
     108 #
     109 # 1) Detect dead peers.
     110 # 2) Take the connection alive from the point of view of network
     111 #    equipment in the middle.
     112 #
     113 # On Linux, the specified value (in seconds) is the period used to send ACKs.
     114 # Note that to close the connection the double of the time is needed.
     115 # On other kernels the period depends on the kernel configuration.
     116 #
     117 # A reasonable value for this option is 300 seconds, which is the new
     118 # Redis default starting with Redis 3.2.1.
     119 # 单位为s 如果设置为0 则不会进行tcp-keepalive检测
     120 tcp-keepalive 300
     121 
     122 ################################# GENERAL #####################################
     123 
     124 # By default Redis does not run as a daemon. Use 'yes' if you need it.
     125 # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
     126 daemonize yes  # 默认是no 修改成yes就会启动的时候产生一个pid文件,也就是说启用守护进程
     127 pidfile /var/run/redis.pid 
     128 
     129 # If you run Redis from upstart or systemd, Redis can interact with your
     130 # supervision tree. Options:
     131 # 没有监督互动
     132 #   supervised no      - no supervision interaction
     133 # 通过redis置于SIGSTOP模式来启动信号
     134 #   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
     135 # signal systemd将READY = 1写入$ NOTIFY_SOCKET
     136 #   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
     137 # 检测upstart或systemd方法基于 UPSTART_JOB或NOTIFY_SOCKET环境变量
     138 #   supervised auto    - detect upstart or systemd method based on
     139 #                        UPSTART_JOB or NOTIFY_SOCKET environment variables
     140 # Note: these supervision methods only signal "process is ready."
     141 #       They do not enable continuous liveness pings back to your supervisor.
     142 supervised no
     143 
     144 # If a pid file is specified, Redis writes it where specified at startup
     145 # and removes it at exit.
     146 #
     147 # When the server runs non daemonized, no pid file is created if none is
     148 # specified in the configuration. When the server is daemonized, the pid file
     149 # is used even if not specified, defaulting to "/var/run/redis.pid".
     150 #
     151 # Creating a pid file is best effort: if Redis is not able to create it
     152 # nothing bad happens, the server will start and run normally.
     153 # 配置PID文件路径
     154 pidfile /var/run/redis_6379.pid
     155 
     156 # Specify the server verbosity level.
     157 # This can be one of:
     158 # debug (a lot of information, useful for development/testing)
     159 # verbose (many rarely useful info, but not a mess like the debug level)
     160 # notice (moderately verbose, what you want in production probably)
     161 # warning (only very important / critical messages are logged)
     162 # 4个日志级别 级别越来越高 Python模块logging
     163 loglevel notice
     164 
     165 # Specify the log file name. Also the empty string can be used to force
     166 # Redis to log on the standard output. Note that if you use standard
     167 # output for logging but daemonize, logs will be sent to /dev/null
     168 logfile /var/log/redis/redis.log
     169 
     170 # To enable logging to the system logger, just set 'syslog-enabled' to yes,
     171 # and optionally update the other syslog parameters to suit your needs.
     172 # syslog-enabled no # 系统日志是否日志输出到syslog中
     173 
     174 # Specify the syslog identity.
     175 # syslog-ident redis # 指定syslog里的日志标志,开了之后redis开头
     176 
     177 # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
     178 # syslog-facility local0 # 输出设备默认0-7
     179 
     180 # Set the number of databases. The default database is DB 0, you can select
     181 # a different one on a per-connection basis using SELECT <dbid> where
     182 # dbid is a number between 0 and 'databases'-1
     183 # 默认16库
     184 databases 16
     185 
     186 ################################ SNAPSHOTTING  ################################
     187 #快照内存中的数据保存到disk中
     188 # Save the DB on disk:
     189 #
     190 #   save <seconds> <changes>
     191 #
     192 #   Will save the DB if both the given number of seconds and the given
     193 #   number of write operations against the DB occurred.
     194 #
     195 #   In the example below the behaviour will be to save:
     196 #   after 900 sec (15 min) if at least 1 key changed
     197 #   after 300 sec (5 min) if at least 10 keys changed
     198 #   after 60 sec if at least 10000 keys changed
     199 #
     200 #   Note: you can disable saving completely by commenting out all "save" lines.
     201 #
     202 #   It is also possible to remove all the previously configured save
     203 #   points by adding a save directive with a single empty string argument
     204 #   like in the following example:
     205 #
     206 #   save ""
     207 
     208 save 900 1 # 900秒以内修改一次
     209 save 300 10 # 300秒以内修改十次
     210 save 60 10000 # 60秒以内修改10000次
     211 
     212 # By default Redis will stop accepting writes if RDB snapshots are enabled
     213 # (at least one save point) and the latest background save failed.
     214 # This will make the user aware (in a hard way) that data is not persisting
     215 # on disk properly, otherwise chances are that no one will notice and some
     216 # disaster will happen.
     217 #
     218 # If the background saving process will start working again Redis will
     219 # automatically allow writes again.
     220 #
     221 # However if you have setup your proper monitoring of the Redis server
     222 # and persistence, you may want to disable this feature so that Redis will
     223 # continue to work as usual even if there are problems with disk,
     224 # permissions, and so forth.
     225 # 数据一致性 如果后台出了错,在写的时候就停止掉
     226 stop-writes-on-bgsave-error yes
     227 
     228 # Compress string objects using LZF when dump .rdb databases?
     229 # For default that's set to 'yes' as it's almost always a win.
     230 # If you want to save some CPU in the saving child set it to 'no' but
     231 # the dataset will likely be bigger if you have compressible values or keys.
     232 # 是否进行压缩存储 LZF算法进行压缩
     233 rdbcompression yes
     234 
     235 # Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
     236 # This makes the format more resistant to corruption but there is a performance
     237 # hit to pay (around 10%) when saving and loading RDB files, so you can disable it
     238 # for maximum performances.
     239 #
     240 # RDB files created with checksum disabled have a checksum of zero that will
     241 # tell the loading code to skip the check.
     242 # CRC64算法进行数据校验 要增加10%的消耗
     243 rdbchecksum yes
     244 
     245 # The filename where to dump the DB
     246 # 备份存数据的文件
     247 dbfilename dump.rdb
     248 
     249 # The working directory.
     250 #
     251 # The DB will be written inside this directory, with the filename specified
     252 # above using the 'dbfilename' configuration directive.
     253 #
     254 # The Append Only File will also be created inside this directory.
     255 #
     256 # Note that you must specify a directory here, not a file name.
     257 # 指定本地数据库存放目录
     258 dir /var/lib/redis
     259 
     260 ################################# REPLICATION #################################
     261 
     262 # Master-Slave replication. Use slaveof to make a Redis instance a copy of
     263 # another Redis server. A few things to understand ASAP about Redis replication.
     264 #
     265 # 1) Redis replication is asynchronous, but you can configure a master to
     266 #    stop accepting writes if it appears to be not connected with at least
     267 #    a given number of slaves.
     268 # 2) Redis slaves are able to perform a partial resynchronization with the
     269 #    master if the replication link is lost for a relatively small amount of
     270 #    time. You may want to configure the replication backlog size (see the next
     271 #    sections of this file) with a sensible value depending on your needs.
     272 # 3) Replication is automatic and does not need user intervention. After a
     273 #    network partition slaves automatically try to reconnect to masters
     274 #    and resynchronize with them.
     275 # 设置某台机器的从服务器
     276 # slaveof <masterip> <masterport>
     277 
     278 # If the master is password protected (using the "requirepass" configuration
     279 # directive below) it is possible to tell the slave to authenticate before
     280 # starting the replication synchronization process, otherwise the master will
     281 # refuse the slave request.
     282 # 连接主服务器的密码
     283 # masterauth <master-password>
     284 
     285 # When a slave loses its connection with the master, or when the replication
     286 # is still in progress, the slave can act in two different ways:
     287 #     slave会继续响应客户端请求,可能是正常数据,也可能是还没获得值的空数据。
     288 # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
     289 #    still reply to client requests, possibly with out of date data, or the
     290 #    data set may just be empty if this is the first synchronization.
     291 #    slave会回复"正在从master同步(SYNC with master in progress)"来处理各种请求,除了 INFO 和 SLAVEOF 命令。
     292 # 2) if slave-serve-stale-data is set to 'no' the slave will reply with
     293 #    an error "SYNC with master in progress" to all the kind of commands
     294 #    but to INFO and SLAVEOF.
     295 # 当主从断开或者正在复制中,从服务器是否应答
     296 slave-serve-stale-data yes
     297 
     298 # You can configure a slave instance to accept writes or not. Writing against
     299 # a slave instance may be useful to store some ephemeral data (because data
     300 # written on a slave will be easily deleted after resync with the master) but
     301 # may also cause problems if clients are writing to it because of a
     302 # misconfiguration.
     303 #
     304 # Since Redis 2.6 by default slaves are read-only.
     305 #
     306 # Note: read only slaves are not designed to be exposed to untrusted clients
     307 # on the internet. It's just a protection layer against misuse of the instance.
     308 # Still a read only slave exports by default all the administrative commands
     309 # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
     310 # security of read only slaves using 'rename-command' to shadow all the
     311 # administrative / dangerous commands.
     312 # 从服务器只读
     313 slave-read-only yes
     314 
     315 # Replication SYNC strategy: disk or socket.
     316 #
     317 # -------------------------------------------------------
     318 # WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY
     319 # -------------------------------------------------------
     320 #
     321 # New slaves and reconnecting slaves that are not able to continue the replication
     322 # process just receiving differences, need to do what is called a "full
     323 # synchronization". An RDB file is transmitted from the master to the slaves.
     324 # The transmission can happen in two different ways:
     325 #
     326 # 1) Disk-backed: The Redis master creates a new process that writes the RDB
     327 #                 file on disk. Later the file is transferred by the parent
     328 #                 process to the slaves incrementally.
     329 # 2) Diskless: The Redis master creates a new process that directly writes the
     330 #              RDB file to slave sockets, without touching the disk at all.
     331 #
     332 # With disk-backed replication, while the RDB file is generated, more slaves
     333 # can be queued and served with the RDB file as soon as the current child producing
     334 # the RDB file finishes its work. With diskless replication instead once
     335 # the transfer starts, new slaves arriving will be queued and a new transfer
     336 # will start when the current one terminates.
     337 #
     338 # When diskless replication is used, the master waits a configurable amount of
     339 # time (in seconds) before starting the transfer in the hope that multiple slaves
     340 # will arrive and the transfer can be parallelized.
     341 #
     342 # With slow disks and fast (large bandwidth) networks, diskless replication
     343 # works better.
     344 # 同步策略: 磁盘或socket,默认磁盘方式
     345 repl-diskless-sync no
     346 
     347 # When diskless replication is enabled, it is possible to configure the delay
     348 # the server waits in order to spawn the child that transfers the RDB via socket
     349 # to the slaves.
     350 #
     351 # This is important since once the transfer starts, it is not possible to serve
     352 # new slaves arriving, that will be queued for the next RDB transfer, so the server
     353 # waits a delay in order to let more slaves arrive.
     354 #
     355 # The delay is specified in seconds, and by default is 5 seconds. To disable
     356 # it entirely just set it to 0 seconds and the transfer will start ASAP.
     357 # 默认值为5秒,设置为0秒则每次传输无延迟。
     358 repl-diskless-sync-delay 5
     359 
     360 # Slaves send PINGs to server in a predefined interval. It's possible to change
     361 # this interval with the repl_ping_slave_period option. The default value is 10
     362 # seconds.
     363 # 从ping主的时间间隔10秒
     364 # repl-ping-slave-period 10
     365 
     366 # The following option sets the replication timeout for:
     367 # slave在与master SYNC期间有大量数据传输,造成超时
     368 # 在slave角度,master超时,包括数据、ping等
     369 # 1) Bulk transfer I/O during SYNC, from the point of view of slave.
     370 # 在master角度,slave超时,当master发送REPLCONF ACK pings
     371 # 2) Master timeout from the point of view of slaves (data, pings).
     372 # 3) Slave timeout from the point of view of masters (REPLCONF ACK pings).
     373 # 确保这个值大于指定的repl-ping-slave-period,否则在主从间流量不高时每次都会检测到超时
     374 # It is important to make sure that this value is greater than the value
     375 # specified for repl-ping-slave-period otherwise a timeout will be detected
     376 # every time there is low traffic between the master and the slave.
     377 # 同步主从超时时间(超时认为断线)
     378 # repl-timeout 60
     379 
     380 # Disable TCP_NODELAY on the slave socket after SYNC?
     381 #
     382 # If you select "yes" Redis will use a smaller number of TCP packets and
     383 # less bandwidth to send data to slaves. But this can add a delay for
     384 # the data to appear on the slave side, up to 40 milliseconds with
     385 # Linux kernels using a default configuration.
     386 #
     387 # If you select "no" the delay for data to appear on the slave side will
     388 # be reduced but more bandwidth will be used for replication.
     389 #
     390 # By default we optimize for low latency, but in very high traffic conditions
     391 # or when the master and slaves are many hops away, turning this to "yes" may
     392 # be a good idea.
     393 # master是否合并数据,高流量发送给slave
     394 repl-disable-tcp-nodelay no
     395 
     396 # Set the replication backlog size. The backlog is a buffer that accumulates
     397 # slave data when slaves are disconnected for some time, so that when a slave
     398 # wants to reconnect again, often a full resync is not needed, but a partial
     399 # resync is enough, just passing the portion of data the slave missed while
     400 # disconnected.
     401 #
     402 # The bigger the replication backlog, the longer the time the slave can be
     403 # disconnected and later be able to perform a partial resynchronization.
     404 #
     405 # The backlog is only allocated once there is at least a slave connected.
     406 # 设置数据备份的backlog大小
     407 # repl-backlog-size 1mb
     408 
     409 # After a master has no longer connected slaves for some time, the backlog
     410 # will be freed. The following option configures the amount of seconds that
     411 # need to elapse, starting from the time the last slave disconnected, for
     412 # the backlog buffer to be freed.
     413 #
     414 # A value of 0 means to never release the backlog.
     415 # 从最后一个slave断开开始计时多少秒后,backlog缓冲将会释放。
     416 # repl-backlog-ttl 3600
     417 
     418 # The slave priority is an integer number published by Redis in the INFO output.
     419 # It is used by Redis Sentinel in order to select a slave to promote into a
     420 # master if the master is no longer working correctly.
     421 #
     422 # A slave with a low priority number is considered better for promotion, so
     423 # for instance if there are three slaves with priority 10, 100, 25 Sentinel will
     424 # pick the one with priority 10, that is the lowest.
     425 #
     426 # However a special priority of 0 marks the slave as not able to perform the
     427 # role of master, so a slave with priority of 0 will never be selected by
     428 # Redis Sentinel for promotion.
     429 #
     430 # By default the priority is 100.
     431 # 从服务器的优先级
     432 slave-priority 100
     433 
     434 # It is possible for a master to stop accepting writes if there are less than
     435 # N slaves connected, having a lag less or equal than M seconds.
     436 #
     437 # The N slaves need to be in "online" state.
     438 #
     439 # The lag in seconds, that must be <= the specified value, is calculated from
     440 # the last ping received from the slave, that is usually sent every second.
     441 #
     442 # This option does not GUARANTEE that N replicas will accept the write, but
     443 # will limit the window of exposure for lost writes in case not enough slaves
     444 # are available, to the specified number of seconds.
     445 #
     446 # For example to require at least 3 slaves with a lag <= 10 seconds use:
     447 # 至少需要3个延时小于等于10秒
     448 # min-slaves-to-write 3
     449 # min-slaves-max-lag 10
     450 #
     451 # Setting one or the other to 0 disables the feature.
     452 #
     453 # By default min-slaves-to-write is set to 0 (feature disabled) and
     454 # min-slaves-max-lag is set to 10.
     455 
     456 # A Redis master is able to list the address and port of the attached
     457 # slaves in different ways. For example the "INFO replication" section
     458 # offers this information, which is used, among other tools, by
     459 # Redis Sentinel in order to discover slave instances.
     460 # Another place where this info is available is in the output of the
     461 # "ROLE" command of a masteer.
     462 #
     463 # The listed IP and address normally reported by a slave is obtained
     464 # in the following way:
     465 #
     466 #   IP: The address is auto detected by checking the peer address
     467 #   of the socket used by the slave to connect with the master.
     468 #
     469 #   Port: The port is communicated by the slave during the replication
     470 #   handshake, and is normally the port that the slave is using to
     471 #   list for connections.
     472 #
     473 # However when port forwarding or Network Address Translation (NAT) is
     474 # used, the slave may be actually reachable via different IP and port
     475 # pairs. The following two options can be used by a slave in order to
     476 # report to its master a specific set of IP and port, so that both INFO
     477 # and ROLE will report those values.
     478 #
     479 # There is no need to use both the options if you need to override just
     480 # the port or the IP address.
     481 #
     482 # slave-announce-ip 5.5.5.5
     483 # slave-announce-port 1234
     484 
     485 ################################## SECURITY ###################################
     486 # 安全配置
     487 # 默认密码为空 命令 config get requirepass
     488 # 设置密码 命令 config set requirepass "123456"  # 当然也可以直接修改配置文件 这时候在终端auth认证命令 auth 123456就可以操作了
     489 # 得到在哪个路径下启动的有时候配置就生成这个路径下 命令config get dir
     490 # Require clients to issue AUTH <PASSWORD> before processing any other
     491 # commands.  This might be useful in environments in which you do not trust
     492 # others with access to the host running redis-server.
     493 #
     494 # This should stay commented out for backward compatibility and because most
     495 # people do not need auth (e.g. they run their own servers).
     496 #
     497 # Warning: since Redis is pretty fast an outside user can try up to
     498 # 150k passwords per second against a good box. This means that you should
     499 # use a very strong password otherwise it will be very easy to break.
     500 #
     501 # requirepass foobared
     502 
     503 # Command renaming.
     504 #
     505 # It is possible to change the name of dangerous commands in a shared
     506 # environment. For instance the CONFIG command may be renamed into something
     507 # hard to guess so that it will still be available for internal-use tools
     508 # but not available for general clients.
     509 #
     510 # Example:
     511 #  
     512 # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
     513 #
     514 # It is also possible to completely kill a command by renaming it into
     515 # an empty string:
     516 #  设置命令为空时禁用命令
     517 # rename-command CONFIG ""
     518 #
     519 # Please note that changing the name of commands that are logged into the
     520 # AOF file or transmitted to slaves may cause problems.
     521 
     522 ################################### LIMITS ####################################
     523 # 限制
     524 # Set the max number of connected clients at the same time. By default
     525 # this limit is set to 10000 clients, however if the Redis server is not
     526 # able to configure the process file limit to allow for the specified limit
     527 # the max number of allowed clients is set to the current file limit
     528 # minus 32 (as Redis reserves a few file descriptors for internal uses).
     529 #
     530 # Once the limit is reached Redis will close all the new connections sending
     531 # an error 'max number of clients reached'.
     532 # 最大连接数
     533 # maxclients 10000
     534 
     535 # Don't use more memory than the specified amount of bytes.
     536 # When the memory limit is reached Redis will try to remove keys
     537 # according to the eviction policy selected (see maxmemory-policy).
     538 #
     539 # If Redis can't remove keys according to the policy, or if the policy is
     540 # set to 'noeviction', Redis will start to reply with errors to commands
     541 # that would use more memory, like SET, LPUSH, and so on, and will continue
     542 # to reply to read-only commands like GET.
     543 #
     544 # This option is usually useful when using Redis as an LRU cache, or to set
     545 # a hard memory limit for an instance (using the 'noeviction' policy).
     546 #
     547 # WARNING: If you have slaves attached to an instance with maxmemory on,
     548 # the size of the output buffers needed to feed the slaves are subtracted
     549 # from the used memory count, so that network problems / resyncs will
     550 # not trigger a loop where keys are evicted, and in turn the output
     551 # buffer of slaves is full with DELs of keys evicted triggering the deletion
     552 # of more keys, and so forth until the database is completely emptied.
     553 #
     554 # In short... if you have slaves attached it is suggested that you set a lower
     555 # limit for maxmemory so that there is some free RAM on the system for slave
     556 # output buffers (but this is not needed if the policy is 'noeviction').
     557 # 最大内存
     558 # maxmemory <bytes>
     559 
     560 # 缓存过期策略
     561 # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
     562 # is reached. You can select among five behaviors:
     563 # 移除key z只对设置了过期时间的键
     564 # volatile-lru -> remove the key with an expire set using an LRU algorithm
     565 # 移除key 最近最少使用
     566 # allkeys-lru -> remove any key according to the LRU algorithm
     567 # 在过期集合中移除随机key,只对设置了过期时间的键
     568 # volatile-random -> remove a random key with an expire set
     569 # 移除随机的key
     570 # allkeys-random -> remove a random key, any key
     571 # 移除ttl值最小的key就是最近要过期的key
     572 # volatile-ttl -> remove the key with the nearest expire time (minor TTL)
     573 # 永不过期不移除,针对写操作 只是返回错误信息
     574 # noeviction -> don't expire at all, just return an error on write operations
     575 #
     576 # Note: with any of the above policies, Redis will return an error on write
     577 #       operations, when there are no suitable keys for eviction.
     578 #
     579 #       At the date of writing these commands are: set setnx setex append
     580 #       incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
     581 #       sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
     582 #       zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
     583 #       getset mset msetnx exec sort
     584 #
     585 # The default is:
     586 # 永不过期
     587 # maxmemory-policy noeviction
     588 
     589 # LRU and minimal TTL algorithms are not precise algorithms but approximated
     590 # algorithms (in order to save memory), so you can tune it for speed or
     591 # accuracy. For default Redis will check five keys and pick the one that was
     592 # used less recently, you can change the sample size using the following
     593 # configuration directive.
     594 #
     595 # The default of 5 produces good enough results. 10 Approximates very closely
     596 # true LRU but costs a bit more CPU. 3 is very fast but not very accurate.
     597 # 设置LRU和最小TTL算法选取最大样本个数是5
     598 # maxmemory-samples 5
     599 
     600 ############################## APPEND ONLY MODE ###############################
     601 
     602 # By default Redis asynchronously dumps the dataset on disk. This mode is
     603 # good enough in many applications, but an issue with the Redis process or
     604 # a power outage may result into a few minutes of writes lost (depending on
     605 # the configured save points).
     606 #
     607 # The Append Only File is an alternative persistence mode that provides
     608 # much better durability. For instance using the default data fsync policy
     609 # (see later in the config file) Redis can lose just one second of writes in a
     610 # dramatic event like a server power outage, or a single write if something
     611 # wrong with the Redis process itself happens, but the operating system is
     612 # still running correctly.
     613 #
     614 # AOF and RDB persistence can be enabled at the same time without problems.
     615 # If the AOF is enabled on startup Redis will load the AOF, that is the file
     616 # with the better durability guarantees.
     617 #
     618 # Please check http://redis.io/topics/persistence for more information.
     619 # 默认是关闭 yes就是打开AOF持久化
     620 appendonly no
     621 
     622 # The name of the append only file (default: "appendonly.aof")
     623 # 文件名字
     624 appendfilename "appendonly.aof"
     625 
     626 # The fsync() call tells the Operating System to actually write data on disk
     627 # instead of waiting for more data in the output buffer. Some OS will really flush
     628 # data on disk, some other OS will just try to do it ASAP.
     629 # 策略方式
     630 # Redis supports three different modes:
     631 # 不开启aof持久化
     632 # no: don't fsync, just let the OS flush the data when it wants. Faster.
     633 # 总是被记录到磁盘 没操作一步就要记录 性能差但是数据完整性好
     634 # always: fsync after every write to the append only log. Slow, Safest.
     635 # 异步操作 每秒记录 如果有宕机 有数据丢失
     636 # everysec: fsync only one time every second. Compromise.
     637 #
     638 # The default is "everysec", as that's usually the right compromise between
     639 # speed and data safety. It's up to you to understand if you can relax this to
     640 # "no" that will let the operating system flush the output buffer when
     641 # it wants, for better performances (but if you can live with the idea of
     642 # some data loss consider the default persistence mode that's snapshotting),
     643 # or on the contrary, use "always" that's very slow but a bit safer than
     644 # everysec.
     645 #
     646 # More details please check the following article:
     647 # http://antirez.com/post/redis-persistence-demystified.html
     648 #
     649 # If unsure, use "everysec".
     650 
     651 # appendfsync always
     652 appendfsync everysec
     653 # appendfsync no
     654 
     655 # When the AOF fsync policy is set to always or everysec, and a background
     656 # saving process (a background save or AOF log background rewriting) is
     657 # performing a lot of I/O against the disk, in some Linux configurations
     658 # Redis may block too long on the fsync() call. Note that there is no fix for
     659 # this currently, as even performing fsync in a different thread will block
     660 # our synchronous write(2) call.
     661 #
     662 # In order to mitigate this problem it's possible to use the following option
     663 # that will prevent fsync() from being called in the main process while a
     664 # BGSAVE or BGREWRITEAOF is in progress.
     665 #
     666 # This means that while another child is saving, the durability of Redis is
     667 # the same as "appendfsync none". In practical terms, this means that it is
     668 # possible to lose up to 30 seconds of log in the worst scenario (with the
     669 # default Linux settings).
     670 #
     671 # If you have latency problems turn this to "yes". Otherwise leave it as
     672 # "no" that is the safest pick from the point of view of durability.
     673 # 重写的时候是否运用追加appendfsync,默认就行,保证数据安全性
     674 no-appendfsync-on-rewrite no
     675 
     676 # Automatic rewrite of the append only file.
     677 # Redis is able to automatically rewrite the log file implicitly calling
     678 # BGREWRITEAOF when the AOF log size grows by the specified percentage.
     679 #
     680 # This is how it works: Redis remembers the size of the AOF file after the
     681 # latest rewrite (if no rewrite has happened since the restart, the size of
     682 # the AOF at startup is used).
     683 #
     684 # This base size is compared to the current size. If the current size is
     685 # bigger than the specified percentage, the rewrite is triggered. Also
     686 # you need to specify a minimal size for the AOF file to be rewritten, this
     687 # is useful to avoid rewriting the AOF file even if the percentage increase
     688 # is reached but it is still pretty small.
     689 #
     690 # Specify a percentage of zero in order to disable the automatic AOF
     691 # rewrite feature.
     692 # 两基准值 100%
     693 auto-aof-rewrite-percentage 100
     694 # 大于64M就触发重写机制
     695 auto-aof-rewrite-min-size 64mb
     696 
     697 # An AOF file may be found to be truncated at the end during the Redis
     698 # startup process, when the AOF data gets loaded back into memory.
     699 # This may happen when the system where Redis is running
     700 # crashes, especially when an ext4 filesystem is mounted without the
     701 # data=ordered option (however this can't happen when Redis itself
     702 # crashes or aborts but the operating system still works correctly).
     703 #
     704 # Redis can either exit with an error when this happens, or load as much
     705 # data as possible (the default now) and start if the AOF file is found
     706 # to be truncated at the end. The following option controls this behavior.
     707 #
     708 # If aof-load-truncated is set to yes, a truncated AOF file is loaded and
     709 # the Redis server starts emitting a log to inform the user of the event.
     710 # Otherwise if the option is set to no, the server aborts with an error
     711 # and refuses to start. When the option is set to no, the user requires
     712 # to fix the AOF file using the "redis-check-aof" utility before to restart
     713 # the server.
     714 #
     715 # Note that if the AOF file will be found to be corrupted in the middle
     716 # the server will still exit with an error. This option only applies when
     717 # Redis will try to read more data from the AOF file but not enough bytes
     718 # will be found.
     719 # 一个因异常被截断的AOF文件被redis启动时加载进内存,redis将会发送日志通知用户
     720 aof-load-truncated yes
     721 
     722 ################################ LUA SCRIPTING  ###############################
     723 
     724 # Max execution time of a Lua script in milliseconds.
     725 #
     726 # If the maximum execution time is reached Redis will log that a script is
     727 # still in execution after the maximum allowed time and will start to
     728 # reply to queries with an error.
     729 #
     730 # When a long running script exceeds the maximum execution time only the
     731 # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
     732 # used to stop a script that did not yet called write commands. The second
     733 # is the only way to shut down the server in the case a write command was
     734 # already issued by the script but the user doesn't want to wait for the natural
     735 # termination of the script.
     736 #
     737 # Set it to 0 or a negative value for unlimited execution without warnings.
     738 # Lua 脚本的最大执行毫秒数
     739 lua-time-limit 5000
     740 
     741 ################################ REDIS CLUSTER  ###############################
     742 #
     743 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     744 # WARNING EXPERIMENTAL: Redis Cluster is considered to be stable code, however
     745 # in order to mark it as "mature" we need to wait for a non trivial percentage
     746 # of users to deploy it in production.
     747 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     748 #
     749 # Normal Redis instances can't be part of a Redis Cluster; only nodes that are
     750 # started as cluster nodes can. In order to start a Redis instance as a
     751 # cluster node enable the cluster support uncommenting the following:
     752 # 开启redis集群
     753 # cluster-enabled yes
     754 
     755 # Every cluster node has a cluster configuration file. This file is not
     756 # intended to be edited by hand. It is created and updated by Redis nodes.
     757 # Every Redis Cluster node requires a different cluster configuration file.
     758 # Make sure that instances running in the same system do not have
     759 # overlapping cluster configuration file names.
     760 # 配置redis自动生成的集群配置文件名。确保同一系统中运行的各redis实例该配置文件不要重名
     761 # cluster-config-file nodes-6379.conf
     762 
     763 # Cluster node timeout is the amount of milliseconds a node must be unreachable
     764 # for it to be considered in failure state.
     765 # Most other internal time limits are multiple of the node timeout.
     766 # 集群节点超时毫秒数
     767 # cluster-node-timeout 15000
     768 
     769 # A slave of a failing master will avoid to start a failover if its data
     770 # looks too old.
     771 #
     772 # There is no simple way for a slave to actually have a exact measure of
     773 # its "data age", so the following two checks are performed:
     774 #
     775 # 1) If there are multiple slaves able to failover, they exchange messages
     776 #    in order to try to give an advantage to the slave with the best
     777 #    replication offset (more data from the master processed).
     778 #    Slaves will try to get their rank by offset, and apply to the start
     779 #    of the failover a delay proportional to their rank.
     780 #
     781 # 2) Every single slave computes the time of the last interaction with
     782 #    its master. This can be the last ping or command received (if the master
     783 #    is still in the "connected" state), or the time that elapsed since the
     784 #    disconnection with the master (if the replication link is currently down).
     785 #    If the last interaction is too old, the slave will not try to failover
     786 #    at all.
     787 #
     788 # The point "2" can be tuned by user. Specifically a slave will not perform
     789 # the failover if, since the last interaction with the master, the time
     790 # elapsed is greater than:
     791 #
     792 #   (node-timeout * slave-validity-factor) + repl-ping-slave-period
     793 #
     794 # So for example if node-timeout is 30 seconds, and the slave-validity-factor
     795 # is 10, and assuming a default repl-ping-slave-period of 10 seconds, the
     796 # slave will not try to failover if it was not able to talk with the master
     797 # for longer than 310 seconds.
     798 #
     799 # A large slave-validity-factor may allow slaves with too old data to failover
     800 # a master, while a too small value may prevent the cluster from being able to
     801 # elect a slave at all.
     802 #
     803 # For maximum availability, it is possible to set the slave-validity-factor
     804 # to a value of 0, which means, that slaves will always try to failover the
     805 # master regardless of the last time they interacted with the master.
     806 # (However they'll always try to apply a delay proportional to their
     807 # offset rank).
     808 #
     809 # Zero is the only value able to guarantee that when all the partitions heal
     810 # the cluster will always be able to continue.
     811 # 为了达到最大限度的高可用性,可以设置为0,即slave不管和master失联多久都可以提升为master
     812 # cluster-slave-validity-factor 10
     813 
     814 # Cluster slaves are able to migrate to orphaned masters, that are masters
     815 # that are left without working slaves. This improves the cluster ability
     816 # to resist to failures as otherwise an orphaned master can't be failed over
     817 # in case of failure if it has no working slaves.
     818 #
     819 # Slaves migrate to orphaned masters only if there are still at least a
     820 # given number of other working slaves for their old master. This number
     821 # is the "migration barrier". A migration barrier of 1 means that a slave
     822 # will migrate only if there is at least 1 other working slave for its master
     823 # and so forth. It usually reflects the number of slaves you want for every
     824 # master in your cluster.
     825 #
     826 # Default is 1 (slaves migrate only if their masters remain with at least
     827 # one slave). To disable migration just set it to a very large value.
     828 # A value of 0 can be set but is useful only for debugging and dangerous
     829 # in production.
     830 # 测试环境可设置为0,生产环境中至少设置为1
     831 # cluster-migration-barrier 1
     832 
     833 # By default Redis Cluster nodes stop accepting queries if they detect there
     834 # is at least an hash slot uncovered (no available node is serving it).
     835 # This way if the cluster is partially down (for example a range of hash slots
     836 # are no longer covered) all the cluster becomes, eventually, unavailable.
     837 # It automatically returns available as soon as all the slots are covered again.
     838 #
     839 # However sometimes you want the subset of the cluster which is working,
     840 # to continue to accept queries for the part of the key space that is still
     841 # covered. In order to do so, just set the cluster-require-full-coverage
     842 # option to no.
     843 # 如果需要集群部分可用情况下仍可提供查询服务,设置为no
     844 # cluster-require-full-coverage yes
     845 
     846 # In order to setup your cluster make sure to read the documentation
     847 # available at http://redis.io web site.
     848 
     849 ################################## SLOW LOG ###################################
     850 
     851 # The Redis Slow Log is a system to log queries that exceeded a specified
     852 # execution time. The execution time does not include the I/O operations
     853 # like talking with the client, sending the reply and so forth,
     854 # but just the time needed to actually execute the command (this is the only
     855 # stage of command execution where the thread is blocked and can not serve
     856 # other requests in the meantime).
     857 #
     858 # You can configure the slow log with two parameters: one tells Redis
     859 # what is the execution time, in microseconds, to exceed in order for the
     860 # command to get logged, and the other parameter is the length of the
     861 # slow log. When a new command is logged the oldest one is removed from the
     862 # queue of logged commands.
     863 
     864 # The following time is expressed in microseconds, so 1000000 is equivalent
     865 # to one second. Note that a negative number disables the slow log, while
     866 # a value of zero forces the logging of every command.
     867 # 1000000等于1秒,设置为0则记录所有命令
     868 slowlog-log-slower-than 10000
     869 
     870 # There is no limit to this length. Just be aware that it will consume memory.
     871 # You can reclaim memory used by the slow log with SLOWLOG RESET.
     872 # 记录大小,可通过SLOWLOG RESET命令重置
     873 slowlog-max-len 128
     874 
     875 ################################ LATENCY MONITOR ##############################
     876 
     877 # The Redis latency monitoring subsystem samples different operations
     878 # at runtime in order to collect data related to possible sources of
     879 # latency of a Redis instance.
     880 #
     881 # Via the LATENCY command this information is available to the user that can
     882 # print graphs and obtain reports.
     883 #
     884 # The system only logs operations that were performed in a time equal or
     885 # greater than the amount of milliseconds specified via the
     886 # latency-monitor-threshold configuration directive. When its value is set
     887 # to zero, the latency monitor is turned off.
     888 #
     889 # By default latency monitoring is disabled since it is mostly not needed
     890 # if you don't have latency issues, and collecting data has a performance
     891 # impact, that while very small, can be measured under big load. Latency
     892 # monitoring can easily be enabled at runtime using the command
     893 # "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
     894 # 记录执行时间大于或等于预定时间(毫秒)的操作,为0时不记录
     895 latency-monitor-threshold 0
     896 
     897 ############################# EVENT NOTIFICATION ##############################
     898 
     899 # Redis can notify Pub/Sub clients about events happening in the key space.
     900 # This feature is documented at http://redis.io/topics/notifications
     901 #
     902 # For instance if keyspace events notification is enabled, and a client
     903 # performs a DEL operation on key "foo" stored in the Database 0, two
     904 # messages will be published via Pub/Sub:
     905 #
     906 # PUBLISH __keyspace@0__:foo del
     907 # PUBLISH __keyevent@0__:del foo
     908 #
     909 # It is possible to select the events that Redis will notify among a set
     910 # of classes. Every class is identified by a single character:
     911 #
     912 #  K     Keyspace events, published with __keyspace@<db>__ prefix.
     913 #  E     Keyevent events, published with __keyevent@<db>__ prefix.
     914 #  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
     915 #  $     String commands
     916 #  l     List commands
     917 #  s     Set commands
     918 #  h     Hash commands
     919 #  z     Sorted set commands
     920 #  x     Expired events (events generated every time a key expires)
     921 #  e     Evicted events (events generated when a key is evicted for maxmemory)
     922 #  A     Alias for g$lshzxe, so that the "AKE" string means all the events.
     923 #
     924 #  The "notify-keyspace-events" takes as argument a string that is composed
     925 #  of zero or multiple characters. The empty string means that notifications
     926 #  are disabled.
     927 #
     928 #  Example: to enable list and generic events, from the point of view of the
     929 #           event name, use:
     930 #
     931 #  notify-keyspace-events Elg
     932 #
     933 #  Example 2: to get the stream of the expired keys subscribing to channel
     934 #             name __keyevent@0__:expired use:
     935 #
     936 #  notify-keyspace-events Ex
     937 #
     938 #  By default all notifications are disabled because most users don't need
     939 #  this feature and the feature has some overhead. Note that if you don't
     940 #  specify at least one of K or E, no events will be delivered.
     941 # Redis能通知 Pub/Sub 客户端关于键空间发生的事件,默认关闭
     942 notify-keyspace-events ""
     943 
     944 ############################### ADVANCED CONFIG ###############################
     945 
     946 # Hashes are encoded using a memory efficient data structure when they have a
     947 # small number of entries, and the biggest entry does not exceed a given
     948 # threshold. These thresholds can be configured using the following directives.
     949 # 数据结构来编码。可以通过下面的指令来设定限制
     950 hash-max-ziplist-entries 512
     951 hash-max-ziplist-value 64
     952 
     953 # Lists are also encoded in a special way to save a lot of space.
     954 # The number of entries allowed per internal list node can be specified
     955 # as a fixed maximum size or a maximum number of elements.
     956 # For a fixed maximum size, use -5 through -1, meaning:
     957 # -5: max size: 64 Kb  <-- not recommended for normal workloads
     958 # -4: max size: 32 Kb  <-- not recommended
     959 # -3: max size: 16 Kb  <-- probably not recommended
     960 # -2: max size: 8 Kb   <-- good
     961 # -1: max size: 4 Kb   <-- good
     962 # Positive numbers mean store up to _exactly_ that number of elements
     963 # per list node.
     964 # The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size),
     965 # but if your use case is unique, adjust the settings as necessary.
     966 # 每个quicklist节点上的ziplist大小不能超过8 Kb。(-2是Redis给出的默认值)
     967 list-max-ziplist-size -2
     968 
     969 # Lists may also be compressed.
     970 # Compress depth is the number of quicklist ziplist nodes from *each* side of
     971 # the list to *exclude* from compression.  The head and tail of the list
     972 # are always uncompressed for fast push/pop operations.  Settings are:
     973 # 0: disable all list compression
     974 # 1: depth 1 means "don't start compressing until after 1 node into the list,
     975 #    going from either the head or tail"
     976 #    So: [head]->node->node->...->node->[tail]
     977 #    [head], [tail] will always be uncompressed; inner nodes will compress.
     978 # 2: [head]->[next]->node->node->...->node->[prev]->[tail]
     979 #    2 here means: don't compress head or head->next or tail->prev or tail,
     980 #    but compress all nodes between them.
     981 # 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail]
     982 # etc.
     983 # 是个特殊值,表示都不压缩。这是Redis的默认值,以便于在表的两端进行快速存取。
     984 list-compress-depth 0
     985 
     986 # Sets have a special encoding in just one case: when a set is composed
     987 # of just strings that happen to be integers in radix 10 in the range
     988 # of 64 bit signed integers.
     989 # The following configuration setting sets the limit in the size of the
     990 # set in order to use this special memory saving encoding.
     991 # 用来设置set使用这种编码来节省内存的最大长度
     992 set-max-intset-entries 512
     993 
     994 # Similarly to hashes and lists, sorted sets are also specially encoded in
     995 # order to save a lot of space. This encoding is only used when the length and
     996 # elements of a sorted set are below the following limits:
     997 # 只适合长度和元素都小于下面限制的有序集合
     998 zset-max-ziplist-entries 128
     999 zset-max-ziplist-value 64
    1000 
    1001 # HyperLogLog sparse representation bytes limit. The limit includes the
    1002 # 16 bytes header. When an HyperLogLog using the sparse representation crosses
    1003 # this limit, it is converted into the dense representation.
    1004 #
    1005 # A value greater than 16000 is totally useless, since at that point the
    1006 # dense representation is more memory efficient.
    1007 #
    1008 # The suggested value is ~ 3000 in order to have the benefits of
    1009 # the space efficient encoding without slowing down too much PFADD,
    1010 # which is O(N) with the sparse encoding. The value can be raised to
    1011 # ~ 10000 when CPU is not a concern, but space is, and the data set is
    1012 # composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
    1013 # 建议值是3000左右,以便具有的内存好处, 减少内存的消耗
    1014 hll-sparse-max-bytes 3000
    1015 
    1016 # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
    1017 # order to help rehashing the main Redis hash table (the one mapping top-level
    1018 # keys to values). The hash table implementation Redis uses (see dict.c)
    1019 # performs a lazy rehashing: the more operation you run into a hash table
    1020 # that is rehashing, the more rehashing "steps" are performed, so if the
    1021 # server is idle the rehashing is never complete and some more memory is used
    1022 # by the hash table.
    1023 #
    1024 # The default is to use this millisecond 10 times every second in order to
    1025 # actively rehash the main dictionaries, freeing memory when possible.
    1026 #
    1027 # If unsure:
    1028 # use "activerehashing no" if you have hard latency requirements and it is
    1029 # not a good thing in your environment that Redis can reply from time to time
    1030 # to queries with 2 milliseconds delay.
    1031 #
    1032 # use "activerehashing yes" if you don't have such hard requirements but
    1033 # want to free memory asap when possible.
    1034 # 启用哈希刷新,每100个CPU毫秒会拿出1个毫秒来刷新Redis的主哈希表(顶级键值映射表)
    1035 activerehashing yes
    1036 
    1037 # The client output buffer limits can be used to force disconnection of clients
    1038 # that are not reading data from the server fast enough for some reason (a
    1039 # common reason is that a Pub/Sub client can't consume messages as fast as the
    1040 # publisher can produce them).
    1041 #
    1042 # The limit can be set differently for the three different classes of clients:
    1043 #
    1044 # normal -> normal clients including MONITOR clients
    1045 # slave  -> slave clients
    1046 # pubsub -> clients subscribed to at least one pubsub channel or pattern
    1047 #
    1048 # The syntax of every client-output-buffer-limit directive is the following:
    1049 #
    1050 # client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
    1051 #
    1052 # A client is immediately disconnected once the hard limit is reached, or if
    1053 # the soft limit is reached and remains reached for the specified number of
    1054 # seconds (continuously).
    1055 # So for instance if the hard limit is 32 megabytes and the soft limit is
    1056 # 16 megabytes / 10 seconds, the client will get disconnected immediately
    1057 # if the size of the output buffers reach 32 megabytes, but will also get
    1058 # disconnected if the client reaches 16 megabytes and continuously overcomes
    1059 # the limit for 10 seconds.
    1060 #
    1061 # By default normal clients are not limited because they don't receive data
    1062 # without asking (in a push way), but just after a request, so only
    1063 # asynchronous clients may create a scenario where data is requested faster
    1064 # than it can read.
    1065 #
    1066 # Instead there is a default limit for pubsub and slave clients, since
    1067 # subscribers and slaves receive data in a push fashion.
    1068 #
    1069 # Both the hard or the soft limit can be disabled by setting them to zero.
    1070 # 客户端的输出缓冲区的限制,可用于强制断开那些因为某种原因从服务器读取数据的速度不够快的
    1071 client-output-buffer-limit normal 0 0 0
    1072 client-output-buffer-limit slave 256mb 64mb 60
    1073 client-output-buffer-limit pubsub 32mb 8mb 60
    1074 
    1075 # Redis calls an internal function to perform many background tasks, like
    1076 # closing connections of clients in timeout, purging expired keys that are
    1077 # never requested, and so forth.
    1078 #
    1079 # Not all tasks are performed with the same frequency, but Redis checks for
    1080 # tasks to perform according to the specified "hz" value.
    1081 #
    1082 # By default "hz" is set to 10. Raising the value will use more CPU when
    1083 # Redis is idle, but at the same time will make Redis more responsive when
    1084 # there are many keys expiring at the same time, and timeouts may be
    1085 # handled with more precision.
    1086 #
    1087 # The range is between 1 and 500, however a value over 100 is usually not
    1088 # a good idea. Most users should use the default of 10 and raise this up to
    1089 # 100 only in environments where very low latency is required.
    1090 # 同时到期会使Redis的反应更灵敏,以及超时可以更精确地处理
    1091 hz 10
    1092 
    1093 # When a child rewrites the AOF file, if the following option is enabled
    1094 # the file will be fsync-ed every 32 MB of data generated. This is useful
    1095 # in order to commit the file to the disk more incrementally and avoid
    1096 # big latency spikes.
    1097 # 当一个子进程重写AOF文件时,如果启用下面的选项,则文件每生成32M数据会被同步
    1098 aof-rewrite-incremental-fsync yes
  • 相关阅读:
    [百度百科]PCI-E的速度
    Oracle 高版本往低版本备份恢复的方法
    PHP-Java-Bridge使用笔记
    Delphi获取其它进程窗口句柄的3种方法
    二层交换机当三层交换机,使用单臂路由实现二层交换机上的VLAN互通
    Python下科学计算包numpy和SciPy的安装【原创】
    OpenGL: 你不知道的左右手坐标系
    Delphi XE7的安卓程序如何调用JAVA的JAR,使用JAVA的类?
    科普:UTF-8 GBK UTF8 GB2312 之间的区别和关系
    phpmyadmin #1045 #2002 无法登录 MySQL 服务器的解决方
  • 原文地址:https://www.cnblogs.com/Alexephor/p/11456070.html
Copyright © 2011-2022 走看看