1

我是 cassandra 的新手,只知道它的基础知识。我在 cassandra 中经常遇到异常。我正在使用节俭的 API 单节点 cassandra。主要是我在写,但那些涉及现有的检查。

我尝试read_request_timeout_in_ms从 10 秒增加到一个非常大的数字:9480 秒。然后我也遇到了超时错误。我不知道这背后的确切原因。

这是堆栈跟踪:

org.apache.thrift.transport.TTransportException: java.net.SocketTimeoutException: Read timed out    
    at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:129)
    at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
    at org.apache.thrift.transport.TFastFramedTransport.readFrame(TFastFramedTransport.java:140)
    at org.apache.thrift.transport.TFastFramedTransport.read(TFastFramedTransport.java:134)
    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.TServiceClient.receiveBase(TServiceClient.java:69)
    at org.apache.cassandra.thrift.Cassandra$Client.recv_set_keyspace(Cassandra.java:531)
    at org.apache.cassandra.thrift.Cassandra$Client.set_keyspace(Cassandra.java:518)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketTimeoutException: Read timed out  

    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:127)
    ... 25 more
4

1 回答 1

4

这里发生的情况是,您已经告诉 Cassandra 让您的查询运行很长时间,但您还没有告诉您的 Thrift 客户端等待 Cassandra 的回复那么久。

但实际上,10s 是充足的时间。不要改变那个。相反,找出为什么您的查询需要更长时间的跟踪:http ://www.datastax.com/dev/blog/tracing-in-cassandra-1-2

此外,您应该在此处查看数据建模资源:https ://wiki.apache.org/cassandra/DataModel 。写前存在检查是一种设计味道。

于 2013-07-11T16:04:59.223 回答