我是cassandra的新手,只知道它的基础知识。我经常遇到卡桑德拉的例外情况。我正在使用thrift API单节点cassandra。主要是我在写作,但那些涉及现有的检查。
我尝试将read_request_timeout_in_ms
从10s增加到非常大的no:9480secs。然后我也有超时错误。我不知道背后的确切原因。
这是stacktrace:
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
答案 0 :(得分:4)
这里发生的事情是你告诉Cassandra让你的查询运行很长时间,但你没有告诉你的Thrift客户等待那么长时间来回答Cassandra。
但实际上,10s是充足的时间。不要改变它。相反,要弄清楚为什么您的查询需要更长时间才能跟踪:http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2
此外,您应该在此处查看数据建模资源:https://wiki.apache.org/cassandra/DataModel。写入之前的存在检查是一种设计气味。