下面是cassandra 3.4.0的cassandra批量加载程序示例https://github.com/yukim/cassandra-bulkload-example . 数据文件在数据文件夹下生成。具体如下:
quote-historical_prices-ka-1-CompressionInfo.db quote-historical_prices-ka-1-Index.db
quote-historical_prices-ka-1-Data.db quote-historical_prices-ka-1-Statistics.db
quote-historical_prices-ka-1-Digest.sha1 quote-historical_prices-ka-1-TOC.txt
quote-historical_prices-ka-1-Filter.db
但是,当尝试使用 sstableloader -d 127.0.0.1 ~/workspace/cassandra-bulkload-example/data/quote/historical_prices/
我得到一个错误如下:
Established connection to initial hosts
Opening sstables and calculating sections to stream
Failed to list files in /home/srai/workspace/cassandra-bulkload-example/data/quote/historical_prices
java.lang.NullPointerException
java.lang.RuntimeException: Failed to list files in /home/srai/workspace/cassandra-bulkload-example/data/quote/historical_prices
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:53)
at org.apache.cassandra.db.lifecycle.LifecycleTransaction.getFiles(LifecycleTransaction.java:544)
at org.apache.cassandra.io.sstable.SSTableLoader.openSSTables(SSTableLoader.java:76)
at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:165)
at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:80)
at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:48)
Caused by: java.lang.NullPointerException
at org.apache.cassandra.io.sstable.format.SSTableReader.openForBatch(SSTableReader.java:431)
at org.apache.cassandra.io.sstable.SSTableLoader.lambda$openSSTables$220(SSTableLoader.java:121)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.lambda$innerList$208(LogAwareFileLister.java:75)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.TreeMap$EntrySpliterator.forEachRemaining(TreeMap.java:2965)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.innerList(LogAwareFileLister.java:77)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:49)
... 5 more
Exception in thread "main" org.apache.cassandra.tools.BulkLoadException: java.lang.RuntimeException: Failed to list files in /home/srai/workspace/cassandra-bulkload-example/data/quote/historical_prices
at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:93)
at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:48)
Caused by: java.lang.RuntimeException: Failed to list files in /home/srai/workspace/cassandra-bulkload-example/data/quote/historical_prices
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:53)
at org.apache.cassandra.db.lifecycle.LifecycleTransaction.getFiles(LifecycleTransaction.java:544)
at org.apache.cassandra.io.sstable.SSTableLoader.openSSTables(SSTableLoader.java:76)
at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:165)
at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:80)
... 1 more
Caused by: java.lang.NullPointerException
at org.apache.cassandra.io.sstable.format.SSTableReader.openForBatch(SSTableReader.java:431)
at org.apache.cassandra.io.sstable.SSTableLoader.lambda$openSSTables$220(SSTableLoader.java:121)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.lambda$innerList$208(LogAwareFileLister.java:75)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.TreeMap$EntrySpliterator.forEachRemaining(TreeMap.java:2965)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.innerList(LogAwareFileLister.java:77)
at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:49)
... 5 more
1条答案
按热度按时间km0tfn4u1#
默认情况下,bulk loader示例为2.1.12构建sstables。流<3.0.0表不受支持,这是因为在cassandra-10940之前没有跳过或提供良好的错误。然而,在3.5版本中,他们将在cassandra-10990中再次开始支持它。
所以要么在更新的版本中构建sstables,要么等待3.5版本。