Redis配置文件redis.conf文件详解

唠嗑

这里面的意思只要看得差不多其实就是已经对redis有熟悉的感觉,就比如 推塔已经推到别人家的大门~~~~~~~~废话不多说直接开始了
知道大家都不懒,所以弟弟早已把意思翻译过来,可以看看呦,
本来想着直接放到文件中翻译中文,但是太乱了。所以以下面那种形式更直观好看一点,挑了几个常看到的 里面太多了写不过来了。。。。。

1. 开头

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./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 => 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.

翻译
Redis配置文件示例。
请注意,为了读取配置文件,Redis必须
以文件路径作为第一个参数开始:
./redis服务器/path/to/redis。形态
单位注释:当需要内存大小时,可以指定
它通常采用1k 5GB 4M等形式:
1k=>1000字节
1kb=>1024字节
1m=>1000000字节
1mb=>10241024字节
1g=>100000000字节
1gb=>1024
1024*1024字节
单元不区分大小写,因此1GB 1GB都是相同的。

解释

  1. 配置文件看出redis对大小写不敏感
  2. 那要读取配置文件 就要以路径开始,列如: redis-server /usr/local/etc/redis.conf 那我这个配置件在这个路径下。
    还有一些单位的表示。不再多说了

INCLUDES: 包括

################################## 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.
#
# 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.
#
# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
#
# include /path/to/local.conf
# include /path/to/other.conf

翻译
在此处包括一个或多个其他配置文件。这是有用的,如果你
拥有适用于所有Redis服务器的标准模板,但也需要
自定义每个服务器的一些设置。包含文件可以包括
其他文件,所以请明智地使用它。
请注意,命令“CONFIG REWRITE”不会重写选项“include”
来自管理员或Redis Sentinel。因为Redis总是使用最后处理的
行作为配置指令的值,最好将includes
在该文件的开头,以避免在运行时覆盖配置更改。
如果您有兴趣使用includes覆盖配置
选项,最好使用include作为最后一行。
includes /path/to/local。形态
includes /path/to/other。形态

解释

  1. 可以通过includes包含,也可以加载别的redis conf文件。local.conf,other.conf,类似于status2中的标签,大白话说就是在一个里面可以引另一个。

NETWORK :网络

################################## 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.
# Each address can be prefixed by "-", which means that redis will not fail to
# start if the address is not available. Being not available only refers to
# addresses that does not correspond to any network interfece. Addresses that
# are already in use will always fail, and unsupported protocols will always BE
# silently skipped.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1     # listens on two specific IPv4 addresses
# bind 127.0.0.1 ::1              # listens on loopback IPv4 and IPv6
# bind * -::*                     # like the default, all available interfaces
#
# ~~~ 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 and IPv6 (if available) loopback interface addresses (this means Redis
# will only be able to accept client connections from the same host that it is
# running on).
#
# 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 -::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.
#
# 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.
#
# 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.
#
# 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.
protected-mode no# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379# TCP listen() backlog.
#
# 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.
tcp-backlog 511# Unix socket.
#
# 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.
#
# unixsocket /run/redis.sock
# unixsocketperm 700# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0# TCP keepalive.
#
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
#
# 1) Detect dead peers.
# 2) Force network equipment in the middle to consider the connection to be
#    alive.
#
# 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.
#
# A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis 3.2.1.
tcp-keepalive 300

