[英]Cassandra timeout during read query at consistency ONE
I have a problem with the cassandra db and hope somebody can help me. 我对cassandra db有问题,希望有人可以帮助我。 I have a table “log”.
我有一个表“ log”。 In the log table, I have inserted about 10000 rows.
在日志表中,我插入了大约10000行。 Everything works fine.
一切正常。 I can do a
我可以做一个
select * from
select count(*) from
As soon I insert 100000 rows with TTL 50, I receive a error with 一旦我用TTL 50插入100000行,就会收到错误消息
select count(*) from
Version: cassandra 2.1.8, 2 nodes 版本:cassandra 2.1.8,2个节点
Cassandra timeout during read query at consistency ONE (1 responses were required but only 0 replica responded)
一致性为ONE的读取查询期间的Cassandra超时(需要1个响应,但仅响应0个副本)
Has someone a idea what I am doing wrong? 有人知道我在做什么错吗?
CREATE TABLE test.log (
day text,
date timestamp,
ip text,
iid int,
request text,
src text,
tid int,
txt text,
PRIMARY KEY (day, date, ip)
) WITH read_repair_chance = 0.0
AND dclocal_read_repair_chance = 0.1
AND gc_grace_seconds = 864000
AND bloom_filter_fp_chance = 0.01
AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
AND comment = ''
AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
AND default_time_to_live = 0
AND speculative_retry = '99.0PERCENTILE'
AND min_index_interval = 128
AND max_index_interval = 2048;
That error message indicates a problem with the READ operation. 该错误消息表明READ操作存在问题。 Most likely it is a READ timeout.
最有可能是读取超时。 You may need to update your Cassandra.yaml with a larger read timeout time as described in this SO answer .
您可能需要按照此SO回答中所述的更长的读取超时时间来更新Cassandra.yaml。
Example for 200 seconds: 200秒的示例:
read_request_timeout_in_ms: 200000
If updating that does not work you may need to tweak the JVM settings for Cassandra. 如果无法进行更新,则可能需要调整Cassandra的JVM设置。 See DataStax's " Tuning Java Ops " for more information
有关更多信息,请参见DataStax的“ 调整Java操作 ”。
count() is a very costly operation, imagine Cassandra need to scan all the row from all the node just to give you the count. count()是一个非常昂贵的操作,想象一下Cassandra需要扫描所有节点上的所有行,只是为了给您计数。 In small amount of rows if works, but on bigger data, you should use another approaches to avoid timeout.
如果行较少,但行数较大,则应使用另一种方法来避免超时。
Example of one of such queries: 此类查询之一的示例:
select day, date, ip, iid, request, src, tid, txt from test.log where day='Saturday' and date='2017-08-12 00:00:00' and ip='127.0 0.1' 从test.log中选择日期,日期,ip,iid,请求,src,tid,txt,其中day ='Saturday'和date ='2017-08-12 00:00:00'和ip ='127.0 0.1'
Remarks: 备注:
If you need just to calculate count and nothing more, probably has a sense to google for tool like https://github.com/brianmhess/cassandra-count 如果您只需要计算计数,仅此而已,可能会对Google感兴趣,例如https://github.com/brianmhess/cassandra-count
If Cassandra refuses to run your query without ALLOW FILTERING that mean query is not efficient https://stackoverflow.com/a/38350839/2900229 如果Cassandra拒绝在没有允许过滤的情况下运行查询,则表示查询效率不高https://stackoverflow.com/a/38350839/2900229
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.