我是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
这里发生的事情是,你已经告诉Cassandra让你的查询运行很长时间,但你还没有告诉你的Thrift客户端等待Cassandra的回复。
但实际上,10分是足够的时间。不要改变这一点。相反,要弄清楚为什么您的查询需要更长的跟踪时间:http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2
此外,您应该在此处查看数据建模资源:https://wiki.apache.org/cassandra/DataModel.写之前的存在检查是一种设计气味。