翻译
默认情况下,如果未指定“bind”配置指令,Redis将侦听
用于主机上所有可用网络接口的连接。
可以使用以下命令仅侦听一个或多个选定接口:
“bind”配置指令,后跟一个或多个IP地址。
每个地址的前缀都可以是“-”,这意味着redis不会失败
如果地址不可用,则启动。不可用仅指
与任何网络接口都不对应的地址。解决这个问题
已在使用的协议将始终失败,并且不受支持的协议将始终无效
默默地跳过
示例:
绑定192.168。1.100 10.0.0.1>侦听两个特定的IPv4地址
绑定127.0。0.1::1>侦听环回IPv4和IPv6
绑定*-::*>与默认值一样,所有可用接口
~警告如果运行Redis的计算机直接暴露于
在internet上,绑定到所有接口是危险的,会暴露
向互联网上的每个人提供实例。因此,默认情况下,我们取消注释
遵循bind指令,这将强制Redis仅在
IPv4和IPv6(如果可用)环回接口地址(这意味着Redis
将只能接受来自同一主机的客户端连接
正在运行)。
如果确定希望实例侦听所有接口
只需注释掉下面的一行。
绑定127.0。0.1 -::1
保护模式是一层安全保护,以避免这种情况
互联网上打开的Redis实例被访问和利用。
当保护模式打开时,如果:
1)服务器未使用
“绑定”指令。
2)未配置密码。
服务器仅接受来自客户端的连接,这些客户端从
IPv4和IPv6环回地址127.0。0.1和::1,以及来自Unix域的
插座。
默认情况下,启用保护模式。只有在以下情况下才应禁用它
您确定希望其他主机的客户端连接到Redis
即使没有配置身份验证,也没有特定的接口集
使用“bind”指令显式列出。保护模式编号
接受指定端口上的连接,默认值为6379(IANA>815344)。
如果指定端口0,Redis将不会侦听TCP套接字。6379端口
TCP listen()积压工作。
在每秒高请求的环境中,您需要高积压工作才能正常工作
避免客户端连接速度慢的问题。请注意,Linux内核
将静默地将其截断为/proc/sys/net/core/somaxconn so的值
确保提高somaxconn和tcp_max_syn_backlog的值
为了达到预期的效果。tcp积压511
Unix套接字。
指定将用于侦听的Unix套接字的路径
传入连接。没有默认设置,因此Redis不会监听
未指定时,在unix套接字上。
unixsocket/run/redis。短袜
unixsocketperm 700
客户端空闲N秒后关闭连接(0表示禁用)超时0
保持活力。
如果非零,则使用SO_KEEPALIVE在缺席时向客户端发送TCP确认
沟通能力。这很有用,原因有二:
1)检测死掉的对等点。
2)力网设备在中间考虑连接活着。
在Linux上,指定的值(以秒为单位)是用于发送ACK的时间段。
请注意,要关闭连接,需要两倍的时间。
在其他内核上,周期取决于内核配置。
此选项的合理值为300秒,这是新的
Redis默认从Redis 3.2开始。1.
tcp保持300

解释

  1. bind 127.0.0.1: 如果运行Redis的计算机直接暴露在internet上,绑定到所有接口是危险的,会将实例暴露给internet上的每个人。因此,在默认情况下,我们取消对以下bind指令的注释,这将迫使Redis只监听IPv4环回接口地址(这意味着Redis将只能接受来自运行在同一台计算机上的客户端的连接)。如果您确定希望实例侦听所有接口只需注释下面的行。bind 127.0.0.1 (绑定的ip)
  2. protected-mode:是一种安全保护层,为了避免在internet上打开的Redis实例被访问和利用。protected-mode 默认是yes 启动
  3. port:端口6379
  4. tcp-backlog 511: 在每秒请求数很高的环境中,您需要一个高的backlog,以避免缓慢的客户端连接问题。请注意,Linux内核将静默地将其截断为/proc/sys/net/core/somaxconn的值,因此请确保同时提高somaxconn和tcp_max_syn_backlog的值,以获得所需的效果。
  5. unix: 为Unix套接字指定用于监听传入连接的路径。没有默认值,所以在未指定时,Redis不会监听unix套接字。
  6. timeout: 客户端空闲N秒后关闭连接(0表示禁用) timeout 0
  7. Tcp keepalive: 如果该值不为0,将使用 SO_KEEPALIVE 这一默认的做法来向客户端连接发送TCP ACKs。
    这样的好处有以下两个原因-----------------------
    1)检测已经死亡的对端。
    2)保持连接在网络环境中的存活。
    在Linux上,指定的值(以秒为单位)是用于发送ack的周期。
    注意,关闭连接需要双倍的时间。
    对于其他内核,周期取决于内核配置。
    此选项的合理值是300秒,即从Redis 3.2.1开始的新Redis默认值。

GENERAL:通用

################################# 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.
# When Redis is supervised by upstart or systemd, this parameter has no impact.
daemonize yes# 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
#                        on startup, and updating Redis status on a regular
#                        basis.
#   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.
#
# The default is "no". To run under upstart/systemd, you can simply uncomment
# the line below:
#
# supervised auto# If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
#
# 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".
#
# 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.
#
# Note that on modern Linux systems "/run/redis.pid" is more conforming
# and should be used instead.
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
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 no# Specify the syslog identity.
# syslog-ident redis# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0# To disable the built in crash log, which will possibly produce cleaner core
# dumps when they are needed, uncomment the following:
#
# crash-log-enabled no# To disable the fast memory check that's run as part of the crash log, which
# will possibly let redis terminate sooner, uncomment the following:
#
# crash-memcheck-enabled no# 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
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 and syslog logging is
# disabled. Basically this means that normally a logo is displayed only in
# interactive sessions.
#
# 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.
always-show-logo no# By default, Redis modifies the process title (as seen in 'top' and 'ps') to
# provide some runtime information. It is possible to disable this and leave
# the process name as executed by setting the following to no.
set-proc-title yes# When changing the process title, Redis uses the following template to construct
# the modified title.
#
# Template variables are specified in curly brackets. The following variables are
# supported:
#
# {title}           Name of process as executed if parent, or type of child process.
# {listen-addr}     Bind address or '*' followed by TCP or TLS port listening on, or
#                   Unix socket if only that's available.
# {server-mode}     Special mode, i.e. "[sentinel]" or "[cluster]".
# {port}            TCP port listening on, or 0.
# {tls-port}        TLS port listening on, or 0.
# {unixsocket}      Unix domain socket listening on, or "".
# {config-file}     Name of configuration file used.
#
proc-title-template "{title} {listen-addr} {server-mode}"

