当前位置:操作系统 > Unix/Linux >>

redis配置文件snapshotting RDB数据库快照部分

redis配置文件snapshotting RDB数据库快照部分
 
今天学习redis的rdb数据持久化,突发兴致,遂将配置文件的snapshotting部分翻译如下。
 
[python] 
################################ 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 at all commenting all the "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 an hard way) that data is not persisting  
# on disk properly, otherwise chances are that no one will notice and some  
# distater 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 usually 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?  
# 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  
  
# 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  
  
# 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 /opt/redis-2.6.10/data  
 
译文:
[python] 
################################ 快照  #################################  
#  
# Save the DB on disk:保存数据库到磁盘  
#  
#   save <秒> <更新>  
#  
#   如果指定的秒数和数据库写操作次数都满足了就将数据库保存。  
#  
#   下面是保存操作的实例:  
#   900秒(15分钟)内至少1个key值改变(则进行数据库保存--持久化)  
#   300秒(5分钟)内至少10个key值改变(则进行数据库保存--持久化)  
#   60秒(1分钟)内至少10000个key值改变(则进行数据库保存--持久化)  
#  
#   注释:注释掉“save”这一行配置项就可以让保存数据库功能失效。  
#  
#   你也可以通过增加一个只有一个空字符串的配置项(如下面的实例)来去掉前面的“save”配置。  
#  
#   save ""  
  
save 900 1  
save 300 10  
save 60 10000  
  
#在默认情况下,如果RDB快照持久化操作被激活(至少一个条件被激活)并且持久化操作失败,Redis则会停止接受更新操作。  
#这样会让用户了解到数据没有被正确的存储到磁盘上。否则没人会注意到这个问题,可能会造成灾难。  
#  
#如果后台存储(持久化)操作进程再次工作,Redis会自动允许更新操作。  
#  
#然而,如果你已经恰当的配置了对Redis服务器的监视和备份,你也许想关掉这项功能。  
#如此一来即使后台保存操作出错,redis也仍然可以继续像平常一样工作。  
stop-writes-on-bgsave-error yes  
  
#是否在导出.rdb数据库文件的时候采用LZF压缩字符串和对象?  
#默认情况下总是设置成‘yes’, 他看起来是一把双刃剑。  
#如果你想在存储的子进程中节省一些CPU就设置成'no',  
#但是这样如果你的kye/value是可压缩的,你的到处数据接就会很大。  
rdbcompression yes  
  
#从版本RDB版本5开始,一个CRC64的校验就被放在了文件末尾。  
#这会让格式更加耐攻击,但是当存储或者加载rbd文件的时候会有一个10%左右的性能下降,  
#所以,为了达到性能的最大化,你可以关掉这个配置项。  
#  
#没有校验的RDB文件会有一个0校验位,来告诉加载代码跳过校验检查。  
rdbchecksum yes  
  
# 导出数据库的文件名称  
dbfilename dump.rdb  
  
# 工作目录  
#  
# 导出的数据库会被写入这个目录,文件名就是上面'dbfilename'配置项指定的文件名。  
#   
# 只增的文件也会在这个目录创建(这句话没看明白)  
#   
# 注意你一定要在这个配置一个工作目录,而不是文件名称。  
dir /opt/redis-2.6.10/data  
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,