执行 select count(*) from mytable 只能在小数据量的时候对 Cassandra 进行count查询检索,
但遇到大数据量的时就会报下面的错误信息:
ReadTimeout: Error from server: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out - received only 0 responses." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
或者
OperationTimedOut: errors={'192.168.71.43': 'Client request timeout. See Session.execute[_async](timeout)'}, last_host=192.168.71.43
你会发现修改配置文件也不一定能真正有效的解决问题,在这里提供大家一个解决思路。
解决办法:
去 cassandra-count 开源项目上下载一个小工具,执行即可查看具体的数量。
项目地址:https://github.com/brianmhess/cassandra-count
下载地址:
https://github.com/brianmhess/cassandra-count/releases/download/v0.0.6/cassandra-count
然后执行
./cassandra-count -host 192.168.71.43 -keyspace mydb -table mytable
就能看见你某个表里面存储的数据量了,例如:
mydb.mymytable: 135362560
开源项目地址:
我们已经将上述技术&经验实践开源,请关注我们发布的开源项目。
我们专注互联网开源数据智能处理,为用户提供“数据采集”、“数据标记”和“数据挖掘”三方面核心能力,以有效的方式使用互联网数据,提高生产力及决策能力。 了解更多请关注微信公众号:思通数据