Cassandra轻量级事务rpc_timeout

时间:2016-01-08 14:52:50

标签: java cassandra

我有 卡桑德拉2.0.10
cqlsh 4.1.1
cassandra-driver-core-2.1.6
write_request_timeout_in_ms:2000
具有SimpleStrategy复制的一个节点

我有桌子

CREATE TABLE aaa (
  serial text,
  time timestamp,
  id bigint,
  source text,
  PRIMARY KEY ((serial))
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  index_interval=128 AND
  read_repair_chance=0.000000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='99.0PERCENTILE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};

我尝试使用Cassandra Lightweight Transaction将一些数据放到此表中

insert into aaa (serial, id, source, time) values ('123', 456, 'test source', '2000-01-01 00:00:00+0000') IF NOT EXISTS;

如果我使用cqlsh我有回复

Request did not complete within rpc_timeout.

如果我使用datastax java驱动程序,我有一个例外

com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at consistency SERIAL (1 replica were required but only 0 acknowledged the write)
    at com.datastax.driver.core.exceptions.WriteTimeoutException.copy(WriteTimeoutException.java:54) ~[cassandra-driver-core-2.1.6.jar:na]
    at com.datastax.driver.core.Responses$Error.asException(Responses.java:98) ~[cassandra-driver-core-2.1.6.jar:na]
    at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:140) ~[cassandra-driver-core-2.1.6.jar:na]
...

所以看起来我的cassandra配置有问题 也许有人帮助我:) 提前致谢

2 个答案:

答案 0 :(得分:1)

我认为超时错误可能会产生误导,并使超时更大不会有所帮助。出于某种原因,拥有该密钥的副本不响应请求,但我没有看到足够的信息来了解导致该密钥的原因。

insert语句本身看起来有效。

我看到的一件事是您使用的是旧版Cassandra,可能需要考虑升级到新版本。

答案 1 :(得分:0)

我们升级了我们的Cassandra 2.0.10 - > 2.1.9它已经解决了问题