翻译+解释

  1. daemonize: 默认情况下,Redis不作为守护进程运行。如果需要,请使用“yes”。
    注意,Redis将在/var/run/Redis中写入一个pid文件。后台监控时的pid。
    当Redis由upstart或systemd监控时,此参数没有影响。
  2. pidfile /var/run/redis_6379.pid : 如果指定了pid文件,Redis会将其写入启动时指定的位置,并在出口处将其移除。
    #当服务器非守护运行时,如果没有创建pid文件,则不会创建pid文件
    在配置中指定。当服务器被守护时,pid文件即使未指定,也会使用,默认为“/var/run/redis.pid”。如果Redis无法创建pid文件,则最好创建一个pid文件没有什么不好的事情发生,服务器将正常启动和运行。
    注意,在现代Linux系统上“/run/redis.pid”更符合标准
    应该用它来代替。 如果开启后台运行,则需要指定一个pid文件
  3. loglevel notice: 日志
    指定服务器详细级别。
    这可以是以下情况之一:
    debug(大量信息,对开发/测试有用)
    verbose(许多信息很少有用,但不像调试级别那样混乱)
    notice(适度冗长,您可能希望在生产中得到什么)
    warning(仅记录非常重要/关键的消息)
  4. logfile " ": 日志的文件位置名
    指定日志文件名。也可以使用空字符串强制
    Redis登录标准输出。请注意,如果您使用标准
    输出日志,但daemonize,日志将发送到/dev/null
  5. databases 16: 数据库数量 默认16
    设置数据库的数量。默认数据库为DB 0,您可以选择
    使用SELECTwhere在每个连接上创建一个不同的连接
    dbid是介于0和“数据库”-1之间的数字
  6. always-show-logo no: logo显示

SNAPSHOTTING:快照

################################ SNAPSHOTTING  ################################# Save the DB to disk.
#
# save <seconds> <changes>
#
# Redis will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# Snapshotting can be completely disabled with a single empty string argument
# as in following example:
#
# save ""
#
# Unless specified otherwise, by default Redis will save the DB:
#   * After 3600 seconds (an hour) if at least 1 key changed
#   * After 300 seconds (5 minutes) if at least 100 keys changed
#   * After 60 seconds if at least 10000 keys changed
#
# You can set these explicitly by uncommenting the three following lines.
#
# save 3600 1
# save 300 100
# 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# Enables or disables full sanitation checks for ziplist and listpack etc when
# loading an RDB or RESTORE payload. This reduces the chances of a assertion or
# crash later on while processing commands.
# Options:
#   no         - Never perform full sanitation
#   yes        - Always perform full sanitation
#   clients    - Perform full sanitation only for user connections.
#                Excludes: RDB files, RESTORE commands received from the master
#                connection, and client connections which have the
#                skip-sanitize-payload ACL flag.
# The default should be 'clients' but since it currently affects cluster
# resharding via MIGRATE, it is temporarily set to 'no' by default.
#
# sanitize-dump-payload no# 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.
#
# 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.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./usr/local/redis/bin

翻译+解释

  1. save 900 1: 900是时间 单位秒。在900秒内,如果至少一个key进行修改 进行持久化。
    将数据库保存到磁盘。
    如果给定的秒数和给定的对数据库执行的写入操作数。
    使用单个空字符串参数可以完全禁用快照
  2. stop-writes-on-bgsave-error yes: 持久化出错,是否还继续工作
  3. rdbcompression yes: 是否压缩rdb文件,消耗cpu资源。
  4. rdbchecksum yes : 保存rdb文件时,进行检查效验
  5. dbfilename dump.rdb : 文件名
  6. dir ./usr/local/redis/bin: rdb文件 保存路径

SECURITY :安全

