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



原文:    http://blog.csdn.net/wkupaochuan/article/details/8773527

初次翻译,多有纰漏,敬请指正。

今天学习redis的rdb数据持久化,突发兴致,遂将配置文件的snapshotting部分翻译如下。


  1. ################################ SNAPSHOTTING  #################################  
  2. #  
  3. # Save the DB on disk:  
  4. #  
  5. #   save <seconds> <changes>  
  6. #  
  7. #   Will save the DB if both the given number of seconds and the given  
  8. #   number of write operations against the DB occurred.  
  9. #  
  10. #   In the example below the behaviour will be to save:  
  11. #   after 900 sec (15 min) if at least 1 key changed  
  12. #   after 300 sec (5 min) if at least 10 keys changed  
  13. #   after 60 sec if at least 10000 keys changed  
  14. #  
  15. #   Note: you can disable saving at all commenting all the "save" lines.  
  16. #  
  17. #   It is also possible to remove all the previously configured save  
  18. #   points by adding a save directive with a single empty string argument  
  19. #   like in the following example:  
  20. #  
  21. #   save ""  
  22.   
  23. save 900 1  
  24. save 300 10  
  25. save 60 10000  
  26.   
  27. # By default Redis will stop accepting writes if RDB snapshots are enabled  
  28. # (at least one save point) and the latest background save failed.  
  29. # This will make the user aware (in an hard way) that data is not persisting  
  30. # on disk properly, otherwise chances are that no one will notice and some  
  31. # distater will happen.  
  32. #  
  33. # If the background saving process will start working again Redis will  
  34. # automatically allow writes again.  
  35. #  
  36. # However if you have setup your proper monitoring of the Redis server  
  37. # and persistence, you may want to disable this feature so that Redis will  
  38. # continue to work as usually even if there are problems with disk,  
  39. # permissions, and so forth.  
  40. stop-writes-on-bgsave-error yes  
  41.   
  42. # Compress string objects using LZF when dump .rdb databases?  
  43. # For default that's set to 'yes' as it's almost always a win.  
  44. # If you want to save some CPU in the saving child set it to 'no' but  
  45. # the dataset will likely be bigger if you have compressible values or keys.  
  46. rdbcompression yes  
  47.   
  48. # Since version 5 of RDB a CRC64 checksum is placed at the end of the file.  
  49. # This makes the format more resistant to corruption but there is a performance  
  50. # hit to pay (around 10%) when saving and loading RDB files, so you can disable it  
  51. # for maximum performances.  
  52. #  
  53. # RDB files created with checksum disabled have a checksum of zero that will  
  54. # tell the loading code to skip the check.  
  55. rdbchecksum yes  
  56.   
  57. # The filename where to dump the DB  
  58. dbfilename dump.rdb  
  59.   
  60. # The working directory.  
  61. #  
  62. # The DB will be written inside this directory, with the filename specified  
  63. # above using the 'dbfilename' configuration directive.  
  64.   
  65. # The Append Only File will also be created inside this directory.  
  66.   
  67. # Note that you must specify a directory here, not a file name.  
  68. dir /opt/redis-2.6.10/data  
################################ 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

译文:

  1. ################################ 快照  #################################  
  2. #  
  3. # Save the DB on disk:保存数据库到磁盘  
  4. #  
  5. #   save <秒> <更新>  
  6. #  
  7. #   如果指定的秒数和数据库写操作次数都满足了就将数据库保存。  
  8. #  
  9. #   下面是保存操作的实例:  
  10. #   900秒(15分钟)内至少1个key值改变(则进行数据库保存--持久化)  
  11. #   300秒(5分钟)内至少10个key值改变(则进行数据库保存--持久化)  
  12. #   60秒(1分钟)内至少10000个key值改变(则进行数据库保存--持久化)  
  13. #  
  14. #   注释:注释掉“save”这一行配置项就可以让保存数据库功能失效。  
  15. #  
  16. #   你也可以通过增加一个只有一个空字符串的配置项(如下面的实例)来去掉前面的“save”配置。  
  17. #  
  18. #   save ""  
  19.   
  20. save 900 1  
  21. save 300 10  
  22. save 60 10000  
  23.   
  24. #在默认情况下,如果RDB快照持久化操作被激活(至少一个条件被激活)并且持久化操作失败,Redis则会停止接受更新操作。  
  25. #这样会让用户了解到数据没有被正确的存储到磁盘上。否则没人会注意到这个问题,可能会造成灾难。  
  26. #  
  27. #如果后台存储(持久化)操作进程再次工作,Redis会自动允许更新操作。  
  28. #  
  29. #然而,如果你已经恰当的配置了对Redis服务器的监视和备份,你也许想关掉这项功能。  
  30. #如此一来即使后台保存操作出错,redis也仍然可以继续像平常一样工作。  
  31. stop-writes-on-bgsave-error yes  
  32.   
  33. #是否在导出.rdb数据库文件的时候采用LZF压缩字符串和对象?  
  34. #默认情况下总是设置成‘yes’, 他看起来是一把双刃剑。  
  35. #如果你想在存储的子进程中节省一些CPU就设置成'no',  
  36. #但是这样如果你的kye/value是可压缩的,你的到处数据接就会很大。  
  37. rdbcompression yes  
  38.   
  39. #从版本RDB版本5开始,一个CRC64的校验就被放在了文件末尾。  
  40. #这会让格式更加耐攻击,但是当存储或者加载rbd文件的时候会有一个10%左右的性能下降,  
  41. #所以,为了达到性能的最大化,你可以关掉这个配置项。  
  42. #  
  43. #没有校验的RDB文件会有一个0校验位,来告诉加载代码跳过校验检查。  
  44. rdbchecksum yes  
  45.   
  46. # 导出数据库的文件名称  
  47. dbfilename dump.rdb  
  48.   
  49. # 工作目录  
  50. #  
  51. # 导出的数据库会被写入这个目录,文件名就是上面'dbfilename'配置项指定的文件名。  
  52.   
  53. # 只增的文件也会在这个目录创建(这句话没看明白)  
  54.   
  55. # 注意你一定要在这个配置一个工作目录,而不是文件名称。  
  56. dir /opt/redis-2.6.10/data  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值