readtimeout:来自服务器的错误:code=1200[协调器节点在等待副本节点的响应时超时]

gojuced7  于 2021-06-14  发布在  Cassandra
关注(0)|答案(2)|浏览(356)

我们创建了具有以下架构的表:
创建表test_table(col_1 text,col_2 text,col_3 text,col_4 text,col_5 text,col_6 text,col_7 text,主键(col_1,col_2,col_3,col_4,col_5));
这个表包含了几十亿条记录
试着像下面这样询问,
从test_表中选择*,其中col_1='value'和col_2='value';-->获取结果
但当我们像下面这样试的时候,
从test\u表中选择*,其中col\u 1='value'和col\u 3='value'允许筛选;-->没有结果
从test表中选择*列,其中列1='value'和列4='value'允许筛选;-->没有结果
我们得到以下错误:
“readtimeout:来自服务器的错误:code=1200[coordinator node timed out waiting for replica nodes'responses]message=”operation timed out-仅收到0个响应。“info={'收到的\u响应':0,'必需的\u响应':1,'一致性':'一'}”
在出现上述错误之后,我在cassandra.yaml配置文件中将超时参数从5秒扩展到60分钟。
结果出来了,但需要很长时间和50分钟的执行时间。
有人能建议我在不扩展配置的情况下解决“readtimeout:”问题吗?

ha5z0ras

ha5z0ras1#

通过使用“允许过滤”,您正在执行一个完整的表扫描,它超时,这就是您得到错误的原因。
您需要更改分区/集群键,以便在不使用“allow filtering”参数的情况下运行查询。
当您仅执行上述给定查询时,可以考虑将数据复制到3个表中:

create table test_table_1(col_1 text, col_2 text, col_3 text, col_4 text, col_5 text, col_6 text, col_7 text, PRIMARY KEY (col_1, col_2));
create table test_table_2(col_1 text, col_2 text, col_3 text, col_4 text, col_5 text, col_6 text, col_7 text, PRIMARY KEY (col_1, col_3));
create table test_table_3(col_1 text, col_2 text, col_3 text, col_4 text, col_5 text, col_6 text, col_7 text, PRIMARY KEY (col_1, col_4));

您的查询将是:

select * from test_table_1 where col_1='value' and col_2='value';
select * from test_table_2 where col_1='value' and col_3='value';
select * from test_table_3 where col_1='value' and col_4='value';

记住:在cassandra中,您是围绕查询设计表的。

jv4diomz

jv4diomz2#

您的分区和群集密钥是什么?它超时导致数据大小过大,无法在给定的超时时间内处理。尝试查看分页和二级索引。尽管二级索引可能会降低性能。

相关问题