Is redis a durable datastore?

Redis is not usually deployed as a “durable” datastore (in the sense of the “D” in ACID.), even with journaling. Most use cases intentionally sacrifice a little durability in return for speed.

However, the “append only file” storage mode can optionally be configured to operate in a durable manner, at the cost of performance. It will have to pay for an fsync() on every modification. To configure this, set these two options in your .conf file:

 appendonly yes
 appendfsync always

From the docs: How durable is the append only file?

Check redis.conf, you can configure
how many times Redis will fsync() data
on disk. There are three options:

  • Fsync() every time a new command is
    appended to the append log file. Very
    very slow, very safe.
  • Fsync() one time
    every second. Fast enough, and you can
    lose 1 second of data if there is a
    disaster.
  • Never fsync(), just put your
    data in the hands of the Operating
    System. The faster and unsafer method.

(Note that the default for appendfsync in the configuration file shipping with Redis post-2.0.0 is everysec, and not always.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)