配置文件中SNAPSHOTTING

配置文件中SNAPSHOTTING

   张吉吉     2019年12月19日 00:42     1161    

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

#   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

#存 DB 到磁盘:

#    格式:save <间隔时间(秒)> <写入次数>

#    根据给定的时间间隔和写入次数将数据保存到磁盘

#    下面的例子的意思是:

#    900 秒内如果至少有 1 个 key 的值变化,则保存

#    300 秒内如果至少有 10 个 key 的值变化,则保存

#    60 秒内如果至少有 10000 个 key 的值变化,则保存 

#    注意:你可以注释掉所有的 save 行来停用保存功能。

#    也可以直接一个空字符串来实现停用:

#    save ""

 

# 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

#  如果用户开启了RDB快照功能,那么在redis持久化数据到磁盘时如果出现失败,默认情况下,redis会停止接受所有的写请求。

#  这样做的好处在于可以让用户很明确的知道内存中的数据和磁盘上的数据已经存在不一致了。

#  如果redis不顾这种不一致,一意孤行的继续接收写请求,就可能会引起一些灾难性的后果。

#  如果下一次RDB持久化成功,redis会自动恢复接受写请求。

#  如果不在乎这种数据不一致或者有其他的手段发现和控制这种不一致的话,可以关闭这个功能,

#  以便在快照写入失败时,也能确保redis继续接受新的写请求。

 

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

rdbcompression yes

#  对于存储到磁盘中的快照,可以设置是否进行压缩存储。

#  如果是的话,redis会采用LZF算法进行压缩。如果你不想消耗CPU来进行压缩的话,

#  可以设置为关闭此功能,但是存储在磁盘上的快照会比较大。

 

# 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

#  在存储快照后,我们还可以让redis使用CRC64算法来进行数据校验,但是这样做会增加大约10%的性能消耗,

#  如果希望获取到最大的性能提升,可以关闭此功能。

 

# The filename where to dump the DB

dbfilename dump.rdb

# 设置快照的文件名

 

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

#  设置快照文件的存放路径,这个配置项一定是个目录,而不能是文件名

 

文章评论

0

其他文章