################################## 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 ACL users are defined in the following format:
#
#   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.
#
# The ACL rules that describe what a user can do are the following:
#
#  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.
#  skip-sanitize-payload    RESTORE dump-payload sanitation is skipped.
#  sanitize-payload         RESTORE dump-payload is sanitized (default).
#  +<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.
#  +<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 "+".
#  allcommands  Alias for +@all. Note that it implies the ability to execute
#               all the future commands loaded via the modules system.
#  nocommands   Alias for -@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.
#  allkeys      Alias for ~*
#  resetkeys    Flush the list of allowed keys patterns.
#  &<pattern>   Add a glob-style pattern of Pub/Sub channels that can be
#               accessed by the user. It is possible to specify multiple channel
#               patterns.
#  allchannels  Alias for &*
#  resetchannels            Flush the list of allowed channel patterns.
#  ><password>  Add this password 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).
#  <<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.
#  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).
#  reset        Performs the following actions: resetpass, resetkeys, off,
#               -@all. The user returns to the same state it has immediately
#               after its creation.
#
# 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.
# 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:
#
#   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.
#
# Basically ACL rules are processed left-to-right.
#
# For more information about ACL configuration please refer to
# the Redis web site at https://redis.io/topics/acl# ACL LOG
#
# 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.
acllog-max-len 128# Using an external ACL file
#
# 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 external
# ACL file, the server will refuse to start.
#
# The format of the external ACL user file is exactly the same as the
# format that is used inside redis.conf to describe users.
#
# aclfile /etc/redis/users.acl# IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility
# 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.
#
# The requirepass is not compatable with aclfile option and the ACL LOAD
# command, these will cause requirepass to be ignored.
#
# requirepass foobared# New users are initialized with restrictive permissions by default, via the
# equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it
# is possible to manage access to Pub/Sub channels with ACL rules as well. The
# default Pub/Sub channels permission if new users is controlled by the
# acl-pubsub-default configuration directive, which accepts one of these values:
#
# allchannels: grants access to all Pub/Sub channels
# resetchannels: revokes access to all Pub/Sub channels
#
# To ensure backward compatibility while upgrading Redis 6.0, acl-pubsub-default
# defaults to the 'allchannels' permission.
#
# Future compatibility note: it is very likely that in a future version of Redis
# the directive's default of 'allchannels' will be changed to 'resetchannels' in
# order to provide better out-of-the-box Pub/Sub security. Therefore, it is
# recommended that you explicitly define Pub/Sub permissions for all users
# rather then rely on implicit default values. Once you've set explicit
# Pub/Sub for all existing users, you should uncomment the following line.
#
# acl-pubsub-default resetchannels# 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.
# ------------------------------------------------------------------------
#
# 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.
#
# 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.

翻译+解释

  1. requirepass :设置密码
    可以通过命令来设置 config set requirepass 密码
    auth 密码:验证密码
  2. maxclients : 这个在clients一栏中。表示能连上redis的客户端的最大数量
  3. maxmemory bytes: redis 配置的最大内存量
  4. maxmemory-policy noeviction: 内存达到上限的处理策略
    1、volatile-lru:只对设置了过期时间的key进行LRU(默认值)
    2、allkeys-lru : 删除lru算法的key
    3、volatile-random:随机删除即将过期key
    4、allkeys-random:随机删除
    5、volatile-ttl : 删除即将过期的
    6、noeviction : 永不过期,返回错误

APPEND ONLY MODE: aof

############################## 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).
#
# 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.
#
# 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.
#
# Please check https://redis.io/topics/persistence for more information.appendonly no# The name of the append only file (default: "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.
#
# Redis supports three different modes:
#
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# always: fsync after every write to the append only log. Slow, Safest.
# everysec: fsync only one time every second. Compromise.
#
# 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.
#
# More details please check the following article:
# http://antirez.com/post/redis-persistence-demystified.html
#
# If unsure, use "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.
#
# 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.
#
# 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).
#
# 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.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.
#
# 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).
#
# 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.
#
# Specify a percentage of zero in order to disable the automatic AOF
# rewrite feature.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).
#
# 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.
#
# 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.
#
# 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-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:
#
#   [RDB file][AOF tail]
#
# When loading, Redis recognizes that the AOF file starts with the "REDIS"
# string and loads the prefixed RDB file, then continues loading the AOF
# tail.
aof-use-rdb-preamble yes

翻译+解释

  1. appendonly no : 默认不开启aof模式,默认使用rdb持久化
  2. appendfilename “appendonly.aof” : 文件名字。仅追加文件的名称(默认值:“appendonly.aof”)
  3. appendfsync :
    appendfsync everysec: 每秒执行一次同步,可能丢失一秒的数据
    appendfsync always: 每次修改都会同步
    appendfsync no: 不执行同步,由操作系统自动调度刷磁盘,性能是最好的。

