4

我在运行 apache-cassandra 3.3 时意外关闭了 Mac OS X。在新的引导加载中重新启动 cassandra 时,出现以下错误:

INFO  15:25:15 Replaying /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351786.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351787.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461942807785.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461943004975.log
ERROR 15:25:15 Exiting due to error while processing commit log during initialization.
org.apache.cassandra.db.commitlog.CommitLogReplayer$CommitLogReplayException: Encountered bad header at position 542295 of commit log /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351786.log, with bad position but valid CRC
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.handleReplayError(CommitLogReplayer.java:611) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.SegmentReader$SegmentIterator.computeNext(SegmentReader.java:105) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.SegmentReader$SegmentIterator.computeNext(SegmentReader.java:78) [apache-cassandra-3.5.jar:3.5]
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) [guava-18.0.jar:na]
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) [guava-18.0.jar:na]
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:399) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:236) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:192) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:172) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:283) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:680) [apache-cassandra-3.5.jar:3.5]

我在堆栈溢出和谷歌上搜索并没有找到同样问题的帖子。我发现了问题https://issues.apache.org/jira/browse/CASSANDRA-9749,这是相关的,但是这个问题被标记为已解决,并且与检测到问题后继续执行有关,而不是因异常而失败。

在这种情况下我该怎么办?是否有任何恢复路径(假设没有可用的快照)?有什么方法可以在违规记录处截断提交日志?有什么工具可以修复错误的标题(例如删除记录)?

谢谢。

4

3 回答 3

9

在 Mac OS 上玩本地 Cassandra 时,我有时也会遇到这个异常。

如果您不关心丢失提交日志中的数据,或者您在某处有备份,只需停止 Cassandra,清理commitlog文件夹并重新启动。

恐怕没有其他选择。顺便说一句,您是否在 Mac OS 上部署 Cassandra 进行生产?

  • 如果是,您应该知道 Mac OS 不受官方支持
  • 如果不是用于生产,那么谁在乎,只需清理commitlog并重新启动
于 2016-04-29T16:41:31.463 回答
2

在 Windows 7(本地机器)环境中运行 Cassandra 时,我遇到了类似的问题。我从日志中发现的异常是

ERROR 07:14:35 由于在初始化期间处理提交日志时出错而退出。org.apache.cassandra.db.commitlog.CommitLogReplayer$CommitLogReplayException:无法读取 org.apache.cassandra 的文件 C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1470969948498.log 中的提交日志描述符。 db.commitlog.CommitLogReplayer.handleReplayError(CommitLogReplayer.java:616) [apache-cassandra-3.7.0.jar:3.7.0] 在 org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:378) [apache-cassandra-3.7.0.jar:3.7.0]

由于这只是一个测试设置,我删除了那个特定的提交日志文件并从 Windows 服务管理器重新启动它,它完美地启动了。我不确定如果它发生在生产环境中该怎么办。

于 2016-08-12T07:43:07.737 回答
0

我第二次在我的单节点开发人员系统上得到这个。如果 jvm 被意外杀死,似乎能够发生。清除提交日志目录解决了它。使用 Windows 10。

让我担心的是,即使没有对数据库进行更新,我也会遇到这些错误问题。cassandra 不会定期冲洗。即使我有副本节点,我也不希望仅仅因为服务器崩溃或类似情况而在生产中出现此类问题。

在标准输出日志中,最后一部分是

INFO  06:17:39 Replaying C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471353812251.log, C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471353812252.log, C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471411951134.log, C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471454506802.log, C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471532812678.log
ERROR 06:17:39 Exiting due to error while processing commit log during initialization.
org.apache.cassandra.db.commitlog.CommitLogReplayer$CommitLogReplayException: Could not read commit log descriptor in file C:\Program Files\DataStax-DDC\data\commitlog\CommitLog-6-1471353812252.log
    at org.apache.cassandra.db.commitlog.CommitLogReplayer.handleReplayError(CommitLogReplayer.java:611) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:373) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:236) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:192) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:172) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:283) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551) [apache-cassandra-3.4.0.jar:3.4.0]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:680) [apache-cassandra-3.4.0.jar:3.4.0]
于 2016-08-19T06:31:45.130 回答