我不太明白,如果实例失败,备忘录中的数据会发生什么变化?由于写在写入磁盘之前首先被推送到内存中,如果一个实例失败,那么我们是否丢失了memtable尚未写入磁盘的所有信息?例如:
1) User 1 inserts something into Cassandra:
2) My application sees it has been inserted so it gives the user a notification it has been inserted.
3) The insert is inside the instance, and it fails before the commit log was full, so a flush did not occur to disk.用户1刚刚丢失了数据吗?
发布于 2015-09-22 01:16:32
这取决于您如何配置提交日志。默认情况是周期性的,这提供了更好的性能,但更少的持久性,或者您可以将其设置为批处理,直到它们被写入磁盘时才会进行写操作。请参阅更多信息here。
发布于 2015-09-22 04:15:44
简短的回答是,只有当(正如@Jim说的那样) commitlog_sync设置为periodic和,所有副本在收到消息后在commitlog_sync_period_in_ms内崩溃时,才会这样做。
发布于 2015-09-22 04:26:25
如果数据被写入提交日志,那么它肯定不会丢失(除非磁盘损坏)。当节点再次启动时,未刷新的数据将从提交日志中重放。
当数据被写入提交日志时,周期性/批处理选项会产生影响。如果节点在写入提交日志之前失败,则只有在单个复制因子中才可能丢失数据。如果复制因子超过一个,那么所有节点都必须同时下降,才能丢失数据。
https://stackoverflow.com/questions/32705992
复制相似问题