Redis配置文件redis.conf文件详解相关推荐

  1. Nginx配置文件nginx.conf中文详解(转)

    ######Nginx配置文件nginx.conf中文详解######定义Nginx运行的用户和用户组 user www www;#nginx进程数,建议设置为等于CPU总核心数. worker_pr ...

  2. Hibernate配置文件与映射文件详解

    Hibernate是一个彻底的ORM(Object Relational Mapping,对象关系映射)开源框架. 我们先看一下官方文档所给出的,Hibernate 体系结构的高层视图: 其中PO=P ...

  3. Nginx主配置文件nginx.conf中文详解

    第1章 nginx配置解释图解 第2章 Nginx核心配置文件nginx.conf史上最细中文详解 2.1 定义Nginx运行的用户和用户组 2.2 nginxworker进程数,即处理请求的进程(熟 ...

  4. ldconfig命令和/etc/ld.so.conf文件详解

    ldconfig命令的解释是: ldconfig creates the necessary links and cache to the most recent shared libraries f ...

  5. /boot/grub/grub.conf文件详解

    grub.conf是grub的主配置文件,通过这个配置文件,grub才能找到kernel,系统才能正常启动.下面我们来解析一下这个文件中所有到的一下关键字的意思: default:定义默认启动的ker ...

  6. sysctl.conf文件详解

    /proc/sys目录下存放着大多数内核参数,并且可以在系统运行时进行更改,不过重新启动机器就会失效./etc/sysctl.conf是一个允许改变正在运行中的Linux系统的接口,它包含一些TCP/ ...

  7. sysctl 默认值_sysctl.conf文件详解

    使文件立刻生效命令:/sbin/sysctl -p /proc/sys目录下存放着大多数内核参数,并且可以在系统运行时进行更改,不过重新启动机器就会失效./etc/sysctl.conf是一个允许改变 ...

  8. nsswitch.conf文件详解

     一.nsswithch.conf:服务搜索顺序     文件/etc/nsswitch.conf(name service switch configuration,名字服务切换配置)规定通过哪些途 ...

  9. linux 服务器dns配置文件,DNS named.conf文件详解

    配置文件: /etc/named.conf /在NAMED.CONF        配置文件中使用//和/* */来进行注释, options { /*OPTIONS选项用来定义一些影响整个DNS服务 ...

最新文章

  1. 快速访问github镜像 wiki镜像重点_github问题小结
  2. 2020 ICPC Macau A. Accelerator(期望,计数,分治FFT)(每日一题 21.7.6)
  3. 洛谷——P1605 迷宫
  4. 文献记录(part25)--ACDnet An action detection network for real-time edge computing based on flow-guided
  5. python csv模块追加列,使用Python在CSV上添加新列
  6. LeetCode 540. 有序数组中的单一元素(位运算二分查找)
  7. 数据结构(十七)最小生成树
  8. 2017.10.23学习知识总结回顾及编写新网页
  9. 计算机统考第五次作业操作题,计算机基础第5次作业 第五章 Powerpoint知识题
  10. LINUX下解决netstat查看TIME_WAIT状态过多问题
  11. java编程练习题四
  12. Android 的CompoundButton(抽象类按钮)、StringBuffer(字符串变量)
  13. 实现统计二叉树叶子节点个数的算法
  14. shell 自动搜索历史记录
  15. 【爬虫实战】01利用python爬虫并进行数据分析(链家 爬虫)
  16. 【Python】解决使用 plt.savefig 保存图片时一片空白
  17. 可视化 | 用Python分析近5000个旅游景点,告诉你假期应该去哪玩
  18. python高级用法之命名元组namedtuple
  19. 马克维茨模型matlab求解,马克维茨投资组合模型的matlab计算
  20. win7系统做网站服务器,win7系统做网站服务器

热门文章

  1. gtx660 linux驱动下载,佳能 NVIDIA GeForce GTX660 GPU 驱动程序下载-更新佳能软件(显卡)...
  2. SW练习_POJ1912_CCW_点线关系_未AC
  3. android 单元布局,在Android布局中挖洞
  4. 如何查看docker的版本号是多少
  5. 小区市话配套和宽带接入系统研究报告
  6. 如何避免2.4GHz ISM频段下各种无线设备的干扰
  7. 手机的唯一标识码 php,android手机获取唯一标识的方法
  8. 华三防火墙web端口_HCL模拟器防火墙WEB方式登录配置
  9. Linux配置SSH免密码登录(非root账号)
  10. 边缘检测论文简读、开源代码和数据集合集