redis 的备份策略,最好使用:RDB-AOF 混合持久化

相关资料:

  1. Redis 4.0 新功能简介:RDB-AOF 混合持久化:http://blog.huangz.me/2017/redis-rdb-aof-mixed-persistence.html
  2. 持久化(persistence):http://redisdoc.com/topic/persistence.html?highlight=持久化
############################## APPEND ONLY MODE ###############################

# By default Redis asynchronously dumps the dataset on disk. This mode is
# good enough in many applications, but an issue with the Redis process or
# a power outage may result into a few minutes of writes lost (depending on
# the configured save points).
#
# The Append Only File is an alternative persistence mode that provides
# much better durability. For instance using the default data fsync policy
# (see later in the config file) Redis can lose just one second of writes in a
# dramatic event like a server power outage, or a single write if something
# wrong with the Redis process itself happens, but the operating system is
# still running correctly.
#
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
#
# Please check http://redis.io/topics/persistence for more information. appendonly no

自己翻译:

默认情况下,Redis 异步保存数据库到磁盘。这个模式适用于很多应用,但是 Redis 进程出错或者断电,会导致几分钟的写数据丢失(依赖于 `save` 配置项)。
AOF 是另一个持久化策略,它提供了更好的持久性。如果使用了默认的 AOF 数据 `fsync` 策略,当断电或 Redis 服务器进程出错,Redis 仅丢失一秒钟的写数据。
AOF 和 RDB 持久化策略,可以同时启用。如果启用了 AOF,Redis 启动时,将优先使用 AOF 文件进行数据库还原。
上一篇:重载(overload)、覆盖(override)、隐藏(hide)的区别


下一篇:C#之异步编程