cassandra啟動失敗——cassandra總結(四)


  最近莫名其妙的cassandra不能啟動了,查看登錄日志后終於找到了原因。(登錄日志位於與$CASSANDRA_HOME同級目錄的cassandra文件夾中)

  先看下錯誤報告

ERROR [SSTableBatchOpen:2] 2015-11-26 21:59:06,933 FileUtils.java:447 - Exiting forcefully due to file system exception on startup, disk failure policy "stop"
org.apache.cassandra.io.FSReadError: java.io.IOException: Compressed file with 0 chunks encountered: java.io.DataInputStream@19447b3

  SSTable打開失敗,原因是SSTable損壞了,看下老外的說法

Having some replication would surely help you to fix this without data loss but it would come with a price.

Despite all your effort you cannot manage to recover your corrupted sstable. So you decide to remove it from your file system to start Cassandra again. If you do not have replication your data is lost. But if you have replication on the cluster, you can possibly fetch the data from other nodes. That is what nodetool repair do !

So nodetool repair does not repair corrupted sstable. Basicallynodetool repair compare tables from node to node to find missing or inconsistent data and then repair it. You can find more information on how it works here.

However nodetool repair is very expensive, it is long and uses a lot of cpu, disk and network. There is this good post about repair benefits and drawbacks.

  遇到SSTable損壞這種問題解決辦法就是刪掉數據然后重啟cassandra,由於我采用的單節點所以數據自然就沒有備份了,很坑的說,不過好在只有幾萬條分析數據,再插入進去就好了。如果是集群的話就可以用nodetool repair從別的節點把備份數據取過來了,但是代價很大,會花費大量的時間,占用大量的CPU。所以最好還是做好備份了。

  在刪除掉數據重啟后,輕松啟動成功。啟動成功日志文件的最后一行表現是:

INFO  [Thread-2] 2015-11-27 16:30:52,550 ThriftServer.java:136 - Listening for thrift clients...

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM