操作超时cassandra的cqlsh控制台中的错误 [英] Operation Time Out Error in cqlsh console of cassandra

查看:389
本文介绍了操作超时cassandra的cqlsh控制台中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个三个节点Cassandra集群,我创建了一个表有超过2,000,000行。



当我执行这个( select我有这个错误:


OperationTimedOut:errors = { },last_host = 192.168.1.2


当我运行count函数为少行或限制50,000它工作正常。

解决方案

count(*)实际浏览所有数据。因此,一个 select count(*)from userdetails 没有限制将预期超时与许多行。这里有一些详细信息:
http://planetcassandra.org/blog/counting-key-in-cassandra /



您可以考虑使用Spark自己维护计数,或者如果您只是想要一个球公园号码,您可以从JMX获取。 / p>

要从JMX抓取它可能有点棘手,取决于你的数据模型。要获取分区数,请获取 org.apache.cassandra.metrics:type = ColumnFamily,keyspace = {{Keyspace}},scope = {{Table}},name = EstimatedColumnCountHistogram mbean并汇总所有90个值(这是 nodetool cfstats 输出)。它将只给你sstables中存在的数字,以使它更准确,你可以刷新或尝试估计从memcable中的数量从 MemtableColumnsCount mbean


I have a three nodes Cassandra Cluster and I have created one table which has more than 2,000,000 rows.

When I execute this (select count(*) from userdetails) query in cqlsh, I got this error:

OperationTimedOut: errors={}, last_host=192.168.1.2

When I run count function for less row or with limit 50,000 it works fine.

解决方案

count(*) actually pages through all the data. So a select count(*) from userdetails without a limit would be expected to timeout with that many rows. Some details here: http://planetcassandra.org/blog/counting-key-in-cassandra/

You may want to consider maintaining the count yourself, using Spark, or if you just want a ball park number you can grab it from JMX.

To grab from JMX it can be a little tricky depending on your data model. To get the number of partitions grab the org.apache.cassandra.metrics:type=ColumnFamily,keyspace={{Keyspace}},scope={{Table​}},name=EstimatedColumnCountHistogram mbean and sum up all the 90 values (this is what nodetool cfstats outputs). It will only give you the number that exist in sstables so to make it more accurate you can do a flush or try to estimate number in memtables from the MemtableColumnsCount mbean

这篇关于操作超时cassandra的cqlsh控制台中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