我们在这样的环境中操作 Cassandra,其中运行 Cassandra 的主机偶尔会在未正确关闭的情况下断电。我们可以接受丢失数据,但我们的问题是,在极少数情况下,Cassadra在非正常关闭后无法启动。然后由于提交日志损坏而导致启动失败:
ERROR [main] 2024-05-02 12:39:13,834 JVMStabilityInspector.java:196 - Exiting due to error while processing commit log during initialization.
org.apache.cassandra.db.commitlog.CommitLogReadHandler$CommitLogReadException: Mutation checksum failure at 2378 in Next section at 2016 in CommitLog-7-1714580480939.log
at org.apache.cassandra.db.commitlog.CommitLogReader.readSection(CommitLogReader.java:387)
at org.apache.cassandra.db.commitlog.CommitLogReader.readCommitLogSegment(CommitLogReader.java:244)
at org.apache.cassandra.db.commitlog.CommitLogReader.readCommitLogSegment(CommitLogReader.java:147)
at org.apache.cassandra.db.commitlog.CommitLogReplayer.replayFiles(CommitLogReplayer.java:191)
at org.apache.cassandra.db.commitlog.CommitLog.recoverFiles(CommitLog.java:223)
at org.apache.cassandra.db.commitlog.CommitLog.recoverSegmentsOnDisk(CommitLog.java:204)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:353)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:744)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:878)
我们发现了“ cassandra.commitlog.ignorereplayerrors ”选项,它似乎会影响处理提交日志时的错误处理。关于此设置的一些问题:
- 如果可以接受丢失写入 Cassandra 的数据,那么启用此设置是否安全?
- 启用此设置时是否会忽略所有提交日志损坏,或者 Cassandra 仍然无法启动?请注意,我们的关键要求是 Cassandra 能够在断电后无需人工干预即可启动。
- 提交日志损坏发生后是否应该执行“nodetool repair”?