Is redis a durable datastore? Is redis a durable datastore? database database

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 configurehow many times Redis will fsync() dataon disk. There are three options:

  • Fsync() every time a new command isappended to the append log file. Veryvery slow, very safe.
  • Fsync() one timeevery second. Fast enough, and you canlose 1 second of data if there is adisaster.
  • Never fsync(), just put yourdata in the hands of the OperatingSystem. 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.)