1

I was reading this article about Tarantool and they seem to say that AOF and WAL log are not working the same way.

Tarantool: besides snapshots, it has a full-scale WAL (write ahead log). So it can secure data persistency after each transaction out-of-the-box. Redis: in fact, it has snapshots only. Technically, you have AOF (append-only file, where all the operations are written), but it requires manual control over it, including manual restore after reboot. Simply put, with Redis you need to manually suspend the server now and then, make snapshots and archive AOF.

Could someone explain more clearly what is the different between the 2 strategy and how each work at a high level.

I always assumed that Redis AOF was working the same way to a SQL database transaction log such as implemented in Postgresql but I might have been wrong.

4

2 回答 2

6

AOF 是 Redis 的主要持久性选项。每当有修改内存中数据集的写入操作时,都会记录该操作。因此,在重新启动期间,Redis 将重播所有操作以重建数据集。您还可以选择 3 种不同的 fsync 配置策略(不,每秒,总是)。FWIW,如果您想要良好的数据安全水平,通常建议同时使用 AOF + RDB。这有点超出您的问题范围,但我想我会提到它。

主要 Redis 持久性文档

Redis 持久性揭秘

Tarantool 使用一种叫做“WAL writer”的东西。这将在单独的线程中运行并记录操作数据“插入和更新请求”的请求。重新启动时,Tarantool 通过读取 WAL 文件并重放每个请求来恢复。

Tarantool 持久性文档

内部结构显然存在差异,但在高层次上它们非常相似。文章中的持久性比较很奇怪,根本不正确。

有关低级别差异的更多信息,请参阅上面列出的文档。

希望有帮助

于 2016-12-04T17:16:04.560 回答
2

雷迪斯:

  • IIRC,Redis 在它服务请求的同一线程中写入日志。如果磁盘由于某种原因很慢(RDB 写入、AOF 重写),这会导致停顿:单次写入操作可能会冻结整个服务线程,直到write系统调用完成。
  • Redis 无法使用 AOF 进行复制还原,因为 AOF 不包含操作位置。Replica 只能依赖 master 的内存缓冲区,如果缓冲区不够大,无法容纳自上一个快照启动后的操作,则重新请求完整快照。我在半小时内有一次未恢复的副本,直到我认出它并手动增加了 master 的缓冲区大小。

塔兰图尔:

  • Tarantool 在一个单独的线程中编写 WAL,事务线程与它异步对话。可能有很多写操作同时等待 WAL,而读操作根本没有被阻塞。
  • Tarantool 将 LSN 存储在 WAL 中,副本可以使用 WAL 进行恢复,即使它已关闭数小时。Replica 甚至没有“重新请求快照”操作,因为实际上它永远不会滞后到 master 上没有足够的 WAL。
于 2021-10-01T06:54:59.260 回答