与hector客户端插入数据时cassandra中的异常

时间:2014-02-13 07:39:07

标签: cassandra hector

从hector客户端插入数据时,我的间歇性低于异常。

正在客户端捕获以下异常。

Exception: me.prettyprint.hector.api.exceptions.HectorException: All host pools marked down. Retry burden pushed out to client.
        at me.prettyprint.cassandra.connection.HConnectionManager.getClientFromLBPolicy(HConnectionManager.java:393)
        at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:249)
        at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecuteOperation(ExecutingKeyspace.java:97)
        at me.prettyprint.cassandra.model.MutatorImpl.execute(MutatorImpl.java:243)
        at com.snapdeal.coms.service.CommonCassandraService.saveObject(CommonCassandraService.java:245)
        at com.snapdeal.coms.timemachine.service.COMSCassandraService.saveUpdatedUploadId(COMSCassandraService.java:91)
        at com.snapdeal.coms.timemachine.event.ProductStateUpdateEventHandler.handleEvent(ProductStateUpdateEventHandler.java:38)
        at com.snapdeal.coms.timemachine.TimeMachine.onEvent(TimeMachine.java:106)
        at com.snapdeal.coms.kafka.KafkaEventListenerContainer$KafkaConsumer.safeRun(KafkaEventListenerContainer.java:158)
        at com.snapdeal.coms.kafka.KafkaEventListenerContainer$KafkaConsumer.run(KafkaEventListenerContainer.java:175)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

我检查了Cassandra日志并同时获得了Exception。

DEBUG [Thrift:230] 2014-02-13 12:31:34,785 CustomTThreadPoolServer.java (line 209) Thrift transport error occurred during processing of message.
org.apache.thrift.transport.TTransportException
        at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
        at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
        at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
        at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
        at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
        at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:22)
        at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:24)

以下是我的cassandra verion和hector客户端版本

Cassandra-version : 1.2.11
Hector client : 1.0-2

目前我的cassandra客户端中只配置了1个节点。 thrift_framed_transport_size_in_mb在我的cassandra.yaml中配置了15mb。问题是我间歇性地得到这个例外,因为cassandra没有捕获一些事件。

1 个答案:

答案 0 :(得分:1)

您的hector客户端版本相当陈旧,您应该升级它。我认为你会看到兼容性问题,因为过时的libthrift。

如果您正在使用maven,则可以将cassandra-thrift声明为与Cassandra服务器版本的显式依赖关系。这将覆盖hector-core引入的过时版本。

<dependency>
    <groupId>org.apache.cassandra</groupId>
    <artifactId>cassandra-thrift</artifactId>
    <version>${cassandra-version}</version>
</dependency>

使用Cassandra 1.2.6和Hector 1.1-4,这对我们有用。