2

I have a problem with the cassandra db and hope somebody can help me. I have a table “log”. In the log table, I have inserted about 10000 rows. 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

select count(*) from

Version: cassandra 2.1.8, 2 nodes

Cassandra timeout during read query at consistency ONE (1 responses were required but only 0 replica responded)

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;
Community
  • 1
  • 1
user3589380
  • 91
  • 1
  • 2
  • 6
  • select count*(*) from will not execute. I am not sure if you made a typo or that is what you are trying to run. Also, can you post the full statement in which you insert using TTL? – Nathan Sep 21 '15 at 10:54
  • hi nathan. `insert into test.log(day, date, ip, tid, iid, request, src, txt) values('2015-09-01', '2015-09-01 08:01:00', '11.111.111.111', 1, 3, 'GET /Member....', 'Process.CreateTransaction', 'Transaction Created') using TTL 10;` there about 100000 rows. after the ttl expires i try to do `select count(*) from test.log` – user3589380 Sep 21 '15 at 14:04

2 Answers2

2

That error message indicates a problem with the READ operation. 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.

Example for 200 seconds:

read_request_timeout_in_ms: 200000

If updating that does not work you may need to tweak the JVM settings for Cassandra. See DataStax's "Tuning Java Ops" for more information

Community
  • 1
  • 1
Nathan
  • 3,082
  • 1
  • 27
  • 42
1

count() is a very costly operation, imagine Cassandra need to scan all the row from all the node just to give you the count. 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'

Remarks:

Yurii Bratchuk
  • 920
  • 9
  • 12