redis配置详解(中英文)

V2.8.21: (中英字幕同步)

# Redis configuration file example
#* Redis 配置文件例子

# 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.

# 注意内存单位: 当使用内存大小的限制需要设置时, 在这里可以设置它的大小格式
# 例如: 1k 5GB 4M 等等都是可以的:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# 单位不区分大小写因此 so 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.
#
# 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.
#
# 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"重写
# redis使用最后一个配置文件作为重写的文件,如果不行被重写,
# 那么请放在前面声明自己的配置文件
# 最后一行的配置就会被重写
#
# include /path/to/local.conf
# include /path/to/other.conf

################################ 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'.
# 当运行在守护进程模式,则会写到一个pid文件: /var/run/redis.pid.

daemonize no

# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
# 当运行在守护进程模式,Redis会默认写到/var/run/redis.pid中
# 你可以在这里设置修改
pidfile /var/run/redis.pid

# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
# Redis监听端口来接收连接,默认端口是 6379
# 如果端口是0, Redis不会监听TCP socket
port 6379

# TCP listen() backlog.
#
# 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.

# 在高并发环境下你需要一个高backlog值来避免慢客户端连接问题。注意Linux内核默默地将这个值减小
# 到/proc/sys/net/core/somaxconn的值,所以需要确认增大somaxconn和tcp_max_syn_backlog
# 两个值来达到想要的效果。
# [syn queue && accept queue, 慢客户端会造成accept queue 比较长, 所以加大一些如果客户端太慢的话]
tcp-backlog 511

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# 默认Redis监听服务器上所有可用网络接口的连接。可以用"bind"配置指令跟一个或多个ip地址来实现
# 监听一个或多个网络接口
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1

# 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)
# 一个客户端空闲多少秒后关闭连接。(0代表禁用,永不关闭)
timeout 0

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7014cdb75c0f80fd240c5e6b9af887eb.html