1. 程式人生 > >Redis RDB和AOF

Redis RDB和AOF

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.


預設情況下 Redis 非同步轉儲資料在磁碟。這個模式是足夠好了在很多應用,

但是有一個問題Redis process或者一個斷電可能導致幾分鐘寫丟失(取決於配置的save points).


The Append Only File 是另一種持久化模式提供更多的永續性。

對於例項使用預設的資料fsync策略

Redis 可以只丟失寫的一秒在一個戲劇性的問題像一個斷電,

或者一個單獨的寫如果有一些錯誤Redis 本身遇到的,但是作業系統仍舊執行正確。

AOF 和RDB 持久化可以同時啟動沒有問題。

如果AOF 是啟用的在Redis啟動時會載入AOF