Cassandra cqlsh query fails with no error

核能气质少年 提交于 2019-12-11 01:46:46

问题


I have been trying to run a query like this:

SELECT COUNT(*) FROM sensors WHERE sensor_id = 1 and date = '2014-11';

on a column family. The WHERE clause filters down to a partition key with around 2 million columns. I expect to get a count result of approx. 2 million, but instead I get this error:

errors={}, last_host=[THE_IP_OF_MY_SERVER]

if I run the query to get the columns it returns the data just fine, but it cannot return the count. I understand the performance issues such count query might have (for example the ones discussed here) but I still would like to get some result for this query for my tests.

So my question is:

  1. Is this a timeout error? if yes how I can increase the timeout period?
  2. If not, why I get this error? is there a way to get more details on this? I checked the system.log on each node in my cluster and none had anything printed during the query.

I am using Cassandra 2.1 with cqlsh 5.0.1 and spec 3.2 on a cluster of two nodes both running Ubuntu 14.04.

Thanks


回答1:


It should be a timeout. You can increase the maximum time needed for the request by changing the value of "read_request_timeout_in_ms" or even "range_request_timeout_in_ms" (in cassandra.yaml) if you plan to use range queries. Restart the cluster after changing the values (they default to 10 seconds).

Note that if you run exact queries on partition keys you will get 0 or 1 as count. So your query is on clustering columns (the ones after the first column of primary key) if it returns more than 1 row.




回答2:


Edit ~/.cqlshrc or ~/.cassandra/cqlshrc with:

[connection]
client_timeout = 20

tweak the timeout number (in second) as you want.



来源:https://stackoverflow.com/questions/27766976/cassandra-cqlsh-query-fails-with-no-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!