我不小心截断了Cassandra中的一个表。我想知道是否有任何工具可用于恢复其中的数据。任何帮助将不胜感激。谢谢。
auto_snapshot (默认值:true(
卡桑德拉是否拍摄快照 截断键空间或删除表之前的数据。为了防止 数据丢失,DataStax强烈建议使用默认设置。如果你 auto_snapshot设置为 false,则在截断或删除时会发生数据丢失。
(摘自 https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configCassandra_yaml.html(
如果幸运的话,请查看旧马厩的快照目录。为了恢复它们,"只需要"将其复制回其原始位置。
以下是发生的情况:
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/backups
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Data.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Index.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Filter.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Summary.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Digest.crc32
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-CompressionInfo.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-Statistics.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/mc-1-big-TOC.txt
然后我发布了TRUNCATE demokeyspace.demo
- 之后它是这样的:
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/backups
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Summary.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-TOC.txt
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Digest.crc32
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Filter.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-CompressionInfo.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Index.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Data.db
./data1/demokeyspace/demo-0d1a38b05fe211e8875d13cbb58d64f2/snapshots/truncated-1527228644868-demo/mc-1-big-Statistics.db
只需将这些文件复制回来即可。但请记住,您需要在所有节点上执行此操作,然后运行nodetool refresh demokeyspace demo
以重新读取表(当然使用您的键空间和列系列(。