# Redis configuration file example.
# Redis配置文件示例
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
# 请注意,为了读取配置文件,Redis必须以文件路径作为第一个参数启动:
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#关于单位的注意事项:当需要内存大小时,可以用通常的1k 5GB 4M格式指定,以此类推:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
# 单元不区分大小写,因此1GB 1GB 1GB都是相同的。
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you
# have a standard template that goes to all Redis servers but also need
# to customize a few per-server settings. Include files can include
# other files, so use this wisely.
# 在此包含一个或多个其他配置文件。
#如果您有一个可用于所有Redis服务器的标准模板,但还需要为每台服务器自定义一些设置,那么这很有用。
#Include文件可以包含其他文件,所以要明智地使用它。
#
# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
# from admin or Redis Sentinel. Since Redis always uses the last processed
# line as value of a configuration directive, you'd better put includes
# at the beginning of this file to avoid overwriting config change at runtime.
# 注意选项“include”不会被来自admin或Redis Sentinel的命令“CONFIG REWRITE”重写。由于Redis总是使用最后处理的行作为配置指令的值,所以最好将includes放在这个文件的开头,以避免在运行时覆盖配置更改。
#
# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
# 如果您对使用include重写配置选项感兴趣,那么最好使用include作为最后一行
#
# include /path/to/local.conf
# include /path/to/other.conf
################################## MODULES #####################################
# Load modules at startup. If the server is not able to load modules
# it will abort. It is possible to use multiple loadmodule directives.
# 启动时加载模块。如果服务器无法加载模块,它将中止。可以使用多个loadmodule指令。
#
# loadmodule /path/to/my_module.so
# loadmodule /path/to/other_module.so
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
# 默认情况下,如果没有指定“bind”配置指令,Redis将侦听服务器上所有可用网络接口的连接。使用“bind”配置指令,后跟一个或多个IP地址,可以只监听一个或多个选定的接口。
#
# Examples:
# 示例:
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
# ~~~警告~~~如果运行Redis的计算机直接暴露于
# 绑定到所有接口是危险的,并且会暴露
# 在互联网上的每个人的实例。所以默认情况下,我们取消注释
# 遵循bind指令,这将强制Redis只监听
# IPv4环回接口地址(这意味着Redis将能够
# 只接受来自运行在同一台计算机上的客户端的连接)。
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
#如果确定希望实例监听所有接口
#只需注释下一行。
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
# Protected mode是一个安全保护层,目的是避免在internet上开放的Redis实例被访问和利用。
# When protected mode is on and if:
# 当保护模式开启时,如果:
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 1) 服务器没有使用“bind”指令显式绑定到一组地址。
# 2) No password is configured.
# 2) 未配置密码。
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
# 服务器只接受来自IPv4和IPv6环回地址127.0.0.1和::1的客户端的连接,以及来自Unix域套接字的连接。
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
# 默认情况下,已启用保护模式。只有当您确定希望其他主机的客户机连接到Redis时,才应该禁用它,即使没有配置身份验证,也没有使用“bind”指令显式列出一组特定的接口。
protected-mode yes
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
# 接受指定端口上的连接,默认值为6379(IANA#815344)。如果指定了端口0,Redis将不侦听TCP套接字。
port 6379
# TCP listen() backlog.
# TCP 监听 积压
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
# 在每秒请求数高的环境中,您需要大量的积压工作以避免客户端连接速度慢的问题。
# 请注意,Linux内核将静默地将其截断为/proc/sys/net/core/somaxconn,因此请确保同时提高somaxconn和tcp_max_syn_backlog的值,以获得所需的效果
tcp-backlog 511
# Unix socket.
# Unix套接字。
#
# 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.
# 指定将用于侦听传入连接的Unix套接字的路径。
# 没有默认值,因此未指定时,Redis将不会侦听unix套接字。
#
# unixsocket /tmp/redis.sock
# unixsocketperm 700
# Close the connection after a client is idle for N seconds (0 to disable)
# 在客户端空闲N秒后关闭连接(0表示禁用)
timeout 0
# TCP keepalive.
# TCP保持连接。
#
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
# 如果不为零,请使用SO_KEEPALIVE在没有通信的情况下向客户端发送TCP ack。这有两个原因:
#
# 1) Detect dead peers.
# 1) 检测死机。
# 2) Take the connection alive from the point of view of network
# equipment in the middle.
# 2)从中间网络设备的角度进行连接。
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
# 在Linux上,指定的值(以秒为单位)是用于发送确认的周期。
# 请注意,要关闭连接,需要加倍的时间。
# 在其他内核上,周期取决于内核配置。
#
# A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis 3.2.1.
# 这个选项的合理值是300秒,这是新的
# Redis默认从Redis 3.2.1开始。
#
tcp-keepalive 300
################################# TLS/SSL #####################################
# By default, TLS/SSL is disabled. To enable it, the "tls-port" configuration
# directive can be used to define TLS-listening ports. To enable TLS on the
# default port, use:
# 默认情况下,TLS/SSL处于禁用状态。要启用它,“tls端口”配置
# 指令可用于定义TLS侦听端口。在上启用TLS
# 默认端口,使用:
#
# port 0
# tls-port 6379
# Configure a X.509 certificate and private key to use for authenticating the
# server to connected clients, masters or cluster peers. These files should be
# PEM formatted.
# 配置用于验证的X.509证书和私钥
# 服务器到连接的客户机、主机或群集对等机。
# 这些文件应为PEM格式。
#
# tls-cert-file redis.crt
# tls-key-file redis.key
# Configure a DH parameters file to enable Diffie-Hellman (DH) key exchange:
# 配置DH参数文件以启用Diffie-Hellman(DH)密钥交换:
# tls-dh-params-file redis.dh
# Configure a CA certificate(s) bundle or directory to authenticate TLS/SSL
# clients and peers. Redis requires an explicit configuration of at least one
# of these, and will not implicitly use the system wide configuration.
# 配置CA证书捆绑包或目录以验证TLS/SSL客户和同行。
# Redis至少需要一个显式配置,并且不会隐式使用系统范围的配置。
# tls-ca-cert-file ca.crt
# tls-ca-cert-dir /etc/ssl/certs
# By default, clients (including replica servers) on a TLS port are required
# to authenticate using valid client side certificates.
# 默认情况下,TLS端口上的客户端(包括副本服务器)需要使用有效的客户端证书进行身份验证。
# It is possible to disable authentication using this directive.
# 可以使用此指令禁用身份验证。
#
# tls-auth-clients no
# By default, a Redis replica does not attempt to establish a TLS connection
# with its master.
# 默认情况下,Redis副本不尝试与其主副本建立TLS连接。
#
# Use the following directive to enable TLS on replication links.
# 使用以下指令在复制链接上启用TLS。
# tls-replication yes
# By default, the Redis Cluster bus uses a plain TCP connection. To enable
# TLS for the bus protocol, use the following directive:
# 默认情况下,Redis集群总线使用纯TCP连接。要为总线协议启用TLS,请使用以下指令:
# tls-cluster yes
# Explicitly specify TLS versions to support. Allowed values are case insensitive
# and include "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3" (OpenSSL >= 1.1.1) or
# any combination. To enable only TLSv1.2 and TLSv1.3, use:
# 显式指定要支持的TLS版本。允许的值不区分大小写
# 包括“TLSv1”、“TLSv1.1”、“TLSv1.2”、“TLSv1.3”(OpenSSL>=1.1.1)或
# 任何组合。要仅启用TLSv1.2和TLSv1.3,请使用:
# tls-protocols "TLSv1.2 TLSv1.3"
# Configure allowed ciphers. See the ciphers(1ssl) manpage for more information
# about the syntax of this string.
# 配置允许的密码。有关更多信息,请参阅密码(1ssl)手册页关于这个字符串的语法。
#
# Note: this configuration applies only to <= TLSv1.2.
# 注:此配置仅适用于<=TLSv1.2。
# tls-ciphers DEFAULT:!MEDIUM
# Configure allowed TLSv1.3 ciphersuites. See the ciphers(1ssl) manpage for more
# information about the syntax of this string, and specifically for TLSv1.3
# ciphersuites.
# 置允许的TLSv1.3密码套件。请参阅ciphers(1ssl)手册页,了解有关此字符串语法的更多信息,特别是TLSv1.3
# 密码套件。
#
# tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256
# When choosing a cipher, use the server's preference instead of the client
# preference. By default, the server follows the client's preference.
# 选择密码时,请使用服务器的首选项,而不是客户端的首选项。默认情况下,服务器遵循客户机的首选项。
# tls-prefer-server-ciphers yes
# By default, TLS session caching is enabled to allow faster and less expensive
# reconnections by clients that support it. Use the following directive to disable
# caching.
# 默认情况下,TLS会话缓存是启用的,以允许更快、更便宜
# 由支持它的客户端重新连接。使用以下指令禁用缓存。
#
# tls-session-caching no
# Change the default number of TLS sessions cached. A zero value sets the cache
# to unlimited size. The default size is 20480.
# 更改缓存的默认TLS会话数。零值将缓存设置为无限制大小。默认大小为20480。
#
# tls-session-cache-size 5000
# Change the default timeout of cached TLS sessions. The default timeout is 300
# seconds.
# 更改缓存TLS会话的默认超时。默认超时为300秒。
#
# tls-session-cache-timeout 60
################################# GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# 默认情况下,Redis不作为守护进程运行。如果需要,请使用“是”。
# 注意Redis将在/var/run中写入一个pid文件/redis.pid文件当被守护时。
daemonize yes
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# 如果您从upstart或systemd运行Redis,Redis可以与监督树。选项:
# supervised no - no supervision interaction
# supervised no - 无监督互动
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised upstart - 通过将Redis置于SIGSTOP模式发出信号
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised systemd - 通过写入准备就绪的套接字
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# supervised auto - 基于upstart_JOB或NOTIFY_SOCKET环境变量检测upstart或systemd方法
#
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
#
# 注意:这些监视方法只发出“进程准备就绪”的信号。它们不会向您的主管启用连续的活动ping。
supervised no
# If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
# 如果指定了pid文件,Redis会在启动时将其写入指定的位置,并在退出时将其删除。
#
# When the server runs non daemonized, no pid file is created if none is
# specified in the configuration. When the server is daemonized, the pid file
# is used even if not specified, defaulting to "/var/run/redis.pid".
# 当服务器运行非守护程序时,如果配置中未指定任何pid文件,则不会创建任何pid文件。当服务器被守护时,pid文件
# 即使未指定,也会使用,默认为“/var/run”/redis.pid文件".
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
# 创建一个pid文件是最好的方法:如果Redis不能创建它
#没有什么不好的事情发生,服务器将正常启动和运行。
pidfile /var/run/redis_6379.pid
# Specify the server verbosity level.
# 指定服务器详细级别。
# This can be one of:
# 这可以是:
# debug (a lot of information, useful for development/testing)
# 调试(很多信息,对开发/测试很有用)
# verbose (many rarely useful info, but not a mess like the debug level)
# 冗长(很多很少有用的信息,但不像调试级别那样混乱)
# notice (moderately verbose, what you want in production probably)
# 注意(适度冗长,您可能希望在生产中使用什么)
# warning (only very important / critical messages are logged)
# 警告(只记录非常重要/关键的消息)
loglevel notice
# Specify the 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, logs will be sent to /dev/null
# 指定日志文件名。也可以使用空字符串强制
# Redis登录标准输出。请注意,如果使用标准
#日志输出,但daemonize,日志将发送到/dev/null
logfile ""
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# 要启用对系统记录器的日志记录,只需将“syslog enabled”设置为yes,并根据需要更新其他syslog参数。
# syslog-enabled no
# Specify the syslog identity.
# 指定系统日志标识。
# syslog-ident redis
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# 指定syslog工具。必须是USER或介于LOCAL0-LOCAL7之间。
# syslog-facility local0
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between 0 and 'databases'-1
# 设置数据库的数量。默认数据库是db0,您可以使用select<dbid>在每个连接的基础上选择一个不同的数据库,其中dbid是0和“databases”-1之间的数字
databases 16
# By default Redis shows an ASCII art logo only when started to log to the
# standard output and if the standard output is a TTY. Basically this means
# that normally a logo is displayed only in interactive sessions.
# 默认情况下,仅当开始登录到
# 如果标准输出是TTY。基本上这意味着
# 一个logo通常只在交互会话中显示。
#
# However it is possible to force the pre-4.0 behavior and always show a
# ASCII art logo in startup logs by setting the following option to yes.
# 但是,通过将以下选项设置为yes,可以强制4.0之前的行为,并始终在启动日志中显示ASCII art徽标。
always-show-logo yes
################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
# 在磁盘上保存数据库:
# save <seconds> <changes>
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
# 如果对数据库执行给定的秒数和写入操作数,则将保存数据库。
#
# In the example below the behaviour will be to 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
# 在下面的示例中,行为将是保存:
# 900秒(15分钟)后,如果至少有1把钥匙改变
# 300秒(5分钟)后,如果至少有10个按键发生变化
# 60秒后,如果至少有10000个钥匙被更改
# Note: you can disable saving completely by commenting out all "save" lines.
# 注意:您可以通过注释掉所有“save”行来完全禁用保存。
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
# 还可以通过添加带有单个空字符串参数的save指令来删除所有先前配置的存储点,如以下示例所示:
# save ""
save 900 1
save 300 10
save 60 10000
# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
# 默认情况下,如果启用了RDB快照(至少有一个保存点),并且最新的后台保存失败,则Redis将停止接受写入。
# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
# disaster will happen.
# 这将使用户意识到(以一种艰难的方式)数据没有正确地保存在磁盘上,否则很可能没有人会注意到
# 灾难就会发生。
# If the background saving process will start working again Redis will
# automatically allow writes again.
# 如果后台保存进程重新开始工作,Redis将自动允许再次写入。
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
# 但是,如果您已经设置了对Redis服务器和持久性的适当监视,那么您可能希望禁用此功能,以便即使磁盘、权限等出现问题,Redis也将继续正常工作。
stop-writes-on-bgsave-error yes
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
# 在转储.rdb数据库时使用LZF压缩字符串对象?
# 默认设置为“是”,因为这几乎总是一场胜利。
# 如果要在saving子进程中保存一些CPU,请将其设置为“no”,但是
# 如果有可压缩的值或键,数据集可能会更大。
rdbcompression yes
# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant to corruption but there is a performance
# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
# for maximum performances.
# 由于RDB版本5的CRC64校验和被放置在文件。这个使格式更抗损坏,但在保存和加载RDB文件时,性能会受到影响(大约10%),因此您可以禁用它以获得最大性能。
# RDB files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip the check.
# 在禁用校验和的情况下创建的RDB文件的校验和为零,这将告诉加载代码跳过检查。
rdbchecksum yes
# The filename where to dump the DB
# 转储数据库的文件名
dbfilename dump.rdb
# Remove RDB files used by replication in instances without persistence
# enabled. By default this option is disabled, however there are environments
# where for regulations or other security concerns, RDB files persisted on
# disk by masters in order to feed replicas, or stored on disk by replicas
# in order to load them for the initial synchronization, should be deleted
# ASAP. Note that this option ONLY WORKS in instances that have both AOF
# and RDB persistence disabled, otherwise is completely ignored.
# 在没有启用持久性的实例中删除复制使用的RDB文件。默认情况下,此选项处于禁用状态,
# 但是,在某些环境中,出于管理法规或其他安全考虑,应尽快删除主服务器在磁盘上保留的RDB文件,
# 以便向副本提供数据,或通过副本存储在磁盘上以加载这些文件以进行初始同步。请注意,
# 此选项仅适用于同时禁用AOF和RDB持久性的实例,否则将完全忽略。
# An alternative (and sometimes better) way to obtain the same effect is
# to use diskless replication on both master and replicas instances. However
# in the case of replicas, diskless is not always an option.
# 有时,在主副本和无盘复制中获得更好的效果的方法是使用无盘复制和主副本。但是,对于副本,无盘并不总是一个选项。
rdb-del-sync-files no
# The working directory.
# 工作目录。
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
# 数据库将写入此目录中,并使用上面使用“dbfilename”配置指令指定的文件名。
#
# The Append Only File will also be created inside this directory.
# 仅附加文件也将在此目录中创建。
# Note that you must specify a directory here, not a file name.
# 请注意,您必须在此处指定目录,而不是文件名。
dir ./
################################# REPLICATION #################################
# Master-Replica replication. Use replicaof to make a Redis instance a copy of
# another Redis server. A few things to understand ASAP about Redis replication.
# 主副本复制。使用replicaof使Redis实例成为另一个Redis服务器的副本。关于Redis复制,需要尽快了解一些事情。
#
# +------------------+ +---------------+
# | Master | ---> | Replica |
# | (receive writes) | | (exact copy) |
# +------------------+ +---------------+
#
# 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 replicas.
# 1) Redis复制是异步的,但是您可以配置一个主服务器,使其停止接受写入,如果它似乎没有连接到至少给定数量的副本。
# 2) Redis replicas are able to perform a partial resynchronization with the
# master if the replication link is lost for a relatively small amount of
# time. You may want to configure the replication backlog size (see the next
# sections of this file) with a sensible value depending on your needs.
# 2) 如果复制链接丢失的时间相对较短,则Redis副本能够与主服务器执行部分重新同步。根据您的需要,您可能需要使用一个合理的值来配置复制backlog大小(请参阅此文件的下一节)。
# 3) Replication is automatic and does not need user intervention. After a
# network partition replicas automatically try to reconnect to masters
# and resynchronize with them.
# 3) 复制是自动的,不需要用户干预。请尝试在主副本与网络分区重新同步后自动重新连接。
# replicaof <masterip> <masterport>
# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the replica to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
# 如果主机受密码保护(使用“requirepass”配置
# 在开始复制同步过程之前,可以告诉副本进行身份验证,否则主机将拒绝副本请求。
#
# masterauth <master-password>
#
# However this is not enough if you are using Redis ACLs (for Redis version
# 6 or greater), and the default user is not capable of running the PSYNC
# command and/or other commands needed for replication. In this case it's
# better to configure a special user to use with replication, and specify the
# masteruser configuration as such:
# 但是,如果您使用的是Redis acl(用于Redis version 6或更高版本),并且默认用户无法运行PSYNC命令和/或复制所需的其他命令,那么这还不够。
# 在这种情况下,最好配置一个用于复制的特殊用户,并按如下方式指定主用户配置:
#
# masteruser <username>
#
# When masteruser is specified, the replica will authenticate against its
# master using the new AUTH form: AUTH <username> <password>.
# 指定masteruser后,复制副本将使用新的身份验证形式AUTH<username><password>对其主服务器进行身份验证。
# When a replica loses its connection with the master, or when the replication
# is still in progress, the replica can act in two different ways:
# 当复制副本失去与主服务器的连接,或复制仍在进行时,复制副本可以以两种不同的方式操作:
# 1) if replica-serve-stale-data is set to 'yes' (the default) the replica 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.
# 1) 如果replica-serve-stale-data设置为“yes”(默认值),则复制副本仍将响应客户端请求,数据可能已过期,或者如果这是第一次同步,则数据集可能为空。
#
# 2) if replica-serve-stale-data is set to 'no' the replica will reply with
# an error "SYNC with master in progress" to all the kind of commands
# but to INFO, replicaOF, AUTH, PING, SHUTDOWN, REPLCONF, ROLE, CONFIG,
# SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB,
# COMMAND, POST, HOST: and LATENCY.
# 2) 如果replica serve stale data设置为“no”,则除了INFO、replicaOF、AUTH、PING、SHUTDOWN、REPLCONF、ROLE、CONFIG之外,复制副本将对所有类型的命令答复错误“SYNC with master in progress”,
# 订阅、取消订阅、PSUBSCRIBE、PUNSUBSCRIBE、PUBLISH、PUBSUB、COMMAND、POST、HOST:和延迟。
replica-serve-stale-data yes
# You can configure a replica instance to accept writes or not. Writing against
# a replica instance may be useful to store some ephemeral data (because data
# written on a replica will be easily deleted after resync with the master) but
# may also cause problems if clients are writing to it because of a
# misconfiguration.
# 您可以将副本实例配置为接受或不接受写入。针对副本实例写入数据对于存储一些短暂的数据可能很有用(因为在副本上写入的数据在与主服务器重新同步后很容易被删除),
# 但如果客户端由于配置错误而写入副本,则也可能会导致问题。
# Since Redis 2.6 by default replicas are read-only.
# 因为Redis 2.6默认情况下副本是只读的。
#
# Note: read only replicas are not designed to be exposed to untrusted clients
# on the internet. It's just a protection layer against misuse of the instance.
# Still a read only replica exports by default all the administrative commands
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only replicas using 'rename-command' to shadow all the
# administrative / dangerous commands.
# 注意:只读副本不是为暴露在internet上的不可信客户端而设计的。它只是防止滥用实例。仍然只读副本默认情况下导出所有管理命令,如CONFIG、DEBUG等。
# 在一定程度上,您可以使用“rename command”来隐藏所有管理/危险命令来提高只读副本的安全性
replica-read-only yes
# Replication SYNC strategy: disk or socket.
# 复制同步策略:磁盘或套接字。
#
# New replicas and reconnecting replicas that are not able to continue the
# replication process just receiving differences, need to do what is called a
# "full synchronization". An RDB file is transmitted from the master to the
# replicas.
# 新的复制副本和重新连接的复制副本如果只是接收到差异而无法继续复制过程,则需要执行所谓的“完全同步”。RDB文件从主服务器传输到副本。
#
# The transmission can happen in two different ways:
# 传输有两种不同的方式:
#
# 1) Disk-backed: The Redis master creates a new process that writes the RDB
# file on disk. Later the file is transferred by the parent
# process to the replicas incrementally.
# 1) 磁盘备份:Redis主机创建一个新进程,将RDB文件写入磁盘。稍后,该文件由父进程以增量方式传输到副本。
#
# 2) Diskless: The Redis master creates a new process that directly writes the
# RDB file to replica sockets, without touching the disk at all.
# 2) 无盘:Redis主机创建了一个新进程,直接将RDB文件写入副本套接字,而完全不接触磁盘。
# With disk-backed replication, while the RDB file is generated, more replicas
# can be queued and served with the RDB file as soon as the current child
# producing the RDB file finishes its work. With diskless replication instead
# once the transfer starts, new replicas arriving will be queued and a new
# transfer will start when the current one terminates.
# 使用磁盘备份复制,在生成RDB文件时,只要当前生成RDB文件的子级完成工作,就可以将更多副本排入队列并与RDB文件一起提供服务。而不是无盘复制
# 一旦传输开始,到达的新副本将进入队列,新的传输将在当前副本终止时开始。
# When diskless replication is used, the master waits a configurable amount of
# time (in seconds) before starting the transfer in the hope that multiple
# replicas will arrive and the transfer can be parallelized.
# 使用磁盘备份复制,在生成RDB文件时,只要当前生成RDB文件的子级完成工作,就可以将更多副本排入队列并与RDB文件一起提供服务。而不是无盘复制
# 一旦传输开始,到达的新副本将进入队列,新的传输将在当前副本终止时开始。
# With slow disks and fast (large bandwidth) networks, diskless replication
# works better.
# 对于慢速磁盘和快速(大带宽)网络,无盘复制效果更好。
repl-diskless-sync no
# When diskless replication is enabled, it is possible to configure the delay
# the server waits in order to spawn the child that transfers the RDB via socket
# to the replicas.
# 启用无盘复制时,可以配置服务器等待的延迟,以便生成通过套接字将RDB传输到副本的子级。
#
# This is important since once the transfer starts, it is not possible to serve
# new replicas arriving, that will be queued for the next RDB transfer, so the
# server waits a delay in order to let more replicas arrive.
# 这一点很重要,因为一旦传输开始,就不可能为到达的新副本提供服务,新副本将排队等待下一次RDB传输,因此服务器会等待一个延迟,以便让更多副本到达。
#
# The delay is specified in seconds, and by default is 5 seconds. To disable
# it entirely just set it to 0 seconds and the transfer will start ASAP.
# 延迟以秒为单位指定,默认为5秒。要完全禁用它,只需将其设置为0秒,传输将尽快开始。
repl-diskless-sync-delay 5
# -----------------------------------------------------------------------------
# WARNING: RDB diskless load is experimental. Since in this setup the replica
# does not immediately store an RDB on disk, it may cause data loss during
# failovers. RDB diskless load + Redis modules not handling I/O reads may also
# cause Redis to abort in case of I/O errors during the initial synchronization
# stage with the master. Use only if your do what you are doing.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# 警告:RDB无盘加载是实验性的。由于在此设置中,
# 复制副本不会立即在磁盘上存储RDB,
# 因此在故障转移期间可能会导致数据丢失。
# RDB无盘加载+不处理I/O读取的Redis模块也可能导致Redis在与主机的初始同步阶段出现I/O错误时中止。
# 只在你做你正在做的事情时使用。
# -----------------------------------------------------------------------------
# Replica can load the RDB it reads from the replication link directly from the
# socket, or store the RDB to a file and read that file after it was completely
# recived from the master.
# Replica可以直接从socket加载它从复制链接读取的RDB,或者将RDB存储到一个文件中,
# 并在完全从主服务器接收到该文件之后读取该文件。
#
# In many cases the disk is slower than the network, and storing and loading
# the RDB file may increase replication time (and even increase the master's
# Copy on Write memory and salve buffers).
# 在许多情况下,磁盘比网络慢,存储和加载RDB文件可能会增加复制时间(甚至会增加主机的“写入时拷贝”内存和缓冲区)。
# However, parsing the RDB file directly from the socket may mean that we have
# to flush the contents of the current database before the full rdb was
# received. For this reason we have the following options:
# 然而,直接从套接字解析RDB文件可能意味着我们必须在收到完整的RDB之前刷新当前数据库的内容。为此,我们有以下选择:
#
# "disabled" - Don't use diskless load (store the rdb file to the disk first)
# "disabled" - 不使用无盘加载(先将rdb文件存储到磁盘)
# "on-empty-db" - Use diskless load only when it is completely safe.
# "on-empty-db" - 只有在完全安全的情况下才使用无盘加载。
# "swapdb" - Keep a copy of the current db contents in RAM while parsing
# the data directly from the socket. note that this requires
# sufficient memory, if you don't have it, you risk an OOM kill.
# "swapdb" - 直接从套接字解析数据时,在RAM中保留当前db内容的副本。请注意,这需要足够的内存,如果你没有它,你就有被杀的危险。
repl-diskless-load disabled
# Replicas send PINGs to server in a predefined interval. It's possible to
# change this interval with the repl_ping_replica_period option. The default
# value is 10 seconds.
# 副本以预定义的时间间隔向服务器发送ping。可以使用repl_ping_replica_period选项更改此间隔。默认值为10秒。
#
# repl-ping-replica-period 10
# The following option sets the replication timeout for:
# 以下选项设置的复制超时:
#
# 1) Bulk transfer I/O during SYNC, from the point of view of replica.
# 1) 从复制副本的角度来看,同步期间的大容量传输I/O。
# 2) Master timeout from the point of view of replicas (data, pings).
# 2) 从副本(数据、ping)的角度来看,主超时。
# 3) Replica timeout from the point of view of masters (REPLCONF ACK pings).
# 3) 从主机的角度看,副本超时(REPLCONF ACK pings)。
#
# It is important to make sure that this value is greater than the value
# specified for repl-ping-replica-period otherwise a timeout will be detected
# every time there is low traffic between the master and the replica.
# 请务必确保此值大于为repl ping replica period指定的值,否则每当主服务器和副本之间的通信量较低时都会检测到超时。
#
# repl-timeout 60
# Disable TCP_NODELAY on the replica socket after SYNC?
# 同步后在副本套接字上禁用TCP\u NODELAY?
#
# If you select "yes" Redis will use a smaller number of TCP packets and
# less bandwidth to send data to replicas. But this can add a delay for
# the data to appear on the replica side, up to 40 milliseconds with
# Linux kernels using a default configuration.
# 如果选择“是”,Redis将使用较少的TCP数据包和较少的带宽将数据发送到副本。但这可能会增加数据在副本端出现的延迟,对于Linux内核使用默认配置,最长为40毫秒。
#
# If you select "no" the delay for data to appear on the replica side will
# be reduced but more bandwidth will be used for replication.
# 如果选择“否”,则数据出现在副本端的延迟将减少,但复制将使用更多带宽。
#
# By default we optimize for low latency, but in very high traffic conditions
# or when the master and replicas are many hops away, turning this to "yes" may
# be a good idea.
# 默认情况下,我们会针对低延迟进行优化,但在流量非常大的情况下,
# 或者当主服务器和副本之间有很多跳跃时,将其设置为“是”可能是个好主意。
repl-disable-tcp-nodelay no
# Set the replication backlog size. The backlog is a buffer that accumulates
# replica data when replicas are disconnected for some time, so that when a
# replica wants to reconnect again, often a full resync is not needed, but a
# partial resync is enough, just passing the portion of data the replica
# missed while disconnected.
# 设置复制囤积大小。backlog是一个缓冲区,当副本断开连接一段时间后,它会累积副本数据,
# 因此,当副本需要重新连接时,通常不需要完全重新同步,但部分重新同步就足够了,
# 只需传递断开连接时副本丢失的部分数据。
#
# The bigger the replication backlog, the longer the time the replica can be
# disconnected and later be able to perform a partial resynchronization.
# 复制积压工作越大,复制副本断开连接的时间就越长,以后能够执行部分重新同步的时间就越长。
#
# The backlog is only allocated once there is at least a replica connected.
# 仅当至少有一个副本连接时才分配积压工作。
# repl-backlog-size 1mb
# After a master has no longer connected replicas for some time, the backlog
# will be freed. The following option configures the amount of seconds that
# need to elapse, starting from the time the last replica disconnected, for
# the backlog buffer to be freed.
# 在主服务器一段时间内不再连接副本后,积压工作将被释放。下面的选项配置从上一个复制副本断开连接开始所需的秒数,
# 以便释放backlog缓冲区。
# Note that replicas never free the backlog for timeout, since they may be
# promoted to masters later, and should be able to correctly "partially
# resynchronize" with the replicas: hence they should always accumulate backlog.
# 请注意,复制副本从不释放超时的积压工作,因为它们可能是
# 稍后升级为主控,并且应该能够正确地与副本“部分重新同步”:因此它们应该总是积累积压工作。
# A value of 0 means to never release the backlog.
# 值为0意味着永远不会释放backlog。
#
# repl-backlog-ttl 3600
# The replica priority is an integer number published by Redis in the INFO
# output. It is used by Redis Sentinel in order to select a replica to promote
# into a master if the master is no longer working correctly.
# 副本优先级是Redis在INFO输出中发布的整数。Redis Sentinel使用它来选择复制副本,
# 以便在主服务器不再正常工作时升级为主副本。
# A replica with a low priority number is considered better for promotion, so
# for instance if there are three replicas with priority 10, 100, 25 Sentinel
# will pick the one with priority 10, that is the lowest.
# 优先级较低的副本被认为更适合升级,因此,例如,如果有三个优先级为10、100、25的副本,
# Sentinel将选择优先级为10的副本,即优先级最低的副本。
# However a special priority of 0 marks the replica as not able to perform the
# role of master, so a replica with priority of 0 will never be selected by
# Redis Sentinel for promotion.
# 但是特殊优先级为0会将副本标记为无法执行master角色,因此Redis Sentinel永远不会选择优先级为0的副本进行升级。
# By default the priority is 100.
# 默认情况下,优先级为100。
replica-priority 100
# It is possible for a master to stop accepting writes if there are less than
# N replicas connected, having a lag less or equal than M seconds.
# 如果连接的副本少于N个,并且延迟小于或等于M秒,则主服务器可能停止接受写入。
# The N replicas need to be in "online" state.
# N个副本需要处于“online”状态。
# The lag in seconds, that must be <= the specified value, is calculated from
# the last ping received from the replica, that is usually sent every second.
# 延迟时间(以秒为单位)必须<=指定值,根据从副本接收的最后一次ping计算,该ping通常每秒发送一次。
# This option does not GUARANTEE that N replicas will accept the write, but
# will limit the window of exposure for lost writes in case not enough replicas
# are available, to the specified number of seconds.
# 此选项不保证N个副本将接受写入,但将在没有足够的副本可用的情况下将丢失写入的暴露时间限制在指定的秒数内。
#
# For example to require at least 3 replicas with a lag <= 10 seconds use:
# 例如,要要求至少3个延迟<=10秒的复制副本,请使用:
#
# min-replicas-to-write 3
# min-replicas-max-lag 10
#
# Setting one or the other to 0 disables the feature.
# 将其中一个设置为0将禁用该功能
#
# By default min-replicas-to-write is set to 0 (feature disabled) and
# min-replicas-max-lag is set to 10.
# 默认情况下,要写入的最小副本数设置为0(禁用功能),最小副本最大延迟设置为10。
# A Redis master is able to list the address and port of the attached
# replicas in different ways. For example the "INFO replication" section
# offers this information, which is used, among other tools, by
# Redis Sentinel in order to discover replica instances.
# Another place where this info is available is in the output of the
# "ROLE" command of a master.
# Redis主机能够以不同的方式列出所连接副本的地址和端口。例如,“INFO replication”部分提供了这个信息,
# 除了其他工具外,Redis Sentinel使用它来发现副本实例。另一个此信息可用的地方是在主机的“ROLE”命令的输出中。
# The listed IP and address normally reported by a replica is obtained
# 获得复制副本通常报告的列出的IP和地址
# in the following way:
# 通过以下方式:
# IP: The address is auto detected by checking the peer address
# of the socket used by the replica to connect with the master.
# IP:通过检查复制副本用于与主服务器连接的套接字的对等地址来自动检测该地址。
#
# Port: The port is communicated by the replica during the replication
# handshake, and is normally the port that the replica is using to
# listen for connections.
# Port:在复制握手期间,该端口由副本通信,通常是副本用于侦听连接的端口
#
# However when port forwarding or Network Address Translation (NAT) is
# used, the replica may be actually reachable via different IP and port
# pairs. The following two options can be used by a replica in order to
# report to its master a specific set of IP and port, so that both INFO
# and ROLE will report those values.
# 然而,当使用端口转发或网络地址转换(NAT)时,副本实际上可以通过不同的IP和端口对访问。
# 复制副本可以使用以下两个选项向其主服务器报告一组特定的IP和端口,以便INFO和ROLE都报告这些值。
#
# There is no need to use both the options if you need to override just
# the port or the IP address.
# 如果只需要覆盖端口或IP地址,则不需要同时使用这两个选项。
# replica-announce-ip 5.5.5.5
# replica-announce-port 1234
############################### KEYS TRACKING #################################
# Redis implements server assisted support for client side caching of values.
# This is implemented using an invalidation table that remembers, using
# 16 millions of slots, what clients may have certain subsets of keys. In turn
# this is used in order to send invalidation messages to clients. Please
# to understand more about the feature check this page:
# Redis实现服务器辅助支持客户端缓存值。
# 这是使用一个失效表实现的,它使用了1600万个插槽,客户机可能拥有特定的键子集。
# 反过来,它用于向客户端发送无效消息。
# 请要了解更多有关功能,请查看此页:
# https://redis.io/topics/client-side-caching
#
# When tracking is enabled for a client, all the read only queries are assumed
# to be cached: this will force Redis to store information in the invalidation
# table. When keys are modified, such information is flushed away, and
# invalidation messages are sent to the clients. However if the workload is
# heavily dominated by reads, Redis could use more and more memory in order
# to track the keys fetched by many clients.
# 当为客户机启用跟踪时,将假定所有的只读查询
# 缓存:这将强制Redis在失效表中存储信息。修改密钥时,这些信息将被清除,
# 并向客户端发送无效消息。然而,如果工作负载主要由读操作控制,
# Redis可能会使用越来越多的内存来跟踪许多客户端获取的密钥。
# For this reason it is possible to configure a maximum fill value for the
# invalidation table. By default it is set to 1M of keys, and once this limit
# is reached, Redis will start to evict keys in the invalidation table
# even if they were not modified, just to reclaim memory: this will in turn
# force the clients to invalidate the cached values. Basically the table
# maximum size is a trade off between the memory you want to spend server
# side to track information about who cached what, and the ability of clients
# to retain cached objects in memory.
# 因此,可以为失效表配置最大填充值。默认情况下,它被设置为1M的键,一旦达到这个限制,
# Redis将开始逐出失效表中的键,即使它们没有被修改,只是为了回收内存:这反过来会迫使客户端使缓存的值失效。
# 表的最大大小基本上是在服务器端跟踪谁缓存了什么内容的信息所需的内存和客户端在内存中保留缓存对象的能力之间的权衡。
#
# If you set the value to 0, it means there are no limits, and Redis will
# retain as many keys as needed in the invalidation table.
# In the "stats" INFO section, you can find information about the number of
# keys in the invalidation table at every given moment.
# 如果将该值设置为0,则表示没有限制,并且Redis将根据需要在失效中保留尽可能多的密钥表。英寸在“stats”信息部分,
# 您可以在每个给定的时刻找到关于无效化表中的键数的信息。
# Note: when key tracking is used in broadcasting mode, no memory is used
# in the server side so this setting is useless.
# 注意:当在广播模式下使用密钥跟踪时,服务器端没有使用内存,因此此设置无效。
# tracking-table-max-keys 1000000
################################## SECURITY ###################################
# Warning: since Redis is pretty fast an outside user can try up to
# 1 million passwords per second against a modern box. This means that you
# should use very strong passwords, otherwise they will be very easy to break.
# Note that because the password is really a shared secret between the client
# and the server, and should not be memorized by any human, the password
# can be easily a long string from /dev/urandom or whatever, so by using a
# long and unguessable password no brute force attack will be possible.
# 警告:由于Redis是相当快的外部用户可以尝试高达100万密码对现代盒每秒。这意味着您应该使用非常强的密码,否则它们将非常容易被破解。
# 请注意,因为密码实际上是客户机之间的共享密钥在服务器上,密码很容易是/dev/urandom之类的长字符串,
# 不应该被任何人记住,所以如果使用长且难以猜到的密码,暴力破解是不可能的。
# Redis ACL users are defined in the following format:
# Redis ACL用户定义格式如下:
# user <username> ... acl rules ...
#
# For example:
# 例如:
# user worker +@list +@connection ~jobs:* on >ffa9203c493aa99
#
# The special username "default" is used for new connections. If this user
# has the "nopass" rule, then new connections will be immediately authenticated
# as the "default" user without the need of any password provided via the
# AUTH command. Otherwise if the "default" user is not flagged with "nopass"
# the connections will start in not authenticated state, and will require
# AUTH (or the HELLO command AUTH option) in order to be authenticated and
# start to work.
# 特殊用户名“default”用于新连接。如果这个用户有“nopass”规则,那么新连接将立即作为“默认”用户进行身份验证,
# 而不需要通过AUTH命令提供任何密码。否则,如果“default”用户没有标记为“nopass”,
# 则连接将在not authenticated状态下启动,并且需要AUTH(或HELLO命令AUTH选项)才能进行身份验证并开始工作。
#
# The ACL rules that describe what an user can do are the following:
# 描述用户可以做什么的ACL规则如下:
#
# on Enable the user: it is possible to authenticate as this user.
# 启用用户:可以作为该用户进行身份验证。
# off Disable the user: it's no longer possible to authenticate
# with this user, however the already authenticated connections
# will still work.
# 禁用该用户:不再可能对该用户进行身份验证,但是已经通过身份验证的连接仍然可以工作。
# +<command> Allow the execution of that command
# 允许执行该命令
# -<command> Disallow the execution of that command
# 不允许执行该命令
# +@<category> Allow the execution of all the commands in such category
# with valid categories are like @admin, @set, @sortedset, ...
# and so forth, see the full list in the server.c file where
# the Redis command table is described and defined.
# The special category @all means all the commands, but currently
# present in the server, and that will be loaded in the future
# via modules.
# 允许执行有效类别中的所有命令,如@admin, @set, @sortedset,…等等,在server.c文件中可以看到完整的列表,其中描述和定义了Redis命令表。特殊类别@all表示所有命令,但目前是这样
# 目前在服务器,并将在未来通过模块加载。
# +<command>|subcommand Allow a specific subcommand of an otherwise
# disabled command. Note that this form is not
# allowed as negative like -DEBUG|SEGFAULT, but
# only additive starting with "+".
# 允许else的特定子命令
# 禁用命令。注意,此表单不是
# 允许象-DEBUG|分段故障,但是
# 只有以“+”开头的加法。
# allcommands Alias for +@all. Note that it implies the ability to execute
# all the future commands loaded via the modules system.
# allcommands + @all别名。注意,这意味着可以执行通过模块系统加载的所有未来命令。
# nocommands Alias for -@all.
# nocommands -@all别名。
# ~<pattern> Add a pattern of keys that can be mentioned as part of
# commands. For instance ~* allows all the keys. The pattern
# is a glob-style pattern like the one of KEYS.
# It is possible to specify multiple patterns.
# ~<pattern> 添加可以作为命令的一部分提及的键模式。例如~*允许所有的键。该模式是一个全局样式的模式,类似于密钥样式。可以指定多个模式。
# allkeys Alias for ~*
# allkeys 别名 for ~*
# resetkeys Flush the list of allowed keys patterns.
# 刷新允许的键模式列表。
# ><password> Add this passowrd to the list of valid password for the user.
# For example >mypass will add "mypass" to the list.
# This directive clears the "nopass" flag (see later).
# 将此passowrd添加到该用户的有效密码列表中。
# 例如,>mypass将添加“mypass”到列表中。
# 这个指令清除“nopass”标志(稍后见)。
# <<password> Remove this password from the list of valid passwords.
# 从有效密码列表中删除此密码。
#
# nopass All the set passwords of the user are removed, and the user
# is flagged as requiring no password: it means that every
# password will work against this user. If this directive is
# used for the default user, every new connection will be
# immediately authenticated with the default user without
# any explicit AUTH command required. Note that the "resetpass"
# directive will clear this condition.
# 删除该用户的所有设置密码,并将该用户标记为不需要密码:这意味着每个密码都将针对该用户工作。
# 如果该指令用于默认用户,则每个新连接都将立即使用默认用户进行身份验证
# 需要的任何显式AUTH命令。注意,“resetpass”指令将清除这个条件。
# resetpass Flush the list of allowed passwords. Moreover removes the
# "nopass" status. After "resetpass" the user has no associated
# passwords and there is no way to authenticate without adding
# some password (or setting it as "nopass" later).
# 刷新允许的密码列表。此外,删除“nopass”状态。在“resetpass”之后,用户没有相关的密码,
# 并且没有办法在不添加一些密码(或稍后将其设置为“nopass”)的情况下进行身份验证。
# reset Performs the following actions: resetpass, resetkeys, off,
# -@all. The user returns to the same state it has immediately
# after its creation.
# 执行以下操作:resetpass, resetkeys, off,-@all。用户立即返回到创建后的相同状态。
# ACL rules can be specified in any order: for instance you can start with
# passwords, then flags, or key patterns. However note that the additive
# and subtractive rules will CHANGE MEANING depending on the ordering.
# ACL规则可以按照任何顺序指定:例如,可以从密码开始,然后是标志或密钥模式。但是请注意,加法规则和减法规则将根据顺序改变含义。
# For instance see the following example:
# 例如,请看下面的例子:
# user alice on +@all -DEBUG ~* >somepassword
#
# This will allow "alice" to use all the commands with the exception of the
# DEBUG command, since +@all added all the commands to the set of the commands
# alice can use, and later DEBUG was removed. However if we invert the order
# of two ACL rules the result will be different:
# 这将允许“alice”使用除调试命令之外的所有命令,因为+@all将所有命令添加到alice可以使用的命令集中,随后的调试被删除。但是,如果我们倒转两个ACL规则的顺序,结果将不同:
# user alice on -DEBUG +@all ~* >somepassword
#
# Now DEBUG was removed when alice had yet no commands in the set of allowed
# commands, later all the commands are added, so the user will be able to
# execute everything.
# 现在,当alice在允许的命令集中还没有命令时,调试被删除,之后所有的命令都被添加,这样用户就可以执行所有的命令了。
#
# Basically ACL rules are processed left-to-right.
# ACL规则基本上是从左到右处理的。
# For more information about ACL configuration please refer to
# 有关ACL配置的更多信息,请参阅
# the Redis web site at https://redis.io/topics/acl
# Redis网站: https://redis.io/topics/acl
# ACL LOG
# ACL的日志
# The ACL Log tracks failed commands and authentication events associated
# with ACLs. The ACL Log is useful to troubleshoot failed commands blocked
# by ACLs. The ACL Log is stored in memory. You can reclaim memory with
# ACL LOG RESET. Define the maximum entry length of the ACL Log below.
# ACL日志跟踪与ACL关联的失败命令和身份验证事件。ACL日志对于排除ACL阻塞的失败命令非常有用。ACL日志存储在内存中。
# 您可以通过ACL日志重置收回内存。定义ACL日志的最大入口长度。
acllog-max-len 128
# Using an external ACL file
# 使用外部ACL文件
# Instead of configuring users here in this file, it is possible to use
# a stand-alone file just listing users. The two methods cannot be mixed:
# 不需要在此文件中配置用户,可以使用一个仅列出用户的独立文件。这两种方法不能混合使用:
# if you configure users here and at the same time you activate the exteranl
# ACL file, the server will refuse to start.
# 如果在这里配置用户,同时激活exteranl ACL文件,服务器将拒绝启动。
#
# The format of the external ACL user file is exactly the same as the
# format that is used inside redis.conf to describe users.
# 外部ACL用户文件的格式与在redis.conf中用于描述用户的格式完全相同。
# aclfile /etc/redis/users.acl
# IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatiblity
# layer on top of the new ACL system. The option effect will be just setting
# the password for the default user. Clients will still authenticate using
# AUTH <password> as usually, or more explicitly with AUTH default <password>
# if they follow the new protocol: both will work.
# 重要提示:从Redis 6开始,“requirepass”只是在新的ACL系统之上的一个兼容性层。
# 选项效果将只是设置默认用户的密码。客户端仍然会像往常一样使用AUTH 进行身份验证,
# 或者更明确地使用AUTH默认值,如果它们遵循新的协议:两者都可以工作。
# requirepass foobared
# Command renaming (DEPRECATED).
# 命令重命名(弃用)。
# ------------------------------------------------------------------------
# WARNING: avoid using this option if possible. Instead use ACLs to remove
# commands from the default user, and put them only in some admin user you
# create for administrative purposes.
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# 警告:尽可能避免使用此选项。相反,使用acl从默认用户中删除命令,并将它们仅放在为管理目的而创建的某个管理用户中。
# ------------------------------------------------------------------------
# It is possible to change the name of dangerous commands in a shared
# environment. For instance the CONFIG command may be renamed into something
# hard to guess so that it will still be available for internal-use tools
# but not available for general clients.
# 可以在共享环境中更改危险命令的名称。例如,CONFIG命令可能会被重命名为一些难以猜测的东西,
# 这样它仍然可以用于内部使用的工具,但不能用于一般的客户端。
#
# Example:
# 例子:
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# It is also possible to completely kill a command by renaming it into
# an empty string:
# 也有可能完全杀死一个命令重命名为一个空字符串:
# rename-command CONFIG ""
#
# Please note that changing the name of commands that are logged into the
# AOF file or transmitted to replicas may cause problems.
# 请注意,更改登录到AOF文件或传输到副本的命令的名称可能会导致问题。
################################### CLIENTS ####################################
# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# able to configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
# 同时设置连接的客户端的最大数量。默认情况下这个限制设置为10000个客户,但是如果复述,
# 服务器不能配置过程文件限制允许指定限制允许的最大数量的客户设置为当前文件限制
# - 32(复述,储备一些为内部使用文件描述符)。
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
# 一旦达到限制,Redis将关闭所有新连接发送一个错误'最大数量的客户端达到'。
# IMPORTANT: When Redis Cluster is used, the max number of connections is also
# shared with the cluster bus: every node in the cluster will use two
# connections, one incoming and another outgoing. It is important to size the
# limit accordingly in case of very large clusters.
# 重要提示:当使用Redis集群时,最大连接数也会与集群总线共享:集群中的每个节点将使用两个连接,
# 一个传入,另一个传出。对于非常大的集群,相应地调整限制的大小是很重要的。
# maxclients 10000
############################## MEMORY MANAGEMENT ################################
# Set a memory usage limit to the specified amount of bytes.
# 将内存使用限制设置为指定的字节数。
# When the memory limit is reached Redis will try to remove keys
# according to the eviction policy selected (see maxmemory-policy).
# 当达到内存限制时,Redis会根据所选的驱逐策略(参见maxmemory-policy)尝试删除键。
#
# If Redis can't remove keys according to the policy, or if the policy is
# set to 'noeviction', Redis will start to reply with errors to commands
# that would use more memory, like SET, LPUSH, and so on, and will continue
# to reply to read-only commands like GET.
# 如果Redis不能根据策略删除键,或者如果策略被设置为“noeviction”,Redis将开始回复会占用更多内存的命令错误,
# 如set、LPUSH等,并将继续回复只读命令,如GET。
#
# This option is usually useful when using Redis as an LRU or LFU cache, or to
# set a hard memory limit for an instance (using the 'noeviction' policy).
# 这个选项通常在使用Redis作为LRU或LFU缓存时有用,或者为实例设置硬内存限制(使用'noeviction'策略)。
#
# WARNING: If you have replicas attached to an instance with maxmemory on,
# the size of the output buffers needed to feed the replicas are subtracted
# from the used memory count, so that network problems / resyncs will
# not trigger a loop where keys are evicted, and in turn the output
# buffer of replicas is full with DELs of keys evicted triggering the deletion
# of more keys, and so forth until the database is completely emptied.
# 警告:如果你有副本附加到一个实例与maxmemory,输出缓冲区的大小需要喂副本使用内存数相减时,
# 这网络问题/同步不会触发一个键被驱逐的循环,进而副本的输出缓冲区满del键驱逐触发的删除键,
# 直到完全清空数据库等等。
# In short... if you have replicas attached it is suggested that you set a lower
# limit for maxmemory so that there is some free RAM on the system for replica
# output buffers (but this is not needed if the policy is 'noeviction').
# 总之……如果您附加了副本,建议您为maxmemory设置一个下限,
# 以便在系统上有一些空闲RAM用于副本输出缓冲区(但如果策略是‘noeviction’,则不需要这样做)。
# maxmemory <bytes>
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select one from the following behaviors:
# MAXMEMORY策略:当达到MAXMEMORY时,Redis将如何选择删除什么。你可以从以下行为中选择一个:
#
# volatile-lru -> Evict using approximated LRU, only keys with an expire set.
# 仅使用带过期集的密钥,使用近似的LRU进行驱逐。
# allkeys-lru -> Evict any key using approximated LRU.
# 使用近似的LRU驱逐任何密钥。
# volatile-lfu -> Evict using approximated LFU, only keys with an expire set.
# 使用近似的LRU驱逐任何密钥。
# allkeys-lfu -> Evict any key using approximated LFU.
# 使用近似的LFU驱逐任何密钥。
# volatile-random -> Remove a random key having an expire set.
# 删除具有过期集的随机键。
# allkeys-random -> Remove a random key, any key.
# 删除一个随机的键,任何键。
# volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
# 删除最近过期时间的密钥(较小的TTL)
# noeviction -> Don't evict anything, just return an error on write operations.
# 不驱逐任何东西,只是在写操作上返回一个错误。
# LRU means Least Recently Used
# LRU是最近最少使用的
# LFU means Least Frequently Used
# LFU的意思是使用频率最低
# Both LRU, LFU and volatile-ttl are implemented using approximated
# randomized algorithms.
# LRU、LFU和挥发-ttl均采用近似随机化算法实现。
#
# Note: with any of the above policies, Redis will return an error on write
# operations, when there are no suitable keys for eviction.
# 注意:使用上述任何策略,当没有合适的键用于驱逐时,Redis会在写操作时返回一个错误。
#
#
# At the date of writing these commands are: set setnx setex append
# 在编写的日期,这些命令是:
# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
# getset mset msetnx exec sort
#
# The default is:
# 默认的是:
# maxmemory-policy noeviction
# LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated
# algorithms (in order to save memory), so you can tune it for speed or
# accuracy. For default Redis will check five keys and pick the one that was
# used less recently, you can change the sample size using the following
# configuration directive.
# LRU、LFU和最小TTL算法不是精确算法,而是近似算法(为了节省内存),因此您可以调整它以提高速度或精度。
# 对于默认Redis将检查五个键,并选择一个最近使用较少,你可以改变样本大小使用以下配置指令。
# The default of 5 produces good enough results. 10 Approximates very closely
# true LRU but costs more CPU. 3 is faster but not very accurate.
# 默认为5会产生足够好的结果。10非常接近真实的LRU,但需要更多的CPU。3更快,但不是很准确。
# maxmemory-samples 5
# Starting from Redis 5, by default a replica will ignore its maxmemory setting
# (unless it is promoted to master after a failover or manually). It means
# that the eviction of keys will be just handled by the master, sending the
# DEL commands to the replica as keys evict in the master side.
# 从redis5开始,默认情况下副本会忽略它的maxmemory设置(除非它在故障转移后被提升为master或手动)。
# 这意味着键的回收将由主服务器处理,在主服务器端键被回收时将DEL命令发送给副本。
# This behavior ensures that masters and replicas stay consistent, and is usually
# what you want, however if your replica is writable, or you want the replica
# to have a different memory setting, and you are sure all the writes performed
# to the replica are idempotent, then you may change this default (but be sure
# to understand what you are doing).
# 这种行为保持一致,确保大师和复制品,通常是你想要的,但是如果你的复制品是可写的,
# 或者你想要复制不同的内存设置,和你确定都将执行写入副本是等幂的,
# 然后你可能会改变这种默认(但一定要了解你在做什么)。
#
# Note that since the replica by default does not evict, it may end using more
# memory than the one set via maxmemory (there are certain buffers that may
# be larger on the replica, or data structures may sometimes take more memory
# and so forth). So make sure you monitor your replicas and make sure they
# have enough memory to never hit a real out-of-memory condition before the
# master hits the configured maxmemory setting.
# 注意,由于副本在默认情况下不会驱逐,因此它最终使用的内存可能比通过maxmemory设置的一组内存更多(副本上的某些缓冲区可能更大,
# 或者数据结构有时可能占用更多内存等等)。
# 因此,请确保您监视您的副本,并确保它们有足够的内存,在主服务器达到配置的maxmemory设置之前,
# 不会出现真正的内存不足情况。
# replica-ignore-maxmemory yes
# Redis reclaims expired keys in two ways: upon access when those keys are
# found to be expired, and also in background, in what is called the
# "active expire key". The key space is slowly and interactively scanned
# looking for expired keys to reclaim, so that it is possible to free memory
# of keys that are expired and will never be accessed again in a short time.
# Redis以两种方式回收过期的密钥:在访问时发现过期的密钥,以及在后台,在所谓的“活动过期密钥”。
# 密钥空间被缓慢而交互式地扫描,以寻找要回收的过期密钥,
# 这样就可以释放过期且在短时间内再也不会被访问的密钥的内存。
# The default effort of the expire cycle will try to avoid having more than
# ten percent of expired keys still in memory, and will try to avoid consuming
# more than 25% of total memory and to add latency to the system. However
# it is possible to increase the expire "effort" that is normally set to
# "1", to a greater value, up to the value "10". At its maximum value the
# system will use more CPU, longer cycles (and technically may introduce
# more latency), and will tollerate less already expired keys still present
# in the system. It's a tradeoff betweeen memory, CPU and latecy.
# 过期周期的默认努力将试图避免在内存中仍然有超过10%的过期密钥,
# 并试图避免消耗总内存的25%以上,并增加系统的延迟。但是,
# 可以将通常设置为“1”的过期“努力”增加到更大的值,直到值“10”。
# 在它的最大值,系统将使用更多的CPU,更长的周期(技术上可能引入更多的延迟),
# 并将减少系统中仍然存在的已经过期的密钥。这是内存、CPU和内存之间的权衡。
# active-expire-effort 1
############################# LAZY FREEING ####################################
# Redis has two primitives to delete keys. One is called DEL and is a blocking
# deletion of the object. It means that the server stops processing new commands
# in order to reclaim all the memory associated with an object in a synchronous
# way. If the key deleted is associated with a small object, the time needed
# in order to execute the DEL command is very small and comparable to most other
# O(1) or O(log_N) commands in Redis. However if the key is associated with an
# aggregated value containing millions of elements, the server can block for
# a long time (even seconds) in order to complete the operation.
# Redis有两个原语来删除键。一个是DEL,它是对象的阻塞删除。
# 这意味着服务器停止处理新命令,以同步方式收回与一个对象关联的所有内存。
# 如果删除的键与一个小对象相关联,那么执行DEL命令所需的时间非常小,
# 可以与Redis中的大多数O(1)或O(log_N)命令相媲美。但是,如果键与包含数百万个元素的聚合值相关联,
# 服务器可能会阻塞很长时间(甚至几秒钟)以完成操作。
# For the above reasons Redis also offers non blocking deletion primitives
# such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and
# FLUSHDB commands, in order to reclaim memory in background. Those commands
# are executed in constant time. Another thread will incrementally free the
# object in the background as fast as possible.
# DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled.
# It's up to the design of the application to understand when it is a good
# idea to use one or the other. However the Redis server sometimes has to
# delete keys or flush the whole database as a side effect of other operations.
# Specifically Redis deletes objects independently of a user call in the
# 基于上述原因,Redis还提供了非阻塞删除原语,如UNLINK(非阻塞DEL)和异步选项的FLUSHALL和FLUSHDB命令,
# 以便在后台回收内存。这些命令在固定的时间内执行。另一个线程将在后台以尽可能快的速度递增地释放对象。
# 然而,Redis服务器有时不得不删除键或刷新整个数据库作为其他操作的副作用
# 特别是Redis删除对象独立于用户调用
# following scenarios:
# 下面的场景:
#
# 1) On eviction, because of the maxmemory and maxmemory policy configurations,
# in order to make room for new data, without going over the specified
# memory limit.
# 在回收时,由于maxmemory和maxmemory策略配置,为了在不超过指定内存限制的情况下为新数据腾出空间。
# 2) Because of expire: when a key with an associated time to live (see the
# EXPIRE command) must be deleted from memory.
# 由于expire:当必须从内存中删除具有关联生存时间的键(参见expire命令)时。
# 3) Because of a side effect of a command that stores data on a key that may
# already exist. For example the RENAME command may delete the old key
# content when it is replaced with another one. Similarly SUNIONSTORE
# or SORT with STORE option may delete existing keys. The SET command
# itself removes any old content of the specified key in order to replace
# it with the specified string.
# 这是因为将数据存储在可能已经存在的键上的命令的副作用。
# 例如,RENAME命令可能会在用另一个键替换旧键内容时删除它。
# 类似的,SUNIONSTORE或SORT with STORE选项可以删除现有的键。
# SET命令本身删除指定键的任何旧内容,以便将其替换为指定的字符串。
# 4) During replication, when a replica performs a full resynchronization with
# its master, the content of the whole database is removed in order to
# load the RDB file just transferred.
# 在复制期间,当一个副本与它的主服务器执行完全的重新同步时,整个数据库的内容将被删除,以便加载刚刚传输的RDB文件。
#
# In all the above cases the default is to delete objects in a blocking way,
# like if DEL was called. However you can configure each case specifically
# in order to instead release memory in a non-blocking way like if UNLINK
# was called, using the following configuration directives.
# 在上述所有情况下,默认情况是以阻塞的方式删除对象,比如调用DEL。但是,您可以具体配置每种情况,
# 以便以非阻塞的方式释放内存,比如在UNLINK被调用时,使用以下配置指令。
#
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
# It is also possible, for the case when to replace the user code DEL calls
# with UNLINK calls is not easy, to modify the default behavior of the DEL
# command to act exactly like UNLINK, using the following configuration
# 对于替换用户代码DEL调用的情况,也可以这样做
# 使用UNLINK调用是不容易的,要修改DEL的默认行为
# 命令使用以下配置执行与UNLINK完全相同的操作
#
# directive:
# 指令:
lazyfree-lazy-user-del no
################################ THREADED I/O #################################
# Redis is mostly single threaded, however there are certain threaded
# operations such as UNLINK, slow I/O accesses and other things that are
# performed on side threads.
# Redis大部分是单线程的,但是也有一些线程操作,如解除链接,缓慢的I/O访问和其他事情是在侧线程上执行的。
#
# Now it is also possible to handle Redis clients socket reads and writes
# in different I/O threads. Since especially writing is so slow, normally
# Redis users use pipelining in order to speedup the Redis performances per
# core, and spawn multiple instances in order to scale more. Using I/O
# threads it is possible to easily speedup two times Redis without resorting
# to pipelining nor sharding of the instance.
# 现在它也可以处理Redis客户端套接字读写在不同的I/O线程。特别是写代码是如此的慢,
# 通常Redis用户使用流水线来提高每个核的Redis性能,并衍生多个实例来扩大规模。使用I / O
# 线程可以很容易地将Redis速度提高两倍,而不需要求助于实例的流水线或分片。
# By default threading is disabled, we suggest enabling it only in machines
# that have at least 4 or more cores, leaving at least one spare core.
# 默认情况下,线程是禁用的,我们建议仅在拥有至少4个或更多核的机器上启用它,至少留下一个备用核。
# Using more than 8 threads is unlikely to help much. We also recommend using
# threaded I/O only if you actually have performance problems, with Redis
# instances being able to use a quite big percentage of CPU time, otherwise
# there is no point in using this feature.
# 使用超过8个线程不太可能有太大帮助。我们还建议只有在你确实有性能问题的时候才使用线程I/O,
# 因为Redis实例能够使用相当大百分比的CPU时间,否则使用这个特性就没有意义了。
# So for instance if you have a four cores boxes, try to use 2 or 3 I/O
# threads, if you have a 8 cores, try to use 6 threads. In order to
# enable I/O threads use the following configuration directive:
# 例如,如果你有一个4核的盒子,尝试使用2或3个I/O线程,如果你有8核,尝试使用6个线程。为了使I/O线程使用以下配置指令:
#
# io-threads 4
#
# Setting io-threads to 1 will just use the main thread as usually.
# 将io-threads设置为1只会像往常一样使用主线程。
# When I/O threads are enabled, we only use threads for writes, that is
# to thread the write(2) syscall and transfer the client buffers to the
# socket. However it is also possible to enable threading of reads and
# protocol parsing using the following configuration directive, by setting
# it to yes:
# 当启用I/O线程时,我们只使用线程进行写操作,也就是执行写(2)系统调用并将客户端缓冲区传输到套接字。
# 然而,也有可能启用线程读取和协议解析使用以下配置指令,通过设置为yes:
#
# io-threads-do-reads no
#
# Usually threading reads doesn't help much.
# 通常,线程读取没有多大帮助。
# NOTE 1: This configuration directive cannot be changed at runtime via
# CONFIG SET. Aso this feature currently does not work when SSL is
# enabled.
# 注意1:这个配置指令不能在运行时通过配置设置来改变。
#
# NOTE 2: If you want to test the Redis speedup using redis-benchmark, make
# sure you also run the benchmark itself in threaded mode, using the
# --threads option to match the number of Redis theads, otherwise you'll not
# be able to notice the improvements.
# 注2:如果你想用Redis -benchmark测试Redis加速,请确保你也在线程模式下运行基准测试,
# 使用——threads选项来匹配Redis头的数量,否则你将无法注意到改进。
############################## APPEND ONLY MODE ###############################
# By default Redis asynchronously dumps the dataset on disk. This mode is
# good enough in many applications, but an issue with the Redis process or
# a power outage may result into a few minutes of writes lost (depending on
# the configured save points).
# 默认情况下,Redis异步转储数据集到磁盘上。这种模式在许多应用程序中已经足够好了,
# 但Redis进程的问题或断电可能会导致几分钟的写丢失(取决于配置的保存点)。
# The Append Only File is an alternative persistence mode that provides
# much better durability. For instance using the default data fsync policy
# (see later in the config file) Redis can lose just one second of writes in a
# dramatic event like a server power outage, or a single write if something
# wrong with the Redis process itself happens, but the operating system is
# still running correctly.
# Append Only文件是另一种持久性模式,它提供了更好的持久性。
# 例如,使用默认的fsync数据策略(见配置文件后面),Redis可以在一个戏剧性的事件中失去1秒的写操作,
# 比如服务器断电,或者如果发生了什么事情,会丢失一次写操作
# Redis进程本身发生了错误,但操作系统仍然正常运行。
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
# AOF和RDB持久性可以同时启用而没有问题。
# 如果在启动时启用了AOF, Redis将加载AOF,
# 这是一个更好的持久性保证文件。
# Please check http://redis.io/topics/persistence for more information.
# 请检查http://redis.io/topics/persistence了解更多信息。
appendonly no
# The name of the append only file (default: "appendonly.aof")
# 只追加文件的名称(默认为“appendonly.aof”)
appendfilename "appendonly.aof"
# The fsync() call tells the Operating System to actually write data on disk
# instead of waiting for more data in the output buffer. Some OS will really flush
# data on disk, some other OS will just try to do it ASAP.
# fsync()调用告诉操作系统在磁盘上实际写入数据,而不是等待输出缓冲区中的更多数据。
# 一些操作系统会真正刷新磁盘上的数据,而另一些操作系统会尝试尽快这么做。
# Redis supports three different modes:
# Redis支持三种不同的模式:
#
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# 不要fsync,让操作系统在需要的时候刷新数据。得更快。
# always: fsync after every write to the append only log. Slow, Safest.
# fsync在每次写入append only日志后执行。缓慢的,安全的。
# everysec: fsync only one time every second. Compromise.
# fsync每秒只进行一次。妥协。
#
# The default is "everysec", as that's usually the right compromise between
# speed and data safety. It's up to you to understand if you can relax this to
# "no" that will let the operating system flush the output buffer when
# it wants, for better performances (but if you can live with the idea of
# some data loss consider the default persistence mode that's snapshotting),
# or on the contrary, use "always" that's very slow but a bit safer than
# everysec.
# 默认值是“每秒钟”,因为这通常是速度和数据安全之间的折中。
# 由你理解如果你能放松这个“不”字,让操作系统刷新输出缓冲区时,
# 为了更好的表现(但是如果你可以忍受一些数据丢失的想法考虑默认快照的持久性模式),
# 或相反,使用“总是”非常缓慢但比everysec更安全一点。
# More details please check the following article:
# 更多细节请查看下面的文章:
# http://antirez.com/post/redis-persistence-demystified.html
#
# If unsure, use "everysec".
# 如果不确定,请使用“everysec”。
# appendfsync always
appendfsync everysec
# appendfsync no
# When the AOF fsync policy is set to always or everysec, and a background
# saving process (a background save or AOF log background rewriting) is
# performing a lot of I/O against the disk, in some Linux configurations
# Redis may block too long on the fsync() call. Note that there is no fix for
# this currently, as even performing fsync in a different thread will block
# our synchronous write(2) call.
# 当AOF fsync策略设置为always或every秒,并且后台保存进程(后台保存或AOF日志后台重写)对磁盘执行大量I/O操作时,
# 在一些Linux配置中,Redis可能会在fsync()调用上阻塞太长时间。
# 注意,这个问题目前还没有解决办法,因为即使在不同的线程中执行fsync,也会阻塞我们的同步写(2)调用。
# In order to mitigate this problem it's possible to use the following option
# that will prevent fsync() from being called in the main process while a
# BGSAVE or BGREWRITEAOF is in progress.
# 为了减轻这个问题,可以使用以下选项来防止在执行BGSAVE或BGREWRITEAOF时在主进程中调用fsync()
#
# This means that while another child is saving, the durability of Redis is
# the same as "appendfsync none". In practical terms, this means that it is
# possible to lose up to 30 seconds of log in the worst scenario (with the
# default Linux settings).
# 这意味着,当另一个孩子正在保存,Redis的持久性是相同的“appendfsync none”。实际上,
# 这意味着在最坏的情况下(使用默认的Linux设置)可能会丢失最多30秒的日志。
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
# 如果有延迟问题,请将此选项转换为“yes”。否则,从耐久性的角度来看,这是最安全的选择。
no-appendfsync-on-rewrite no
# Automatic rewrite of the append only file.
# Redis is able to automatically rewrite the log file implicitly calling
# BGREWRITEAOF when the AOF log size grows by the specified percentage.
# 自动重写仅追加的文件。Redis能够自动重写日志文件隐式调用BGREWRITEAOF时,AOF日志大小增长指定的百分比。
#
# This is how it works: Redis remembers the size of the AOF file after the
# latest rewrite (if no rewrite has happened since the restart, the size of
# the AOF at startup is used).
# 这是它的工作方式:Redis记住大小的AOF文件后,最近的重写(如果没有重写,在重启后,AOF的大小在启动时使用)。
#
# This base size is compared to the current size. If the current size is
# bigger than the specified percentage, the rewrite is triggered. Also
# you need to specify a minimal size for the AOF file to be rewritten, this
# is useful to avoid rewriting the AOF file even if the percentage increase
# is reached but it is still pretty small.
# 此基本大小与当前大小进行比较。如果当前大小大于指定的百分比,就会触发重写。
# 您还需要指定要重写的AOF文件的最小大小,这有助于避免重写AOF文件,即使达到百分比增长,但它仍然很小。
# Specify a percentage of zero in order to disable the automatic AOF
# rewrite feature.
#指定一个百分比为零,以禁用自动AOF
#重写特性。
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
# An AOF file may be found to be truncated at the end during the Redis
# startup process, when the AOF data gets loaded back into memory.
# This may happen when the system where Redis is running
# crashes, especially when an ext4 filesystem is mounted without the
# data=ordered option (however this can't happen when Redis itself
# crashes or aborts but the operating system still works correctly).
# 一个AOF文件可能会被发现被截断在结束期间,在Redis启动过程中,当AOF数据被加载回内存。
# 这可能会发生在Redis运行的系统崩溃时,特别是ext4文件系统在没有data=ordered选项的情况下挂载
# (然而,这不会发生在Redis本身崩溃或中止但操作系统仍然正常工作时)。
# Redis can either exit with an error when this happens, or load as much
# data as possible (the default now) and start if the AOF file is found
# to be truncated at the end. The following option controls this behavior.
# Redis可以退出一个错误时,这发生,或加载尽可能多的数据(现在默认),
# 并开始如果AOF文件被发现被截断在结束。以下选项控制此行为。
# If aof-load-truncated is set to yes, a truncated AOF file is loaded and
# the Redis server starts emitting a log to inform the user of the event.
# Otherwise if the option is set to no, the server aborts with an error
# and refuses to start. When the option is set to no, the user requires
# to fix the AOF file using the "redis-check-aof" utility before to restart
# the server.
# 如果AOF -load-truncated设置为yes,则加载一个截断的AOF文件并
# Redis服务器开始发送日志通知用户事件。否则,如果将该选项设置为no,服务器将以错误终止并拒绝启动。
# 当选项设置为no时,用户需要在重启服务器之前使用“redis-check-aof”实用程序修复AOF文件。
# Note that if the AOF file will be found to be corrupted in the middle
# the server will still exit with an error. This option only applies when
# Redis will try to read more data from the AOF file but not enough bytes
# will be found.
# 注意,如果发现AOF文件在中间损坏,服务器仍然会退出并出现错误。
# 这个选项只适用于当Redis将尝试读取更多的数据从AOF文件,但没有足够的字节将被发现。
aof-load-truncated yes
# When rewriting the AOF file, Redis is able to use an RDB preamble in the
# AOF file for faster rewrites and recoveries. When this option is turned
# on the rewritten AOF file is composed of two different stanzas:
# 当重写AOF文件,Redis能够使用一个RDB序言在AOF文件更快的重写和恢复。
# 当这个选项被打开时,重写的AOF文件由两个不同的节组成:
# [RDB file][AOF tail]
#
# When loading Redis recognizes that the AOF file starts with the "REDIS"
# string and loads the prefixed RDB file, and continues loading the AOF
# tail.
# 当加载Redis识别AOF文件开始与“Redis”
# 字符串并加载带前缀的RDB文件,并继续加载AOF尾部。
aof-use-rdb-preamble yes
################################ LUA SCRIPTING ###############################
# Max execution time of a Lua script in milliseconds.
# Lua脚本的最大执行时间(毫秒)。
#
# If the maximum execution time is reached Redis will log that a script is
# still in execution after the maximum allowed time and will start to
# reply to queries with an error.
# 如果达到最大执行时间,Redis会记录下一个脚本仍然在执行后的最大允许的时间,并开始回答查询与一个错误。
# When a long running script exceeds the maximum execution time only the
# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
# used to stop a script that did not yet called write commands. The second
# is the only way to shut down the server in the case a write command was
# already issued by the script but the user doesn't want to wait for the natural
# termination of the script.
# 当长时间运行的脚本超过最大执行时间时,只有脚本KILL和SHUTDOWN NOSAVE命令可用。
# 第一种方法可用于停止尚未调用write命令的脚本。
# 第二种方法是在脚本已经发出写命令但用户不希望等待脚本自然终止的情况下关闭服务器的唯一方法。
# Set it to 0 or a negative value for unlimited execution without warnings.
# 如果将其设置为0或负值,则可以无限制执行而没有警告。
lua-time-limit 5000
################################ REDIS CLUSTER ###############################
# Normal Redis instances can't be part of a Redis Cluster; only nodes that are
# started as cluster nodes can. In order to start a Redis instance as a
# cluster node enable the cluster support uncommenting the following:
# 正常的Redis实例不能成为Redis集群的一部分;只有作为集群节点启动的节点可以。
# 为了启动一个Redis实例作为集群节点启用集群支持取消评论如下:
# cluster-enabled yes
# Every cluster node has a cluster configuration file. This file is not
# intended to be edited by hand. It is created and updated by Redis nodes.
# Every Redis Cluster node requires a different cluster configuration file.
# Make sure that instances running in the same system do not have
# overlapping cluster configuration file names.
# 每个集群节点都有一个集群配置文件。此文件不用于手工编辑。它是由Redis节点创建和更新的。
# 每个Redis集群节点需要一个不同的集群配置文件。
# 确保在同一系统中运行的实例不具有重叠的集群配置文件名。
# cluster-config-file nodes-6379.conf
# Cluster node timeout is the amount of milliseconds a node must be unreachable
# for it to be considered in failure state.
# 群集节点超时是指一个节点无法到达的毫秒数,从而将其视为处于故障状态。
# Most other internal time limits are multiple of the node timeout.
# 大多数其他内部时间限制是节点超时的多个倍。
#
# cluster-node-timeout 15000
# A replica of a failing master will avoid to start a failover if its data
# looks too old.
# 失败主服务器的副本将避免在数据看起来太旧时启动故障转移。
# There is no simple way for a replica to actually have an exact measure of
# its "data age", so the following two checks are performed:
# 没有一种简单的方法可以让副本真正精确地测量它的“数据年龄”,因此执行以下两个检查:
#
# 1) If there are multiple replicas able to failover, they exchange messages
# in order to try to give an advantage to the replica with the best
# replication offset (more data from the master processed).
# Replicas will try to get their rank by offset, and apply to the start
# of the failover a delay proportional to their rank.
# 1) 如果有多个副本可以进行故障转移,它们会交换消息,
# 以便给具有最佳复制偏移量的副本带来优势(来自被处理的主服务器的更多数据)。
# 副本将尝试通过偏移量获得它们的级别,并在故障转移开始时应用与它们的级别成比例的延迟。
# 2) Every single replica computes the time of the last interaction with
# its master. This can be the last ping or command received (if the master
# is still in the "connected" state), or the time that elapsed since the
# disconnection with the master (if the replication link is currently down).
# If the last interaction is too old, the replica will not try to failover
# at all.
# 2) 每个副本计算最后一次与主人交互的时间。
# 这可以是接收到的最后一个ping或命令(如果主服务器仍然处于“connected”状态),
# 或者是自与主服务器断开连接以来所经过的时间(如果复制链接当前处于关闭状态)。
# 如果最后一个交互太旧,副本根本不会尝试故障转移。
# The point "2" can be tuned by user. Specifically a replica will not perform
# the failover if, since the last interaction with the master, the time
# elapsed is greater than:
# 点“2”可由用户调校。具体来说,如果自上次与主服务器交互以来,经过的时间大于:
#
# (node-timeout * replica-validity-factor) + repl-ping-replica-period
#
# So for example if node-timeout is 30 seconds, and the replica-validity-factor
# is 10, and assuming a default repl-ping-replica-period of 10 seconds, the
# replica will not try to failover if it was not able to talk with the master
# for longer than 310 seconds.
# 因此,例如,如果节点超时为30秒,复制有效性因子为10,并假设默认的复制-复制周期为10秒,
# 那么如果副本无法与主服务器对话的时间超过310秒,则不会尝试进行故障转移。
#
# A large replica-validity-factor may allow replicas with too old data to failover
# a master, while a too small value may prevent the cluster from being able to
# elect a replica at all.
# 较大的副本有效性因子可能会使数据太旧的副本无法转移主服务器,而太小的值可能会使集群根本无法选择副本
#
# For maximum availability, it is possible to set the replica-validity-factor
# to a value of 0, which means, that replicas will always try to failover the
# master regardless of the last time they interacted with the master.
# (However they'll always try to apply a delay proportional to their
# offset rank).
# 为了获得最大的可用性,可以将副本有效性因子设置为0,这意味着副本将始终尝试对主服务器进行故障转移,
# 而不管它们上一次与主服务器交互是什么时候。
# (然而,他们总是试图应用一个与他们的偏移秩成比例的延迟)。
# Zero is the only value able to guarantee that when all the partitions heal
# the cluster will always be able to continue.
# 0是唯一能够保证所有分区恢复后集群始终能够继续运行的值。
#
# cluster-replica-validity-factor 10
# Cluster replicas are able to migrate to orphaned masters, that are masters
# that are left without working replicas. This improves the cluster ability
# to resist to failures as otherwise an orphaned master can't be failed over
# in case of failure if it has no working replicas.
# 集群副本能够迁移到孤立的主服务器,即没有工作副本的主服务器。这提高了集群抵抗故障的能力,
# 否则,在出现故障时,如果孤立的主服务器没有工作副本,则无法进行故障转移。
# Replicas migrate to orphaned masters only if there are still at least a
# given number of other working replicas for their old master. This number
# is the "migration barrier". A migration barrier of 1 means that a replica
# will migrate only if there is at least 1 other working replica for its master
# and so forth. It usually reflects the number of replicas you want for every
# master in your cluster.
# 只有当它们的旧主服务器仍然至少有给定数量的其他工作副本时,
# 副本才会迁移到孤立的主服务器。这个数字就是“移民障碍”。
# 迁移障碍为1意味着一个副本只有在其主副本至少有1个工作副本时才会迁移,以此类推。
# 它通常反映集群中每个主服务器所需的副本数量。
# Default is 1 (replicas migrate only if their masters remain with at least
# one replica). To disable migration just set it to a very large value.
# A value of 0 can be set but is useful only for debugging and dangerous
# in production.
# 默认值是1(只有当它们的主副本保留至少一个副本时,副本才会迁移)。要禁用迁移,只需将其设置为一个非常大的值。
# 可以设置值0,但这只对调试有用,在生产中会有危险。
#
# cluster-migration-barrier 1
# By default Redis Cluster nodes stop accepting queries if they detect there
# is at least an hash slot uncovered (no available node is serving it).
# 默认情况下,如果Redis集群节点检测到至少有一个散列槽未覆盖(没有可用节点为其服务),则停止接受查询。
# This way if the cluster is partially down (for example a range of hash slots
# are no longer covered) all the cluster becomes, eventually, unavailable.
# 这样,如果集群部分关闭(例如不再覆盖一段散列槽),那么最终所有集群都将不可用。
# It automatically returns available as soon as all the slots are covered again.
# 当所有插槽再次被覆盖时,它自动返回可用。
#
# However sometimes you want the subset of the cluster which is working,
# to continue to accept queries for the part of the key space that is still
# covered. In order to do so, just set the cluster-require-full-coverage
# option to no.
# 但是,有时您希望正在工作的集群子集继续接受仍然覆盖的键空间部分的查询。
# 为此,只需将集群-require-full-coverage选项设置为no。
#
# cluster-require-full-coverage yes
# This option, when set to yes, prevents replicas from trying to failover its
# master during master failures. However the master can still perform a
# manual failover, if forced to do so.
# 当将此选项设置为yes时,可防止副本在主服务器出现故障时试图转移其主服务器。
# 但是,如果被迫,主服务器仍然可以执行手动故障转移。
# This is useful in different scenarios, especially in the case of multiple
# data center operations, where we want one side to never be promoted if not
# in the case of a total DC failure.
# 这在不同的场景中非常有用,特别是在多个数据中心操作的情况下,
# 如果在完全DC故障的情况下,我们希望其中一侧永远不会得到提升。
# cluster-replica-no-failover no
# This option, when set to yes, allows nodes to serve read traffic while the
# the cluster is in a down state, as long as it believes it owns the slots.
# 当将此选项设置为yes时,只要集群认为自己拥有这些槽,就允许节点在集群处于down状态时提供读流量。
#
# This is useful for two cases. The first case is for when an application
# doesn't require consistency of data during node failures or network partitions.
# 这在两种情况下有用。第一种情况是应用程序在节点故障或网络分区期间不需要数据一致性。
# One example of this is a cache, where as long as the node has the data it
# should be able to serve it.
# 其中一个例子就是缓存,只要节点拥有数据,它就应该能够提供数据。
#
# The second use case is for configurations that don't meet the recommended
# three shards but want to enable cluster mode and scale later. A
# master outage in a 1 or 2 shard configuration causes a read/write outage to the
# entire cluster without this option set, with it set there is only a write outage.
# Without a quorum of masters, slot ownership will not change automatically.
# 第二个用例用于不满足推荐的三个切分,但希望启用集群模式并稍后扩展的配置。
# 1或2分片配置中的主中断会导致整个集群在没有设置此选项的情况下出现读/写中断,设置此选项后,
# 只有写中断。没有主控的法定人数,插槽所有权将不会自动更改。
# cluster-allow-reads-when-down no
# In order to setup your cluster make sure to read the documentation
# 为了设置您的集群,请务必阅读文档
# available at http://redis.io web site.
# 可以在 http://redis.io 网站。
########################## CLUSTER DOCKER/NAT support ########################
# In certain deployments, Redis Cluster nodes address discovery fails, because
# addresses are NAT-ted or because ports are forwarded (the typical case is
# Docker and other containers).
# 在某些部署中,Redis集群节点的地址发现失败,因为地址被分配或因为端口被转发(典型的情况是Docker和其他容器)。
#
# In order to make Redis Cluster working in such environments, a static
# configuration where each node knows its public address is needed. The
# following two options are used for this scope, and are:
# 为了让Redis集群在这样的环境下工作,需要一个静态配置,
# 每个节点都知道自己的公共地址。以下两个选项用于此范围,它们是:
# * cluster-announce-ip
# * cluster-announce-port
# * cluster-announce-bus-port
#
# Each instruct the node about its address, client port, and cluster message
# bus port. The information is then published in the header of the bus packets
# so that other nodes will be able to correctly map the address of the node
# publishing the information.
# 每个节点指示其地址、客户端端口和集群消息总线端口。然后在总线包的头中发布信息,
# 以便其他节点能够正确地映射发布信息的节点的地址。
# If the above options are not used, the normal Redis Cluster auto-detection
# will be used instead.
# 如果不使用以上选项,将使用正常的Redis集群自动检测代替。
#
# Note that when remapped, the bus port may not be at the fixed offset of
# clients port + 10000, so you can specify any port and bus-port depending
# on how they get remapped. If the bus-port is not set, a fixed offset of
# 10000 will be used as usually.
# 请注意,在重新映射时,总线端口可能不在客户端端口+ 10000的固定偏移量处,
# 因此您可以根据重新映射的方式指定任何端口和总线端口。
# 如果总线端口没有设置,则通常使用10000的固定偏移量。
# Example:
# 例子:
# cluster-announce-ip 10.1.1.5
# cluster-announce-port 6379
# cluster-announce-bus-port 6380
################################## SLOW LOG ###################################
# The Redis Slow Log is a system to log queries that exceeded a specified
# execution time. The execution time does not include the I/O operations
# like talking with the client, sending the reply and so forth,
# but just the time needed to actually execute the command (this is the only
# stage of command execution where the thread is blocked and can not serve
# other requests in the meantime).
# Redis慢日志是一个记录超过指定执行时间的查询的系统。执行时间不包括I/O操作,如与客户端对话、发送应答等等,
# 而仅仅是实际执行命令所需的时间(这是命令执行中唯一的线程被阻塞且不能同时服务其他请求的阶段)
# You can configure the slow log with two parameters: one tells Redis
# what is the execution time, in microseconds, to exceed in order for the
# command to get logged, and the other parameter is the length of the
# slow log. When a new command is logged the oldest one is removed from the
# queue of logged commands.
# 你可以用两个参数来配置慢日志:一个参数告诉Redis执行时间(以微秒为单位),以便命令能够被记录下来,另一个参数是慢日志的长度。
# 记录新命令时,将从已记录的命令队列中删除最老的命令。
#
# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
# 下面的时间用微秒表示,所以1000000等于一秒。注意,
# 负数禁用慢日志,而值为0则强制记录每个命令。
slowlog-log-slower-than 10000
# There is no limit to this length. Just be aware that it will consume memory.
# 这个长度没有限制。只是要知道它会消耗内存。
# You can reclaim memory used by the slow log with SLOWLOG RESET.
# 使用SLOWLOG复位,您可以回收慢日志使用的内存。
slowlog-max-len 128
################################ LATENCY MONITOR ##############################
# The Redis latency monitoring subsystem samples different operations
# at runtime in order to collect data related to possible sources of
# latency of a Redis instance.
# Redis延迟监控子系统在运行时对不同的操作进行采样,以便收集Redis实例延迟可能来源的相关数据。
#
# Via the LATENCY command this information is available to the user that can
# print graphs and obtain reports.
# 通过延迟命令,可以打印图形和获取报告的用户可以获得这些信息。
# The system only logs operations that were performed in a time equal or
# greater than the amount of milliseconds specified via the
# latency-monitor-threshold configuration directive. When its value is set
# to zero, the latency monitor is turned off.
# 系统只记录在时间等于或大于通过延迟监视器阈值配置指令指定的毫秒数的时间内执行的操作。
# 当它的值设置为0时,将关闭延迟监视器。
# By default latency monitoring is disabled since it is mostly not needed
# if you don't have latency issues, and collecting data has a performance
# impact, that while very small, can be measured under big load. Latency
# monitoring can easily be enabled at runtime using the command
# "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
# 默认情况下,延迟监视是禁用的,因为如果没有延迟问题,那么通常不需要进行延迟监视,
# 而且收集数据会对性能产生影响,尽管影响很小,但在大负载下可以度量出来。
# 如果需要,可以在运行时使用命令“CONFIG SET delay -monitor-threshold ”轻松启用延迟监视。
latency-monitor-threshold 0
############################# EVENT NOTIFICATION ##############################
# Redis can notify Pub/Sub clients about events happening in the key space.
# Redis可以通知Pub/Sub客户端在密钥空间发生的事件。
# This feature is documented at http://redis.io/topics/notifications
# 该特性在 http://redis.io/topics/notifications
# For instance if keyspace events notification is enabled, and a client
# performs a DEL operation on key "foo" stored in the Database 0, two
# messages will be published via Pub/Sub:
# 例如,如果启用了keyspace事件通知,客户端对数据库0中存储的key "foo"执行DEL操作,将通过Pub/Sub发布两条消息:
#
# PUBLISH __keyspace@0__:foo del
# PUBLISH __keyevent@0__:del foo
#
# It is possible to select the events that Redis will notify among a set
# of classes. Every class is identified by a single character:
# 它是可能的选择事件,Redis将通知一组类。每个类由一个字符标识:
# K Keyspace events, published with __keyspace@<db>__ prefix.
# E Keyevent events, published with __keyevent@<db>__ prefix.
# g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
# $ String commands
# l List commands
# s Set commands
# h Hash commands
# z Sorted set commands
# x Expired events (events generated every time a key expires)
# e Evicted events (events generated when a key is evicted for maxmemory)
# t Stream commands
# m Key-miss events (Note: It is not included in the 'A' class)
# A Alias for g$lshzxet, so that the "AKE" string means all the events
# (Except key-miss events which are excluded from 'A' due to their
# unique nature).
#
# The "notify-keyspace-events" takes as argument a string that is composed
# of zero or multiple characters. The empty string means that notifications
# are disabled.
# "notify-keyspace-events"接受一个由0个或多个字符组成的字符串作为参数。空字符串表示禁用通知。
#
# Example: to enable list and generic events, from the point of view of the
# event name, use:
# 示例:从事件名称的角度来看,要启用列表和通用事件,请使用:
# notify-keyspace-events Elg
#
# Example 2: to get the stream of the expired keys subscribing to channel
# name __keyevent@0__:expired use:
# 示例2:获取过期密钥的流,订阅剩余的通道名称
#
# notify-keyspace-events Ex
#
# By default all notifications are disabled because most users don't need
# this feature and the feature has some overhead. Note that if you don't
# specify at least one of K or E, no events will be delivered.
# 默认情况下,所有通知都是禁用的,因为大多数用户不需要这个功能,而且这个功能有一些开销。注意,如果不指定K或E中的至少一个,则不会传递任何事件。
notify-keyspace-events ""
############################### GOPHER SERVER #################################
# Redis contains an implementation of the Gopher protocol, as specified in
# the RFC 1436 (https://www.ietf.org/rfc/rfc1436.txt).
# Redis包含一个Gopher协议的实现,如RFC 1436 (https://www.ietf.org/rfc/rfc1436.txt)中指定的那样。
#
# The Gopher protocol was very popular in the late '90s. It is an alternative
# to the web, and the implementation both server and client side is so simple
# that the Redis server has just 100 lines of code in order to implement this
# support.
# Gopher技术在90年代后期非常流行。它是网络的替代品,实现服务器和客户端都是如此简单,Redis服务器只有100行代码来实现这种支持。
#
# What do you do with Gopher nowadays? Well Gopher never *really* died, and
# lately there is a movement in order for the Gopher more hierarchical content
# composed of just plain text documents to be resurrected. Some want a simpler
# internet, others believe that the mainstream internet became too much
# controlled, and it's cool to create an alternative space for people that
# want a bit of fresh air.
# 你现在用地鼠做什么?嗯,Gopher从未“真正”消亡,最近有一项运动,
# 旨在恢复由纯文本文件组成的更分层次的Gopher内容。一些人想要一个更简单的互联网,
# 另一些人认为主流的互联网变得太过受控制,为想要一点新鲜空气的人们创造一个替代空间是很酷的。
# Anyway for the 10nth birthday of the Redis, we gave it the Gopher protocol
# as a gift.
# 不管怎样,为了庆祝Redis的10岁生日,我们把地鼠协议作为礼物送给了它。
# --- HOW IT WORKS? ---
# ——它是如何工作的?---
# The Redis Gopher support uses the inline protocol of Redis, and specifically
# two kind of inline requests that were anyway illegal: an empty request
# or any request that starts with "/" (there are no Redis commands starting
# with such a slash). Normal RESP2/RESP3 requests are completely out of the
# path of the Gopher protocol implementation and are served as usually as well.
# Redis Gopher支持使用了Redis的内联协议,特别是两种非法的内联请求:一个空请求或任何以“/”开头的请求(没有Redis命令以这样的斜杠开头)。
# 正常的RESP2/RESP3请求完全不在Gopher协议实现的路径上,并像往常一样提供服务。
# If you open a connection to Redis when Gopher is enabled and send it
# a string like "/foo", if there is a key named "/foo" it is served via the
# Gopher protocol.
# 如果您在启用Gopher时打开到Redis的连接并向其发送一个类似“/foo”的字符串,如果有一个名为“/foo”的密钥,则通过Gopher协议提供服务。
#
# In order to create a real Gopher "hole" (the name of a Gopher site in Gopher
# talking), you likely need a script like the following:
# 为了创建一个真正的Gopher“洞”(在Gopher语言中,一个Gopher站点的名称),您可能需要如下脚本:
# https://github.com/antirez/gopher2redis
#
# --- SECURITY WARNING ---
# ——安全警告——
# If you plan to put Redis on the internet in a publicly accessible address
# to server Gopher pages MAKE SURE TO SET A PASSWORD to the instance.
# Once a password is set:
# 如果你打算把Redis放在互联网上一个公共的地址到服务器Gopher页面,请确保设置一个密码的实例。一旦设置了密码:
# 1. The Gopher server (when enabled, not by default) will still serve
# content via Gopher.
# 2. However other commands cannot be called before the client will
# authenticate.
# 1. Gopher服务器(启用时,而非默认情况下)仍将通过Gopher提供内容。
# 2. 然而,在客户端进行身份验证之前,不能调用其他命令。
# So use the 'requirepass' option to protect your instance.
# 因此,使用'requirepass'选项来保护您的实例。
#
# To enable Gopher support uncomment the following line and set
# the option from no (the default) to yes.
# 若要启用Gopher支持,请取消下面一行的注释并将选项从no(默认值)设置为yes。
# gopher-enabled no
############################### 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
# Lists are also encoded in a special way to save a lot of space.
# The number of entries allowed per internal list node can be specified
# as a fixed maximum size or a maximum number of elements.
# 列表还以一种特殊的方式编码,以节省大量空间。
# 每个内部列表节点允许的条目数可以指定为固定的最大大小或元素的最大数量。
# For a fixed maximum size, use -5 through -1, meaning:
# 对于固定的最大尺寸,使用-5到-1,意思是:
# -5: max size: 64 Kb <-- not recommended for normal workloads
# -4: max size: 32 Kb <-- not recommended
# -3: max size: 16 Kb <-- probably not recommended
# -2: max size: 8 Kb <-- good
# -1: max size: 4 Kb <-- good
# Positive numbers mean store up to _exactly_ that number of elements
# per list node.
# 正数表示每个列表节点最多存储该数目的元素。
# The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size),
# but if your use case is unique, adjust the settings as necessary.
# 最高的执行选项通常是-2 (8 Kb大小)或-1 (4 Kb大小),但是如果您的用例是唯一的,则根据需要调整设置。
list-max-ziplist-size -2
# Lists may also be compressed.
# 列表也可以被压缩。
# Compress depth is the number of quicklist ziplist nodes from *each* side of
# the list to *exclude* from compression. The head and tail of the list
# are always uncompressed for fast push/pop operations. Settings are:
# 压缩深度是指从列表的*每*边到*排除*压缩的quicklist ziplist节点的数量。对于快速的推/弹出操作,列表的头和尾总是被解压。设置:
# 0: disable all list compression
# 禁用所有列表压缩
# 1: depth 1 means "don't start compressing until after 1 node into the list,
# 深度1表示“直到列表中有1个节点时才开始压缩,
# going from either the head or tail"
# 从头部或尾部"
# So: [head]->node->node->...->node->[tail]
# 所以(头):- >节点- >节点- >…- >节点- >(尾巴)
# [head], [tail] will always be uncompressed; inner nodes will compress.
# [头],[尾]将一直被解压;内部节点会被压缩。
# 2: [head]->[next]->node->node->...->node->[prev]->[tail]
# [头]- >[下]- >节点- >节点- >…- >节点- >[上一页]- >(尾巴)
# 2 here means: don't compress head or head->next or tail->prev or tail,
# but compress all nodes between them.
# 2这里的意思是:不要压缩头部或头部->下或尾部->prev或尾部,但是压缩它们之间的所有节点。
# 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail]
# (头)- >[下]- >[下]- >节点- >节点- >…- >节点- >[上一页]- >[上一页]- >(尾巴)
# etc.
list-compress-depth 0
# Sets have a special encoding in just one case: when a set is composed
# of just strings that happen to be integers in radix 10 in the range
# of 64 bit signed integers.
# 集合在一种情况下有一种特殊的编码方式:当一个集合由恰好是整数(以10为基数,范围为64位有符号整数)的字符串组成。
# 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.
# 超loglog稀疏表示字节限制。限制包括16字节的头。当使用稀疏表示的超loglog超过这个限制时,它将被转换为密集表示。
# A value greater than 16000 is totally useless, since at that point the
# dense representation is more memory efficient.
# 大于16000的值是完全无用的,因为在这一点上密集的表示更有效的内存。
#
# 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.
# 建议的值为~ 3000,以便在不降低PFADD太多的情况下获得空间高效编码的好处,而对于稀疏编码则是O(N)。
# 如果不关心CPU,但是关心空间,并且数据集由基数在0 - 15000范围内的许多超loglog组成,那么这个值可以提高到~ 10000。
hll-sparse-max-bytes 3000
# Streams macro node max size / items. The stream data structure is a radix
# tree of big nodes that encode multiple items inside. Using this configuration
# it is possible to configure how big a single node can be in bytes, and the
# maximum number of items it may contain before switching to a new node when
# appending new stream entries. If any of the following settings are set to
# zero, the limit is ignored, so for instance it is possible to set just a
# max entires limit by setting max-bytes to 0 and max-entries to the desired
# value.
# 流宏节点的最大大小/项。流数据结构是一个大节点的基数树,其中编码多个项目。使用此配置,
# 可以配置单个节点的字节大小,以及在附加新流项时切换到新节点之前节点可能包含的最大项数。
# 如果将以下设置中的任何一个设置设置为零,则会忽略该限制,因此,可以通过将最大字节设置为0,将最大条目设置为所需的值来设置最大entires限制。
stream-node-max-bytes 4096
stream-node-max-entries 100
# 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.
# 主动重哈希每100毫秒使用1毫秒的CPU时间来帮助重哈希主Redis哈希表(映射顶级键值的哈希表)。
# 哈希表实现复述,使用(见dict.c)执行一个懒惰改作:操作越多改作遇到一个哈希表,越改作“步骤”执行,
# 如果服务器空闲时再处理就不算完整和一些更多的内存使用哈希表。
# The default is to use this millisecond 10 times every second in order to
# actively rehash the main dictionaries, freeing memory when possible.
# 默认情况下,每秒钟使用这个毫秒10次,以便主动地重新散列主字典,尽可能释放内存。
# 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 from time to time
# to queries with 2 milliseconds delay.
# 如果不确定:
# 使用“activerehashing no”,如果你有硬延迟的要求,这是一个不好的事情,在你的环境中,Redis可以回复时间与2毫秒的延迟查询。
# use "activerehashing yes" if you don't have such hard requirements but
# want to free memory asap when possible.
# 如果你没有这样的硬要求,但是想要尽快释放内存,请使用“activerehashing yes”。
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
# 正常的客户端,包括监视客户端
# replica -> replica clients
# 复制客户端
# pubsub -> clients subscribed to at least one pubsub channel or pattern
# 客户端订阅了至少一个pubsub频道或模式
# 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.
# 比如如果硬限制是32字节和软限制是16 mb / 10秒,客户端会立即断开输出缓冲区的大小达到32字节,
# 但也会断开如果客户达到16字节,不断克服了限制10秒钟。
# 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.
# 默认情况下,普通客户端不受限制,因为它们不会在没有请求的情况下接收数据(以push方式),
# 而是在请求之后接收数据,因此只有异步客户端可以创建这样的场景:请求数据的速度比读取数据的速度快。
# Instead there is a default limit for pubsub and replica clients, since
# subscribers and replicas receive data in a push fashion.
# 相反,对于pubsub和副本客户端有一个默认限制,因为订阅者和副本以push方式接收数据。
# 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 replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Client query buffers accumulate new commands. They are limited to a fixed
# amount by default in order to avoid that a protocol desynchronization (for
# instance due to a bug in the client) will lead to unbound memory usage in
# the query buffer. However you can configure it here if you have very special
# needs, such us huge multi/exec requests or alike.
# 客户端查询缓冲区积累新命令。默认情况下,它们被限制在一个固定的数量,以避免协议不同步(例如由于客户机中的bug)将导致查询缓冲区中未绑定的内存使用。
# 然而,如果您有非常特殊的需要,如我们巨大的多/exec请求或类似的,您可以在这里配置它。
# client-query-buffer-limit 1gb
# In the Redis protocol, bulk requests, that are, elements representing single
# strings, are normally limited ot 512 mb. However you can change this limit
# here.
# 在Redis协议中,批量请求,也就是代表单个字符串的元素,通常被限制为512 mb,但是你可以在这里修改这个限制。
# proto-max-bulk-len 512mb
# 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.
# Redis调用一个内部函数来执行许多后台任务,比如在超时时关闭客户端连接,清除从未被请求的过期键,等等。
# Not all tasks are performed with the same frequency, but Redis checks for
# tasks to perform according to the specified "hz" value.
# 并不是所有的任务都以相同的频率执行,但是Redis会根据指定的“hz”值来检查要执行的任务。
# 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.
# 默认情况下,“hz”设置为10。提高这个值会在Redis空闲的时候使用更多的CPU,
# 但同时会在有很多键同时过期的时候让Redis反应更快,并且可以更精确的处理超时。
# 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.
# 范围在1到500之间,但是超过100通常不是一个好主意。大多数用户应该使用默认值10,只有在需要非常低延迟的环境中才将其提高到100。
hz 10
# Normally it is useful to have an HZ value which is proportional to the
# number of clients connected. This is useful in order, for instance, to
# avoid too many clients are processed for each background task invocation
# in order to avoid latency spikes.
# 通常它是有用的,有一个HZ值,这是成比例的客户端连接。这是非常有用的,
# 例如,可以避免为每个后台任务调用处理太多客户机,从而避免延迟峰值。
# Since the default HZ value by default is conservatively set to 10, Redis
# offers, and enables by default, the ability to use an adaptive HZ value
# which will temporary raise when there are many connected clients.
# 由于默认的HZ值被保守地设置为10,Redis提供并默认启用了使用自适应HZ值的能力
# 当有许多连接的客户端时,它将临时上升。
# When dynamic HZ is enabled, the actual configured HZ will be used
# as a baseline, but multiples of the configured HZ value will be actually
# used as needed once more clients are connected. In this way an idle
# instance will use very little CPU time while a busy instance will be
# more responsive.
# 当启用dynamic HZ时,实际配置的HZ将用作基线,但是在连接更多客户端时,实际将根据需要使用配置的HZ值的倍数。
# 通过这种方式,空闲实例将使用非常少的CPU时间,而忙碌的实例将具有更好的响应能力。
dynamic-hz yes
# 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文件时,如果启用了以下选项,则该文件将每生成32 MB数据进行fsync。
# 这对于以更增量的方式将文件提交到磁盘并避免较大的延迟峰值非常有用。
aof-rewrite-incremental-fsync yes
# When redis saves RDB 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.
# 当redis保存RDB文件时,如果启用以下选项,文件将每生成32mb的数据同步。这对于以更增量的方式将文件提交到磁盘并避免较大的延迟峰值非常有用。
rdb-save-incremental-fsync yes
# Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good
# idea to start with the default settings and only change them after investigating
# how to improve the performances and how the keys LFU change over time, which
# is possible to inspect via the OBJECT FREQ command.
# Redis LFU驱逐(见maxmemory设置)可以调优。但是,最好从默认设置开始,
# 在研究了如何改进性能以及键LFU如何随时间变化之后才更改它们,这可以通过OBJECT FREQ命令进行检查。
# There are two tunable parameters in the Redis LFU implementation: the
# counter logarithm factor and the counter decay time. It is important to
# understand what the two parameters mean before changing them.
# 在Redis LFU实现中有两个可调参数:计数器对数因子和计数器衰减时间。在更改这两个参数之前,理解它们的含义是很重要的。
# The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis
# uses a probabilistic increment with logarithmic behavior. Given the value
# of the old counter, when a key is accessed, the counter is incremented in
# this way:
# LFU计数器每个键只有8位,它的最大值是255,所以Redis使用对数行为的概率增量。给定旧计数器的值,当一个键被访问时,计数器按以下方式递增:
# 1. A random number R between 0 and 1 is extracted.
# 提取0和1之间的随机数R。
# 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1).
# 概率P计算为1/(old_value*lfu_log_factor+1)。
# 3. The counter is incremented only if R < P.
# 只有当R < P时,计数器才递增。
# The default lfu-log-factor is 10. This is a table of how the frequency
# counter changes with a different number of accesses with different
# logarithmic factors:
# 默认的lfu- logfactor是10。这是一个表如何频率计数器变化与不同的对数因子不同的访问次数:
# +--------+------------+------------+------------+------------+------------+
# | factor | 100 hits | 1000 hits | 100K hits | 1M hits | 10M hits |
# +--------+------------+------------+------------+------------+------------+
# | 0 | 104 | 255 | 255 | 255 | 255 |
# +--------+------------+------------+------------+------------+------------+
# | 1 | 18 | 49 | 255 | 255 | 255 |
# +--------+------------+------------+------------+------------+------------+
# | 10 | 10 | 18 | 142 | 255 | 255 |
# +--------+------------+------------+------------+------------+------------+
# | 100 | 8 | 11 | 49 | 143 | 255 |
# +--------+------------+------------+------------+------------+------------+
#
# NOTE: The above table was obtained by running the following commands:
# 注:上表是通过运行以下命令得到的:
# redis-benchmark -n 1000000 incr foo
# redis-cli object freq foo
#
# NOTE 2: The counter initial value is 5 in order to give new objects a chance
# to accumulate hits.
# 注2:计数器的初始值是5,以便给新对象一个积累命中次数的机会。
#
# The counter decay time is the time, in minutes, that must elapse in order
# for the key counter to be divided by two (or decremented if it has a value
# less <= 10).
# 计数器衰减时间是以分钟为单位,必须经过的时间,以使键计数器除以2(如果它的值小于<= 10,则递减)。
#
# The default value for the lfu-decay-time is 1. A Special value of 0 means to
# decay the counter every time it happens to be scanned.
# lfu- decaytime的默认值是1。一个特殊的值0意味着计数器在每次扫描时都会衰减。
#
# lfu-log-factor 10
# lfu-decay-time 1
########################### ACTIVE DEFRAGMENTATION #######################
#
# What is active defragmentation?
# 什么是主动碎片整理?
# -------------------------------
#
# Active (online) defragmentation allows a Redis server to compact the
# spaces left between small allocations and deallocations of data in memory,
# thus allowing to reclaim back memory.
# 活动(在线)碎片整理允许Redis服务器压缩空间之间的小的分配和回收的数据在内存,从而允许回收内存。
#
# Fragmentation is a natural process that happens with every allocator (but
# less so with Jemalloc, fortunately) and certain workloads. Normally a server
# restart is needed in order to lower the fragmentation, or at least to flush
# away all the data and create it again. However thanks to this feature
# implemented by Oran Agra for Redis 4.0 this process can happen at runtime
# in an "hot" way, while the server is running.
# 分段是每个分配器(幸运的是,Jemalloc不是这样)和某些工作负载都会发生的自然过程。
# 通常需要重新启动服务器以降低碎片,或者至少清除所有数据并重新创建它。然而多亏了Oran Agra为Redis 4.0实现的这个特性,
# 这个过程可以在运行时以“热”的方式发生,而服务器正在运行。
# Basically when the fragmentation is over a certain level (see the
# configuration options below) Redis will start to create new copies of the
# values in contiguous memory regions by exploiting certain specific Jemalloc
# features (in order to understand if an allocation is causing fragmentation
# and to allocate it in a better place), and at the same time, will release the
# old copies of the data. This process, repeated incrementally for all the keys
# will cause the fragmentation to drop back to normal values.
# 分裂时基本上超过一定水平(见下面的配置选项)复述,将开始创建新副本的值在连续的内存区域利用特定Jemalloc特性(为了理解如果一个分配导致分裂和分配在一个更好的地方),
# 同时,将旧的数据的副本。对所有键递增地重复这个过程将导致碎片降回到正常值。
# Important things to understand:
# 需要了解的重要事情:
# 1. This feature is disabled by default, and only works if you compiled Redis
# to use the copy of Jemalloc we ship with the source code of Redis.
# This is the default with Linux builds.
# 这个特性在默认情况下是禁用的,并且只有当你编译Redis时使用了我们提供的带有Redis源代码的Jemalloc副本。这是Linux构建的默认值。
# 2. You never need to enable this feature if you don't have fragmentation
# issues.
# 如果没有碎片问题,就不需要启用这个特性。
# 3. Once you experience fragmentation, you can enable this feature when
# needed with the command "CONFIG SET activedefrag yes".
# 一旦你经历了碎片化,你可以在需要的时候使用命令“CONFIG SET activedefrag yes”来启用这个特性。
# The configuration parameters are able to fine tune the behavior of the
# defragmentation process. If you are not sure about what they mean it is
# a good idea to leave the defaults untouched.
# 配置参数能够微调碎片整理进程的行为。如果你不确定它们的意思,保持默认值不变是个好主意。
# Enabled active defragmentation
# 使活跃的碎片整理
# activedefrag no
# Minimum amount of fragmentation waste to start active defrag
# 启动活动碎片整理所需的最小碎片浪费量
# active-defrag-ignore-bytes 100mb
# Minimum percentage of fragmentation to start active defrag
# 启动活动碎片整理所需的最小碎片百分比
# active-defrag-threshold-lower 10
# Maximum percentage of fragmentation at which we use maximum effort
# 我们使用最大努力的最大分割百分比
# active-defrag-threshold-upper 100
# Minimal effort for defrag in CPU percentage, to be used when the lower
# threshold is reached
# 在达到较低阈值时,CPU百分比中最少的碎片整理工作
# active-defrag-cycle-min 1
# Maximal effort for defrag in CPU percentage, to be used when the upper
# threshold is reached
# 当达到上限阈值时,CPU百分比中用于碎片整理的最大努力
# active-defrag-cycle-max 25
# Maximum number of set/hash/zset/list fields that will be processed from
# the main dictionary scan
# 主字典扫描将处理的set/hash/zset/list字段的最大数目
# active-defrag-max-scan-fields 1000
# Jemalloc background thread for purging will be enabled by default
# 默认情况下,用于清除的Jemalloc后台线程是启用的
jemalloc-bg-thread yes
# It is possible to pin different threads and processes of Redis to specific
# CPUs in your system, in order to maximize the performances of the server.
# This is useful both in order to pin different Redis threads in different
# CPUs, but also in order to make sure that multiple Redis instances running
# in the same host will be pinned to different CPUs.
# 这是可能钉不同的线程和进程Redis在特定的cpu在你的系统,以最大化的性能的服务器。这对于在不同的cpu上固定不同的Redis线程非常有用,
# 同时也可以确保在同一个主机上运行的多个Redis实例被固定到不同的cpu上。
# Normally you can do this using the "taskset" command, however it is also
# possible to this via Redis configuration directly, both in Linux and FreeBSD.
# 通常你可以使用“taskset”命令来做这个,但是它也可以通过Redis配置直接,在Linux和FreeBSD。
#
# You can pin the server/IO threads, bio threads, aof rewrite child process, and
# the bgsave child process. The syntax to specify the cpu list is the same as
# the taskset command:
# 您可以固定服务器/IO线程、bio线程、aof重写子进程和bgsave子进程。指定cpu列表的语法与taskset命令相同:
#
# Set redis server/io threads to cpu affinity 0,2,4,6:
# 设置redis服务器/io线程的cpu亲和力0,2,4,6:
# server_cpulist 0-7:2
#
# Set bio threads to cpu affinity 1,3:
# 设置bio线程为cpu亲和力1,3:
# bio_cpulist 1,3
#
# Set aof rewrite child process to cpu affinity 8,9,10,11:
# 设置aof重写子进程到cpu亲和力8,9,10,11:
# aof_rewrite_cpulist 8-11
#
# Set bgsave child process to cpu affinity 1,10,11
# 将bgsave子进程设置为cpu亲缘关系1,10,11
# bgsave_cpulist 1,10-11
注意:本文归作者所有,未经作者允许,不得转载