Cassandra Python驱动程序ReadTimeou

2024-04-28 14:08:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用官方的python驱动程序运行cqlsh查询:

>>> session.execute('select count(*) from cassandra_table')

我得到了以下错误:

^{pr2}$

我试着增加readtimeout

尝试1:

>>> session.default_timeout = 60.0
>>> session.execute('select count(*) from cassandra_table')

尝试2:

>>> session.execute('select count(*) from cassandra_table', timeout=60.0)

两种方法都给了我相同的readtime错误 如何正确增加读取超时?在

版本信息:

Cassandra   3.11.0.1900
Spark   2.0.2.6-de611f9
DSE               5.1.5
cassandra-driver 3.12.0

Tags: fromdefaultexecute官方sessioncount错误驱动程序
1条回答
网友
1楼 · 发布于 2024-04-28 14:08:35

在cassandra中,^{是一个非常昂贵的操作,它需要读取所有节点上的所有数据。鉴于count(*)很容易适用于少量数据,但在可能有行的情况下则不行。在

还有一篇来自datatax的关于计数的博文:https://www.datastax.com/dev/blog/counting-keys-in-cassandra

相关问题 更多 >