Redis6.0.10 配置文件说明

Redis6.0.10 配置文件说明

# 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服务器而每天Redis服务只需要定制一些配置。
# Include files可以引入其他配置文件,所以请尽量使用这个配置。
#
# Note that 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.
# 注意"inculde"选项不会被admin或者Redis哨兵的"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 /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 /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 available network interfaces on the host machine.
# 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 on the
# IPv4 loopback interface address (this means Redis will only be able to
# accept client connections from the same host that it is running on).
# ~~~警告~~~如果运行Redis的服务器是直接暴露在互联网的,绑定所有网络端口是很危险的,
# 而且会使端口暴露给互联网里的所有人。所以默认情况我们不会注释bind默认配置,这会强制
# Redis只会监听IPv4的回环地址(这意味着Redis只会接受本机客户端的连接)。
# 
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT OUT 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.
# 保护模块是一层安全保护,为了避免Redis实例在开放的互联网上被访问和利用。
# 
# When protected mode is on and if:
# 当保护模式开启并且:
#
# 1) The server is not binding explicitly to a set of addresses using the
#    "bind" directive.
# 2) No password is configured.
# 1) 服务器没有使用"bind"指令 明确绑定一堆IP地址。
# 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.
# 默认保护模式是开启的,当你没有配置密码,也没有使用"bind"指令指定监听的网络端口列表,
# 而又需要其他地址的客户端连接Redis,请关闭保护模式。
# 
# 
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
# 如果port指定为0,则Redis不会监听TCP连接。
# 
port 6379

# TCP listen() backlog.
# TCP监听()后台日志
#
# In high requests-per-second environments you need a high backlog in order
# to avoid slow clients connection 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.
# 在每秒请求数高的环境,你需要一个高的backlog,避免客户端连接速度慢的问题,
# 注意Linux kernel会静默截断这个值为/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套接字,当一个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 ACKs给客户端断开连接时,
# 这是有好处的两个原因:
#
# 1) Detect dead peers.
# 2) Force network equipment in the middle to consider the connection to be
#    alive.
# 1)检测挂掉的节点。
# 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,这个指定的值(秒)是发送ACKs的周期,
# 注意关闭连接的时间应该是需要时间的两倍,
# 在某些kernels中,这个周期是依赖于kernel的配置。
#
# A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis 3.2.1.
# 一个合理值得选项是300秒,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-port"配置指令定义TLS-listening端口,
# 使用默认端口开启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端口需要使用有效的证书通过验证。
# 
# If "no" is specified, client certificates are not required and not accepted.
# If "optional" is specified, client certificates are accepted and must be
# valid if provided, but are not required.
# 如果"no"被指定,客户端证书不是必须的企业不会被接受。
# 如果"optional"被指定,客户端证书不是必须提交证书,如果提交证书会被接受且需要保证有效。
# 
# tls-auth-clients no
# tls-auth-clients optional

# 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.
# 配置允许的密码。有关此字符串语法的详细信息,请参阅ciphers(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 CipherSuite。
# 
# 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.
# 更改缓存的默认过期时间,默认是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不作为守护进程运行,如果需要,请使用"yes",
# 注意Redis作为守护进程将会写入pid文件(/var/run/redis.pid)。
daemonize no

# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
#   supervised no      - no supervision interaction
#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
#                        requires "expect stop" in your upstart job config
#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
#   supervised auto    - detect upstart or systemd method based on
#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
#       They do not enable continuous pings back to your supervisor.
# 如果你使用upstart或systemd运行Redis,Redistribution可以与你的监控树配置,选项如下:
# supervised no      - 无监控互动
# supervised upstart -  将Redis进入SIGSTOP模式发送信号给upstart,
#									需要"expect stop"在你的upstart job 配置
# supervised systemd - 发信号给systemd,通过写入 READY=1给$NOTIFY_SOCKET
# supervised auto - 检测upstart或systemd,基于UPSTART_JOB或NOTIFY_SOCKET环境变量。
# 注意:这些supervision方式只会发信号"pricess is ready"
#           他们不支持持续的返回ping给你的supervisor。
# 
supervised no

# If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
# 如果pid file被指定,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 file
# 当服务作为守护进程运行,会创建pid file,默认配置为"/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.
# Redis会尽最大努力创建pid file,如果Redis不能创建pid file,
# 也不会有什么坏事发生,服务还是会正常启动和运行。
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)
# 指定服务日志冗长级别
# 选项如下:
# debug (很多信息,用于开发/测试)
# verbose (很多有用的信息,但不会像debug那么混乱)
# notice(中等冗长,适合在生产环境配置)
# warning(只有非常重要/关键的信息会输出)
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在标准控制台输出。
# 注意如果你只能以非守护进程使用标准控制台输出,否则会输出到 /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-enabled no

# Specify the syslog identity.
# 指定系统日志的身份
# syslog-ident redis

# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# 指定系统日志设备,必须为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
# 设置数据库数量,默认的数据库是DB 0,你可以选择一个默认的数据库在连接前使用 
# 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.
# 默认Redis仅在启动时为标准输出且标准输出时一个TTY时,才会打印ASCII艺术logo,基本上
# 这意味着通常只有在交互式会话中才会显示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.
# 这在4.0之前的版本是强制显示的,通过设置下面的选项为yes。
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 behavior 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
#
#   Note: you can disable saving completely by commenting out all "save" lines.
#
#   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 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.
# 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.
#
# 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.
stop-writes-on-bgsave-error yes

# Compress string objects using LZF when dump .rdb databases?
# By default compression is enabled 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.
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 files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip the check.
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 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值