Redis2.8配置文件中文详解
人气:0
这篇文章主要介绍了Redis2.8配置文件中文详解,本文提供的是是Redis2.8.9的配置文件各项的中文解释,需要的朋友可以参考下
addhttps://m.qb5200.com/byhttps://m.qb5200.com/zhjhttps://m.qb5200.com/:https://m.qb5200.com/没找到本文的原文。另外,redis配置文件中文翻译https://m.qb5200.com/也翻译的不错,可以与本文对照看。两篇文章都是以Redis2.8来介绍的
在Redis中直接启动redis-server服务时,https://m.qb5200.com/采用的是默认的配置文件。采用redis-serverhttps://m.qb5200.com/xxx.confhttps://m.qb5200.com/这样的方式可以按照指定的配置文件来运行Redis服务。下面是Redis2.8.9的配置文件各项的中文解释。
#daemonizehttps://m.qb5200.com/nohttps://m.qb5200.com/默认情况下,https://m.qb5200.com/redishttps://m.qb5200.com/不是在后台运行的,如果需要在后台运行,把该项的值更改为https://m.qb5200.com/yes
daemonizehttps://m.qb5200.com/yes
#https://m.qb5200.com/当https://m.qb5200.com/redishttps://m.qb5200.com/在后台运行的时候,https://m.qb5200.com/Redishttps://m.qb5200.com/默认会把https://m.qb5200.com/pidhttps://m.qb5200.com/文件放在https://m.qb5200.com//var/run/redis.pidhttps://m.qb5200.com/,你可以配置到其他地址。
#https://m.qb5200.com/当运行多个https://m.qb5200.com/redishttps://m.qb5200.com/服务时,需要指定不同的https://m.qb5200.com/pidhttps://m.qb5200.com/文件和端口
pidfilehttps://m.qb5200.com//var/run/redis_6379.pid
#https://m.qb5200.com/指定https://m.qb5200.com/redishttps://m.qb5200.com/运行的端口,默认是https://m.qb5200.com/6379
porthttps://m.qb5200.com/6379
#https://m.qb5200.com/在高并发的环境中,为避免慢客户端的连接问题,需要设置一个高速后台日志
tcp-backloghttps://m.qb5200.com/511
#https://m.qb5200.com/指定https://m.qb5200.com/redishttps://m.qb5200.com/只接收来自于该https://m.qb5200.com/IPhttps://m.qb5200.com/地址的请求,如果不进行设置,那么将处理所有请求
#https://m.qb5200.com/bindhttps://m.qb5200.com/192.168.1.100https://m.qb5200.com/10.0.0.1
#https://m.qb5200.com/bindhttps://m.qb5200.com/127.0.0.1
#https://m.qb5200.com/设置客户端连接时的超时时间,单位为秒。当客户端在这段时间内没有发出任何指令,那么关闭该连接
#https://m.qb5200.com/0https://m.qb5200.com/是关闭此设置
timeouthttps://m.qb5200.com/0
#https://m.qb5200.com/TCPhttps://m.qb5200.com/keepalive
#https://m.qb5200.com/在https://m.qb5200.com/Linuxhttps://m.qb5200.com/上,指定值(秒)用于发送https://m.qb5200.com/ACKshttps://m.qb5200.com/的时间。注意关闭连接需要双倍的时间。默认为https://m.qb5200.com/0https://m.qb5200.com/。
tcp-keepalivehttps://m.qb5200.com/0
#https://m.qb5200.com/指定日志记录级别,生产环境推荐https://m.qb5200.com/notice
#https://m.qb5200.com/Redishttps://m.qb5200.com/总共支持四个级别:https://m.qb5200.com/debughttps://m.qb5200.com/、https://m.qb5200.com/verbosehttps://m.qb5200.com/、https://m.qb5200.com/noticehttps://m.qb5200.com/、https://m.qb5200.com/warninghttps://m.qb5200.com/,默认为https://m.qb5200.com/verbose
#https://m.qb5200.com/debughttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/记录很多信息,用于开发和测试
#https://m.qb5200.com/varbosehttps://m.qb5200.com/https://m.qb5200.com/有用的信息,不像https://m.qb5200.com/debughttps://m.qb5200.com/会记录那么多
#https://m.qb5200.com/noticehttps://m.qb5200.com/https://m.qb5200.com/普通的https://m.qb5200.com/verbosehttps://m.qb5200.com/,常用于生产环境
#https://m.qb5200.com/warninghttps://m.qb5200.com/https://m.qb5200.com/只有非常重要或者严重的信息会记录到日志
loglevelhttps://m.qb5200.com/notice
#https://m.qb5200.com/配置https://m.qb5200.com/loghttps://m.qb5200.com/文件地址
#https://m.qb5200.com/默认值为https://m.qb5200.com/stdouthttps://m.qb5200.com/,标准输出,若后台模式会输出到https://m.qb5200.com//dev/nullhttps://m.qb5200.com/。
logfilehttps://m.qb5200.com//var/log/redis/redis.log
#https://m.qb5200.com/可用数据库数
#https://m.qb5200.com/默认值为https://m.qb5200.com/16https://m.qb5200.com/,默认数据库为https://m.qb5200.com/0https://m.qb5200.com/,数据库范围在https://m.qb5200.com/0-https://m.qb5200.com/(https://m.qb5200.com/database-1https://m.qb5200.com/)之间
databaseshttps://m.qb5200.com/16
################################https://m.qb5200.com/快照#################################
#https://m.qb5200.com/保存数据到磁盘,格式如下https://m.qb5200.com/:
#https://m.qb5200.com/https://m.qb5200.com/savehttps://m.qb5200.com/<seconds>https://m.qb5200.com/<changes>
#https://m.qb5200.com/https://m.qb5200.com/指出在多长时间内,有多少次更新操作,就将数据同步到数据文件https://m.qb5200.com/rdbhttps://m.qb5200.com/。
#https://m.qb5200.com/https://m.qb5200.com/相当于条件触发抓取快照,这个可以多个条件配合
#https://m.qb5200.com/https://m.qb5200.com/比如默认配置文件中的设置,就设置了三个条件
#https://m.qb5200.com/https://m.qb5200.com/savehttps://m.qb5200.com/900https://m.qb5200.com/1https://m.qb5200.com/900https://m.qb5200.com/秒内至少有https://m.qb5200.com/1https://m.qb5200.com/个https://m.qb5200.com/keyhttps://m.qb5200.com/被改变
#https://m.qb5200.com/https://m.qb5200.com/savehttps://m.qb5200.com/300https://m.qb5200.com/10https://m.qb5200.com/300https://m.qb5200.com/秒内至少有https://m.qb5200.com/300https://m.qb5200.com/个https://m.qb5200.com/keyhttps://m.qb5200.com/被改变
#https://m.qb5200.com/https://m.qb5200.com/savehttps://m.qb5200.com/60https://m.qb5200.com/10000https://m.qb5200.com/60https://m.qb5200.com/秒内至少有https://m.qb5200.com/10000https://m.qb5200.com/个https://m.qb5200.com/keyhttps://m.qb5200.com/被改变
#https://m.qb5200.com/savehttps://m.qb5200.com/900https://m.qb5200.com/1
#https://m.qb5200.com/savehttps://m.qb5200.com/300https://m.qb5200.com/10
#https://m.qb5200.com/savehttps://m.qb5200.com/60https://m.qb5200.com/10000
#https://m.qb5200.com/后台存储错误停止写。
stop-writes-on-bgsave-errorhttps://m.qb5200.com/yes
#https://m.qb5200.com/存储至本地数据库时(持久化到https://m.qb5200.com/rdbhttps://m.qb5200.com/文件)是否压缩数据,默认为https://m.qb5200.com/yes
rdbcompressionhttps://m.qb5200.com/yes
#https://m.qb5200.com/RDBhttps://m.qb5200.com/文件的是否直接偶像https://m.qb5200.com/chcksum
rdbchecksumhttps://m.qb5200.com/yes
#https://m.qb5200.com/本地持久化数据库文件名,默认值为https://m.qb5200.com/dump.rdb
dbfilenamehttps://m.qb5200.com/dump.rdb
#https://m.qb5200.com/工作目录
#https://m.qb5200.com/数据库镜像备份的文件放置的路径。
#https://m.qb5200.com/这里的路径跟文件名要分开配置是因为https://m.qb5200.com/redishttps://m.qb5200.com/在进行备份时,先会将当前数据库的状态写入到一个临时文件中,等备份完成,
#https://m.qb5200.com/再把该该临时文件替换为上面所指定的文件,而这里的临时文件和上面所配置的备份文件都会放在这个指定的路径当中。
#https://m.qb5200.com/AOFhttps://m.qb5200.com/文件也会存放在这个目录下面
#https://m.qb5200.com/注意这里必须制定一个目录而不是文件
dirhttps://m.qb5200.com//var/lib/redis-server/
#################################https://m.qb5200.com/复制https://m.qb5200.com/#################################
#https://m.qb5200.com/主从复制https://m.qb5200.com/.https://m.qb5200.com/设置该数据库为其他数据库的从数据库https://m.qb5200.com/.
#https://m.qb5200.com/设置当本机为https://m.qb5200.com/slavhttps://m.qb5200.com/服务时,设置https://m.qb5200.com/masterhttps://m.qb5200.com/服务的https://m.qb5200.com/IPhttps://m.qb5200.com/地址及端口,在https://m.qb5200.com/Redishttps://m.qb5200.com/启动时,它会自动从https://m.qb5200.com/masterhttps://m.qb5200.com/进行数据同步
#https://m.qb5200.com/slaveofhttps://m.qb5200.com/<masterip><masterport>
#https://m.qb5200.com/当https://m.qb5200.com/masterhttps://m.qb5200.com/服务设置了密码保护时https://m.qb5200.com/(https://m.qb5200.com/用https://m.qb5200.com/requirepasshttps://m.qb5200.com/制定的密码https://m.qb5200.com/)
#https://m.qb5200.com/slavehttps://m.qb5200.com/服务连接https://m.qb5200.com/masterhttps://m.qb5200.com/的密码
#https://m.qb5200.com/masterauthhttps://m.qb5200.com/<master-password>
#https://m.qb5200.com/当从库同主机失去连接或者复制正在进行,从机库有两种运行方式:
#https://m.qb5200.com/1)https://m.qb5200.com/如果https://m.qb5200.com/slave-serve-stale-datahttps://m.qb5200.com/设置为https://m.qb5200.com/yes(https://m.qb5200.com/默认设置https://m.qb5200.com/)https://m.qb5200.com/,从库会继续响应客户端的请求
#https://m.qb5200.com/2)https://m.qb5200.com/如果https://m.qb5200.com/slave-serve-stale-datahttps://m.qb5200.com/是指为https://m.qb5200.com/nohttps://m.qb5200.com/,出去https://m.qb5200.com/INFOhttps://m.qb5200.com/和https://m.qb5200.com/SLAVOFhttps://m.qb5200.com/命令之外的任何请求都会返回一个
#https://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/错误https://m.qb5200.com/"SYNChttps://m.qb5200.com/withhttps://m.qb5200.com/masterhttps://m.qb5200.com/inhttps://m.qb5200.com/progress"
slave-serve-stale-datahttps://m.qb5200.com/yes
#https://m.qb5200.com/配置https://m.qb5200.com/slavehttps://m.qb5200.com/实例是否接受写。写https://m.qb5200.com/slavehttps://m.qb5200.com/对存储短暂数据(在同https://m.qb5200.com/masterhttps://m.qb5200.com/数据同步后可以很容易地被删除)是有用的,但未配置的情况下,客户端写可能会发送问题。
#https://m.qb5200.com/从https://m.qb5200.com/Redis2.6https://m.qb5200.com/后,默认https://m.qb5200.com/slavehttps://m.qb5200.com/为https://m.qb5200.com/read-only
slaveread-onlyhttps://m.qb5200.com/yes
#https://m.qb5200.com/从库会按照一个时间间隔向主库发送https://m.qb5200.com/PINGs.https://m.qb5200.com/可以通过https://m.qb5200.com/repl-ping-slave-periodhttps://m.qb5200.com/设置这个时间间隔,默认是https://m.qb5200.com/10https://m.qb5200.com/秒
#https://m.qb5200.com/repl-ping-slave-periodhttps://m.qb5200.com/10
#https://m.qb5200.com/repl-timeouthttps://m.qb5200.com/设置主库批量数据传输时间或者https://m.qb5200.com/pinghttps://m.qb5200.com/回复时间间隔,默认值是https://m.qb5200.com/60https://m.qb5200.com/秒
#https://m.qb5200.com/一定要确保https://m.qb5200.com/repl-timeouthttps://m.qb5200.com/大于https://m.qb5200.com/repl-ping-slave-period
#https://m.qb5200.com/repl-timeouthttps://m.qb5200.com/60
#https://m.qb5200.com/在https://m.qb5200.com/slavehttps://m.qb5200.com/sockethttps://m.qb5200.com/的https://m.qb5200.com/SYNChttps://m.qb5200.com/后禁用https://m.qb5200.com/TCP_NODELAY
#https://m.qb5200.com/如果选择“https://m.qb5200.com/yeshttps://m.qb5200.com/”https://m.qb5200.com/,Redishttps://m.qb5200.com/将使用一个较小的数字https://m.qb5200.com/TCPhttps://m.qb5200.com/数据包和更少的带宽将数据发送到https://m.qb5200.com/slavehttps://m.qb5200.com/,https://m.qb5200.com/但是这可能导致数据发送到https://m.qb5200.com/slavehttps://m.qb5200.com/端会有延迟https://m.qb5200.com/,https://m.qb5200.com/如果是https://m.qb5200.com/Linuxhttps://m.qb5200.com/kernelhttps://m.qb5200.com/的默认配置,会达到https://m.qb5200.com/40https://m.qb5200.com/毫秒https://m.qb5200.com/.
#https://m.qb5200.com/如果选择https://m.qb5200.com/"no"https://m.qb5200.com/,则发送数据到https://m.qb5200.com/slavehttps://m.qb5200.com/端的延迟会降低,但将使用更多的带宽用于复制https://m.qb5200.com/.
repl-disable-tcp-nodelayhttps://m.qb5200.com/no
#https://m.qb5200.com/设置复制的后台日志大小。
#https://m.qb5200.com/复制的后台日志越大,https://m.qb5200.com/slavehttps://m.qb5200.com/断开连接及后来可能执行部分复制花的时间就越长。
#https://m.qb5200.com/后台日志在至少有一个https://m.qb5200.com/slavehttps://m.qb5200.com/连接时,仅仅分配一次。
#https://m.qb5200.com/repl-backlog-sizehttps://m.qb5200.com/1mb
#https://m.qb5200.com/在https://m.qb5200.com/masterhttps://m.qb5200.com/不再连接https://m.qb5200.com/slavehttps://m.qb5200.com/后,后台日志将被释放。下面的配置定义从最后一个https://m.qb5200.com/slavehttps://m.qb5200.com/断开连接后需要释放的时间(秒)。
#https://m.qb5200.com/0https://m.qb5200.com/意味着从不释放后台日志
#https://m.qb5200.com/repl-backlog-ttlhttps://m.qb5200.com/3600
#https://m.qb5200.com/如果https://m.qb5200.com/masterhttps://m.qb5200.com/不能再正常工作,那么会在多个https://m.qb5200.com/slavehttps://m.qb5200.com/中,选择优先值最小的一个https://m.qb5200.com/slavehttps://m.qb5200.com/提升为https://m.qb5200.com/masterhttps://m.qb5200.com/,优先值为https://m.qb5200.com/0https://m.qb5200.com/表示不能提升为https://m.qb5200.com/masterhttps://m.qb5200.com/。
slave-priorityhttps://m.qb5200.com/100
#https://m.qb5200.com/如果少于https://m.qb5200.com/Nhttps://m.qb5200.com/个https://m.qb5200.com/slavehttps://m.qb5200.com/连接,且延迟时间https://m.qb5200.com/<=Mhttps://m.qb5200.com/秒,则https://m.qb5200.com/masterhttps://m.qb5200.com/可配置停止接受写操作。
#https://m.qb5200.com/例如需要至少https://m.qb5200.com/3https://m.qb5200.com/个https://m.qb5200.com/slavehttps://m.qb5200.com/连接,且延迟https://m.qb5200.com/<=10https://m.qb5200.com/秒的配置:
#https://m.qb5200.com/min-slaves-to-writehttps://m.qb5200.com/3
#https://m.qb5200.com/min-slaves-max-laghttps://m.qb5200.com/10
#https://m.qb5200.com/设置https://m.qb5200.com/0https://m.qb5200.com/为禁用
#https://m.qb5200.com/https://m.qb5200.com/默认https://m.qb5200.com/min-slaves-to-writehttps://m.qb5200.com/为https://m.qb5200.com/0https://m.qb5200.com/(禁用),https://m.qb5200.com/min-slaves-max-laghttps://m.qb5200.com/为https://m.qb5200.com/10
##################################https://m.qb5200.com/安全https://m.qb5200.com/###################################
#https://m.qb5200.com/设置客户端连接后进行任何其他指定前需要使用的密码。
#https://m.qb5200.com/警告:因为https://m.qb5200.com/redishttps://m.qb5200.com/速度相当快,所以在一台比较好的服务器下,一个外部的用户可以在一秒钟进行https://m.qb5200.com/150Khttps://m.qb5200.com/次的密码尝试,这意味着你需要指定非常非常强大的密码来防止暴力破解
#https://m.qb5200.com/requirepasshttps://m.qb5200.com/foobared
#https://m.qb5200.com/命令重命名https://m.qb5200.com/.
#https://m.qb5200.com/在一个共享环境下可以重命名相对危险的命令。比如把https://m.qb5200.com/CONFIGhttps://m.qb5200.com/重名为一个不容易猜测的字符。
#https://m.qb5200.com/举例https://m.qb5200.com/:
#https://m.qb5200.com/rename-commandhttps://m.qb5200.com/CONFIGhttps://m.qb5200.com/b840fc02d524045429941cc15f59e41cb7be6c52
#https://m.qb5200.com/如果想删除一个命令,直接把它重命名为一个空字符https://m.qb5200.com/""https://m.qb5200.com/即可,如下:
#https://m.qb5200.com/rename-commandhttps://m.qb5200.com/CONFIGhttps://m.qb5200.com/""
###################################https://m.qb5200.com/约束###################################
#设置同一时间最大客户端连接数,默认无限制,https://m.qb5200.com/
#Redishttps://m.qb5200.com/可以同时打开的客户端连接数为https://m.qb5200.com/Redishttps://m.qb5200.com/进程可以打开的最大文件描述符数,
#如果设置https://m.qb5200.com/maxclientshttps://m.qb5200.com/0https://m.qb5200.com/,表示不作限制。
#当客户端连接数到达限制时,https://m.qb5200.com/Redishttps://m.qb5200.com/会关闭新的连接并向客户端返回https://m.qb5200.com/maxhttps://m.qb5200.com/numberhttps://m.qb5200.com/ofhttps://m.qb5200.com/clientshttps://m.qb5200.com/reachedhttps://m.qb5200.com/错误信息
#https://m.qb5200.com/maxclientshttps://m.qb5200.com/10000
#https://m.qb5200.com/指定https://m.qb5200.com/Redishttps://m.qb5200.com/最大内存限制,https://m.qb5200.com/Redishttps://m.qb5200.com/在启动时会把数据加载到内存中,达到最大内存后,https://m.qb5200.com/Redishttps://m.qb5200.com/会按照清除策略尝试清除已到期的https://m.qb5200.com/Key
#https://m.qb5200.com/如果https://m.qb5200.com/Redishttps://m.qb5200.com/依照策略清除后无法提供足够空间,或者策略设置为https://m.qb5200.com/”noeviction”https://m.qb5200.com/,则使用更多空间的命令将会报错,例如https://m.qb5200.com/SET,https://m.qb5200.com/LPUSHhttps://m.qb5200.com/等。但仍然可以进行读取操作
#https://m.qb5200.com/注意:https://m.qb5200.com/Redishttps://m.qb5200.com/新的https://m.qb5200.com/vmhttps://m.qb5200.com/机制,会把https://m.qb5200.com/Keyhttps://m.qb5200.com/存放内存,https://m.qb5200.com/Valuehttps://m.qb5200.com/会存放在https://m.qb5200.com/swaphttps://m.qb5200.com/区
#https://m.qb5200.com/该选项对https://m.qb5200.com/LRUhttps://m.qb5200.com/策略很有用。
#https://m.qb5200.com/maxmemoryhttps://m.qb5200.com/的设置比较适合于把https://m.qb5200.com/redishttps://m.qb5200.com/当作于类似https://m.qb5200.com/memcachedhttps://m.qb5200.com/的缓存来使用,而不适合当做一个真实的https://m.qb5200.com/DBhttps://m.qb5200.com/。
#https://m.qb5200.com/当把https://m.qb5200.com/Redishttps://m.qb5200.com/当做一个真实的数据库使用的时候,内存使用将是一个很大的开销
#https://m.qb5200.com/maxmemoryhttps://m.qb5200.com/<bytes>
#https://m.qb5200.com/当内存达到最大值的时候https://m.qb5200.com/Redishttps://m.qb5200.com/会选择删除哪些数据?有五种方式可供选择
#https://m.qb5200.com/volatile-lruhttps://m.qb5200.com/->https://m.qb5200.com/利用https://m.qb5200.com/LRUhttps://m.qb5200.com/算法移除设置过过期时间的https://m.qb5200.com/keyhttps://m.qb5200.com/(LRU:https://m.qb5200.com/最近使用https://m.qb5200.com/Leasthttps://m.qb5200.com/RecentlyUsedhttps://m.qb5200.com/)
#https://m.qb5200.com/allkeys-lruhttps://m.qb5200.com/->https://m.qb5200.com/利用https://m.qb5200.com/LRUhttps://m.qb5200.com/算法移除任何https://m.qb5200.com/key
#https://m.qb5200.com/volatile-randomhttps://m.qb5200.com/->https://m.qb5200.com/移除设置过过期时间的随机https://m.qb5200.com/key
#https://m.qb5200.com/allkeys->randomhttps://m.qb5200.com/->https://m.qb5200.com/removehttps://m.qb5200.com/ahttps://m.qb5200.com/randomkey,https://m.qb5200.com/anyhttps://m.qb5200.com/key
#https://m.qb5200.com/volatile-ttlhttps://m.qb5200.com/->https://m.qb5200.com/移除即将过期的https://m.qb5200.com/key(minorhttps://m.qb5200.com/TTL)
#https://m.qb5200.com/noevictionhttps://m.qb5200.com/->https://m.qb5200.com/不移除任何可以,只是返回一个写错误
#https://m.qb5200.com/注意:对于上面的策略,如果没有合适的https://m.qb5200.com/keyhttps://m.qb5200.com/可以移除,当写的时候https://m.qb5200.com/Redishttps://m.qb5200.com/会返回一个错误
#https://m.qb5200.com/默认是https://m.qb5200.com/:https://m.qb5200.com/volatile-lru
#https://m.qb5200.com/maxmemory-policyhttps://m.qb5200.com/volatile-lruhttps://m.qb5200.com/
#https://m.qb5200.com/LRUhttps://m.qb5200.com/和https://m.qb5200.com/minimalhttps://m.qb5200.com/TTLhttps://m.qb5200.com/算法都不是精准的算法,但是相对精确的算法https://m.qb5200.com/(https://m.qb5200.com/为了节省内存https://m.qb5200.com/)https://m.qb5200.com/,随意你可以选择样本大小进行检测。
#https://m.qb5200.com/Redishttps://m.qb5200.com/默认的灰选择https://m.qb5200.com/3https://m.qb5200.com/个样本进行检测,你可以通过https://m.qb5200.com/maxmemory-sampleshttps://m.qb5200.com/进行设置
#https://m.qb5200.com/maxmemory-sampleshttps://m.qb5200.com/3
##############################https://m.qb5200.com/AOF###############################
#https://m.qb5200.com/默认情况下,https://m.qb5200.com/redishttps://m.qb5200.com/会在后台异步的把数据库镜像备份到磁盘,但是该备份是非常耗时的,而且备份也不能很频繁,如果发生诸如拉闸限电、拔插头等状况,那么将造成比较大范围的数据丢失。
#https://m.qb5200.com/所以https://m.qb5200.com/redishttps://m.qb5200.com/提供了另外一种更加高效的数据库备份及灾难恢复方式。
#https://m.qb5200.com/开启https://m.qb5200.com/appendhttps://m.qb5200.com/onlyhttps://m.qb5200.com/模式之后,https://m.qb5200.com/redishttps://m.qb5200.com/会把所接收到的每一次写操作请求都追加到https://m.qb5200.com/appendonly.aofhttps://m.qb5200.com/文件中,当https://m.qb5200.com/redishttps://m.qb5200.com/重新启动时,会从该文件恢复出之前的状态。
#https://m.qb5200.com/但是这样会造成https://m.qb5200.com/appendonly.aofhttps://m.qb5200.com/文件过大,所以https://m.qb5200.com/redishttps://m.qb5200.com/还支持了https://m.qb5200.com/BGREWRITEAOFhttps://m.qb5200.com/指令,对https://m.qb5200.com/appendonly.aofhttps://m.qb5200.com/进行重新整理。
#https://m.qb5200.com/你可以同时开启https://m.qb5200.com/asynchronoushttps://m.qb5200.com/dumpshttps://m.qb5200.com/和https://m.qb5200.com/AOF
appendonlyhttps://m.qb5200.com/no
#https://m.qb5200.com/AOFhttps://m.qb5200.com/文件名称https://m.qb5200.com/(https://m.qb5200.com/默认https://m.qb5200.com/:https://m.qb5200.com/"appendonly.aof")
#https://m.qb5200.com/appendfilenamehttps://m.qb5200.com/appendonly.aof
#https://m.qb5200.com/Redishttps://m.qb5200.com/支持三种同步https://m.qb5200.com/AOFhttps://m.qb5200.com/文件的策略https://m.qb5200.com/:
#https://m.qb5200.com/no:https://m.qb5200.com/不进行同步,系统去操作https://m.qb5200.com/.https://m.qb5200.com/Faster.
#https://m.qb5200.com/always:https://m.qb5200.com/alwayshttps://m.qb5200.com/表示每次有写操作都进行同步https://m.qb5200.com/.https://m.qb5200.com/Slow,https://m.qb5200.com/Safest.
#https://m.qb5200.com/everysec:https://m.qb5200.com/表示对写操作进行累积,每秒同步一次https://m.qb5200.com/.https://m.qb5200.com/Compromise.
#https://m.qb5200.com/默认是https://m.qb5200.com/"everysec"https://m.qb5200.com/,按照速度和安全折中这是最好的。
#https://m.qb5200.com/如果想让https://m.qb5200.com/Redishttps://m.qb5200.com/能更高效的运行,你也可以设置为https://m.qb5200.com/"no"https://m.qb5200.com/,让操作系统决定什么时候去执行
#https://m.qb5200.com/或者相反想让数据更安全你也可以设置为https://m.qb5200.com/"always"
#https://m.qb5200.com/如果不确定就用https://m.qb5200.com/"everysec".
#https://m.qb5200.com/appendfsynchttps://m.qb5200.com/always
appendfsynchttps://m.qb5200.com/everysec
#https://m.qb5200.com/appendfsynchttps://m.qb5200.com/no
#https://m.qb5200.com/AOFhttps://m.qb5200.com/策略设置为https://m.qb5200.com/alwayshttps://m.qb5200.com/或者https://m.qb5200.com/everysechttps://m.qb5200.com/时,后台处理进程https://m.qb5200.com/(https://m.qb5200.com/后台保存或者https://m.qb5200.com/AOFhttps://m.qb5200.com/日志重写https://m.qb5200.com/)https://m.qb5200.com/会执行大量的https://m.qb5200.com/I/Ohttps://m.qb5200.com/操作
#https://m.qb5200.com/在某些https://m.qb5200.com/Linuxhttps://m.qb5200.com/配置中会阻止过长的https://m.qb5200.com/fsync()https://m.qb5200.com/请求。注意现在没有任何修复,即使https://m.qb5200.com/fsynchttps://m.qb5200.com/在另外一个线程进行处理
#https://m.qb5200.com/为了减缓这个问题,可以设置下面这个参数https://m.qb5200.com/no-appendfsync-on-rewrite
no-appendfsync-on-rewritehttps://m.qb5200.com/no
#https://m.qb5200.com/AOFhttps://m.qb5200.com/自动重写
#https://m.qb5200.com/当https://m.qb5200.com/AOFhttps://m.qb5200.com/文件增长到一定大小的时候https://m.qb5200.com/Redishttps://m.qb5200.com/能够调用https://m.qb5200.com/BGREWRITEAOFhttps://m.qb5200.com/对日志文件进行重写
#https://m.qb5200.com/它是这样工作的:https://m.qb5200.com/Redishttps://m.qb5200.com/会记住上次进行些日志后文件的大小https://m.qb5200.com/(https://m.qb5200.com/如果从开机以来还没进行过重写,那日子大小在开机的时候确定https://m.qb5200.com/)
#https://m.qb5200.com/基础大小会同现在的大小进行比较。如果现在的大小比基础大小大制定的百分比,重写功能将启动
#https://m.qb5200.com/同时需要指定一个最小大小用于https://m.qb5200.com/AOFhttps://m.qb5200.com/重写,这个用于阻止即使文件很小但是增长幅度很大也去重写https://m.qb5200.com/AOFhttps://m.qb5200.com/文件的情况
#https://m.qb5200.com/设置https://m.qb5200.com/percentagehttps://m.qb5200.com/为https://m.qb5200.com/0https://m.qb5200.com/就关闭这个特性
auto-aof-rewrite-percentagehttps://m.qb5200.com/100
auto-aof-rewrite-min-sizehttps://m.qb5200.com/64mb
################################https://m.qb5200.com/LUASCRIPTINGhttps://m.qb5200.com/#############################
#https://m.qb5200.com/一个https://m.qb5200.com/Luahttps://m.qb5200.com/脚本最长的执行时间为https://m.qb5200.com/5000https://m.qb5200.com/毫秒(https://m.qb5200.com/5https://m.qb5200.com/秒),如果为https://m.qb5200.com/0https://m.qb5200.com/或负数表示无限执行时间。
lua-time-limithttps://m.qb5200.com/5000
################################LOWhttps://m.qb5200.com/LOG################################
#https://m.qb5200.com/Redishttps://m.qb5200.com/Slowhttps://m.qb5200.com/Loghttps://m.qb5200.com/记录超过特定执行时间的命令。执行时间不包括https://m.qb5200.com/I/Ohttps://m.qb5200.com/计算比如连接客户端,返回结果等,只是命令执行时间
#https://m.qb5200.com/可以通过两个参数设置https://m.qb5200.com/slowhttps://m.qb5200.com/loghttps://m.qb5200.com/:一个是告诉https://m.qb5200.com/Redishttps://m.qb5200.com/执行超过多少时间被记录的参数https://m.qb5200.com/slowlog-log-slower-than(https://m.qb5200.com/微妙https://m.qb5200.com/)https://m.qb5200.com/,
#https://m.qb5200.com/另一个是https://m.qb5200.com/slowhttps://m.qb5200.com/loghttps://m.qb5200.com/的长度。当一个新命令被记录的时候最早的命令将被从队列中移除
#https://m.qb5200.com/下面的时间以微妙为单位,因此https://m.qb5200.com/1000000https://m.qb5200.com/代表一秒。
#https://m.qb5200.com/注意指定一个负数将关闭慢日志,而设置为https://m.qb5200.com/0https://m.qb5200.com/将强制每个命令都会记录
slowlog-log-slower-thanhttps://m.qb5200.com/10000
#https://m.qb5200.com/对日志长度没有限制,只是要注意它会消耗内存
#https://m.qb5200.com/可以通过https://m.qb5200.com/SLOWLOGhttps://m.qb5200.com/RESEThttps://m.qb5200.com/回收被慢日志消耗的内存
#https://m.qb5200.com/推荐使用默认值https://m.qb5200.com/128https://m.qb5200.com/,当慢日志超过https://m.qb5200.com/128https://m.qb5200.com/时,最先进入队列的记录会被踢出
slowlog-max-lenhttps://m.qb5200.com/128
################################https://m.qb5200.com/事件通知https://m.qb5200.com/#############################
#https://m.qb5200.com/当事件发生时,https://m.qb5200.com/Redishttps://m.qb5200.com/可以通知https://m.qb5200.com/Pub/Subhttps://m.qb5200.com/客户端。
#https://m.qb5200.com/可以在下表中选择https://m.qb5200.com/Redishttps://m.qb5200.com/要通知的事件类型。事件类型由单个字符来标识:
#https://m.qb5200.com/Khttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/Keyspacehttps://m.qb5200.com/事件,以https://m.qb5200.com/_keyspace@<db>_https://m.qb5200.com/的前缀方式发布
#https://m.qb5200.com/Ehttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/Keyeventhttps://m.qb5200.com/事件,以https://m.qb5200.com/_keysevent@<db>_https://m.qb5200.com/的前缀方式发布
#https://m.qb5200.com/ghttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/通用事件(不指定类型),像https://m.qb5200.com/DEL,https://m.qb5200.com/EXPIRE,https://m.qb5200.com/RENAME,https://m.qb5200.com/…
#https://m.qb5200.com/$https://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/Stringhttps://m.qb5200.com/命令
#https://m.qb5200.com/shttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/Sethttps://m.qb5200.com/命令
#https://m.qb5200.com/hhttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/Hashhttps://m.qb5200.com/命令
#https://m.qb5200.com/zhttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/有序集合命令
#https://m.qb5200.com/xhttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/过期事件(每次https://m.qb5200.com/keyhttps://m.qb5200.com/过期时生成)
#https://m.qb5200.com/ehttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/清除事件(当https://m.qb5200.com/keyhttps://m.qb5200.com/在内存被清除时生成)
#https://m.qb5200.com/Ahttps://m.qb5200.com/https://m.qb5200.com/https://m.qb5200.com/g$lshzxehttps://m.qb5200.com/的别称,因此https://m.qb5200.com/”AKE”https://m.qb5200.com/意味着所有的事件
#https://m.qb5200.com/notify-keyspace-eventshttps://m.qb5200.com/带一个由https://m.qb5200.com/0https://m.qb5200.com/到多个字符组成的字符串参数。空字符串意思是通知被禁用。
#https://m.qb5200.com/例子:启用https://m.qb5200.com/listhttps://m.qb5200.com/和通用事件:
#https://m.qb5200.com/notify-keyspace-eventshttps://m.qb5200.com/Elg
#https://m.qb5200.com/默认所用的通知被禁用,因为用户通常不需要改特性,并且该特性会有性能损耗。
#https://m.qb5200.com/注意如果你不指定至少https://m.qb5200.com/Khttps://m.qb5200.com/或https://m.qb5200.com/Ehttps://m.qb5200.com/之一,不会发送任何事件。
notify-keyspace-eventshttps://m.qb5200.com/“”
##############################https://m.qb5200.com/高级配置https://m.qb5200.com/###############################
#https://m.qb5200.com/当https://m.qb5200.com/hashhttps://m.qb5200.com/中包含超过指定元素个数并且最大的元素没有超过临界时,
#https://m.qb5200.com/hashhttps://m.qb5200.com/将以一种特殊的编码方式(大大减少内存使用)来存储,这里可以设置这两个临界值
#https://m.qb5200.com/Redishttps://m.qb5200.com/Hashhttps://m.qb5200.com/对应https://m.qb5200.com/Valuehttps://m.qb5200.com/内部实际就是一个https://m.qb5200.com/HashMaphttps://m.qb5200.com/,实际这里会有https://m.qb5200.com/2https://m.qb5200.com/种不同实现,
#https://m.qb5200.com/这个https://m.qb5200.com/Hashhttps://m.qb5200.com/的成员比较少时https://m.qb5200.com/Redishttps://m.qb5200.com/为了节省内存会采用类似一维数组的方式来紧凑存储,而不会采用真正的https://m.qb5200.com/HashMaphttps://m.qb5200.com/结构,对应的https://m.qb5200.com/valueredisObjecthttps://m.qb5200.com/的https://m.qb5200.com/encodinghttps://m.qb5200.com/为https://m.qb5200.com/zipmap,
#https://m.qb5200.com/当成员数量增大时会自动转成真正的https://m.qb5200.com/HashMap,https://m.qb5200.com/此时https://m.qb5200.com/encodinghttps://m.qb5200.com/为https://m.qb5200.com/hthttps://m.qb5200.com/。
hash-max-zipmap-entrieshttps://m.qb5200.com/512
hash-max-zipmap-valuehttps://m.qb5200.com/64https://m.qb5200.com/
#https://m.qb5200.com/和https://m.qb5200.com/Hashhttps://m.qb5200.com/一样,多个小的https://m.qb5200.com/listhttps://m.qb5200.com/以特定的方式编码来节省空间。
#https://m.qb5200.com/listhttps://m.qb5200.com/数据类型节点值大小小于多少字节会采用紧凑存储格式。
list-max-ziplist-entrieshttps://m.qb5200.com/512
list-max-ziplist-valuehttps://m.qb5200.com/64
#https://m.qb5200.com/sethttps://m.qb5200.com/数据类型内部数据如果全部是数值型,且包含多少节点以下会采用紧凑格式存储。
set-max-intset-entrieshttps://m.qb5200.com/512
#https://m.qb5200.com/和https://m.qb5200.com/hashehttps://m.qb5200.com/和https://m.qb5200.com/listhttps://m.qb5200.com/一样https://m.qb5200.com/,https://m.qb5200.com/排序的https://m.qb5200.com/sethttps://m.qb5200.com/在指定的长度内以指定编码方式存储以节省空间
#https://m.qb5200.com/zsorthttps://m.qb5200.com/数据类型节点值大小小于多少字节会采用紧凑存储格式。
zset-max-ziplist-entrieshttps://m.qb5200.com/128
zset-max-ziplist-valuehttps://m.qb5200.com/64
#https://m.qb5200.com/Redishttps://m.qb5200.com/将在每https://m.qb5200.com/100https://m.qb5200.com/毫秒时使用https://m.qb5200.com/1https://m.qb5200.com/毫秒的https://m.qb5200.com/CPUhttps://m.qb5200.com/时间来对https://m.qb5200.com/redishttps://m.qb5200.com/的https://m.qb5200.com/hashhttps://m.qb5200.com/表进行重新https://m.qb5200.com/hashhttps://m.qb5200.com/,可以降低内存的使用
#https://m.qb5200.com/当你的使用场景中,有非常严格的实时性需要,不能够接受https://m.qb5200.com/Redishttps://m.qb5200.com/时不时的对请求有https://m.qb5200.com/2https://m.qb5200.com/毫秒的延迟的话,把这项配置为https://m.qb5200.com/nohttps://m.qb5200.com/。
#https://m.qb5200.com/如果没有这么严格的实时性要求,可以设置为https://m.qb5200.com/yeshttps://m.qb5200.com/,以便能够尽可能快的释放内存
activerehashinghttps://m.qb5200.com/yes
#https://m.qb5200.com/客户端的输出缓冲区的限制,因为某种原因客户端从服务器读取数据的速度不够快,
#https://m.qb5200.com/可用于强制断开连接(一个常见的原因是一个发布https://m.qb5200.com//https://m.qb5200.com/订阅客户端消费消息的速度无法赶上生产它们的速度)。
#https://m.qb5200.com/可以三种不同客户端的方式进行设置:
#https://m.qb5200.com/normalhttps://m.qb5200.com/->https://m.qb5200.com/正常客户端
#https://m.qb5200.com/slavehttps://m.qb5200.com/->https://m.qb5200.com/slavehttps://m.qb5200.com/和https://m.qb5200.com/MONITORhttps://m.qb5200.com/客户端
#https://m.qb5200.com/pubsubhttps://m.qb5200.com/->https://m.qb5200.com/至少订阅了一个https://m.qb5200.com/pubsubhttps://m.qb5200.com/channelhttps://m.qb5200.com/或https://m.qb5200.com/patternhttps://m.qb5200.com/的客户端
#https://m.qb5200.com/每个https://m.qb5200.com/client-output-buffer-limithttps://m.qb5200.com/语法https://m.qb5200.com/:
#https://m.qb5200.com/client-output-buffer-limithttps://m.qb5200.com/<class><hardhttps://m.qb5200.com/limit>https://m.qb5200.com/<softhttps://m.qb5200.com/limit>https://m.qb5200.com/<softhttps://m.qb5200.com/seconds>
#https://m.qb5200.com/一旦达到硬限制客户端会立即断开,或者达到软限制并保持达成的指定秒数(连续)。
#https://m.qb5200.com/例如,如果硬限制为https://m.qb5200.com/32https://m.qb5200.com/兆字节和软限制为https://m.qb5200.com/16https://m.qb5200.com/兆字节https://m.qb5200.com//10https://m.qb5200.com/秒,客户端将会立即断开
#https://m.qb5200.com/如果输出缓冲区的大小达到https://m.qb5200.com/32https://m.qb5200.com/兆字节,客户端达到https://m.qb5200.com/16https://m.qb5200.com/兆字节和连续超过了限制https://m.qb5200.com/10https://m.qb5200.com/秒,也将断开连接。
#https://m.qb5200.com/默认https://m.qb5200.com/normalhttps://m.qb5200.com/客户端不做限制,因为他们在一个请求后未要求时(以推的方式)不接收数据,
#https://m.qb5200.com/只有异步客户端可能会出现请求数据的速度比它可以读取的速度快的场景。
#https://m.qb5200.com/把硬限制和软限制都设置为https://m.qb5200.com/0https://m.qb5200.com/来禁用该特性
client-output-buffer-limithttps://m.qb5200.com/normalhttps://m.qb5200.com/0https://m.qb5200.com/0https://m.qb5200.com/0
client-output-buffer-limithttps://m.qb5200.com/slavehttps://m.qb5200.com/256mbhttps://m.qb5200.com/64mb60
client-output-buffer-limithttps://m.qb5200.com/pubsubhttps://m.qb5200.com/32mbhttps://m.qb5200.com/8mb60
#https://m.qb5200.com/Redishttps://m.qb5200.com/调用内部函数来执行许多后台任务,如关闭客户端超时的连接,清除过期的https://m.qb5200.com/Keyhttps://m.qb5200.com/,等等。
#https://m.qb5200.com/不是所有的任务都以相同的频率执行,但https://m.qb5200.com/Redishttps://m.qb5200.com/依照指定的“https://m.qb5200.com/Hzhttps://m.qb5200.com/”值来执行检查任务。
#https://m.qb5200.com/默认情况下,“https://m.qb5200.com/Hzhttps://m.qb5200.com/”的被设定为https://m.qb5200.com/10https://m.qb5200.com/。
#https://m.qb5200.com/提高该值将在https://m.qb5200.com/Redishttps://m.qb5200.com/空闲时使用更多的https://m.qb5200.com/CPUhttps://m.qb5200.com/时,但同时当有多个https://m.qb5200.com/keyhttps://m.qb5200.com/同时到期会使https://m.qb5200.com/Redishttps://m.qb5200.com/的反应更灵敏,以及超时可以更精确地处理。
#https://m.qb5200.com/范围是https://m.qb5200.com/1https://m.qb5200.com/到https://m.qb5200.com/500https://m.qb5200.com/之间,但是值超过https://m.qb5200.com/100https://m.qb5200.com/通常不是一个好主意。
#https://m.qb5200.com/大多数用户应该使用https://m.qb5200.com/10https://m.qb5200.com/这个预设值,只有在非常低的延迟的情况下有必要提高最大到https://m.qb5200.com/100https://m.qb5200.com/。
hzhttps://m.qb5200.com/10https://m.qb5200.com/
#https://m.qb5200.com/当一个子节点重写https://m.qb5200.com/AOFhttps://m.qb5200.com/文件时,如果启用下面的选项,则文件每生成https://m.qb5200.com/32Mhttps://m.qb5200.com/数据进行同步。
aof-rewrite-incremental-fsynchttps://m.qb5200.com/yes
加载全部内容