我有一个3节点群集,其复制因子为:
考虑的列族有default_time_to_live = 3600
哪个是使用alter table设置的:
cqlsh:summary> alter table match with default_time_to_live=3600;
将数据插入columnfamily并立即查询后,选择ttl(column_name),我得到的结果不正确。
cqlsh:summary> select ttl(end_time) from match limit 5;
3132
5342
5342
1802
1802
(5行)
Keyspace定义:
CREATE KEYSPACE summary WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '2'} AND durable_writes = true;
列族定义:
CREATE TABLE summary.match (
match_name text,
start_time bigint,
end_time bigint,
PRIMARY KEY (match_name, start_time)) WITH CLUSTERING ORDER BY (start_time ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = ''
AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
AND compression = {'sstable_compression':'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 3600
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
使用: Cassandra 2.1.0 | CQL规范3.2.0
它不应该低于3600吗?
考虑到5342
的TTL值在哪里?
问题:default_time_to_live
值如何生效?
答案 0 :(得分:0)
这不是问题。 群集中节点的时间戳不同步。
运行{{1}}以同步每个节点中的时钟。 然后TTL正如预期的那样出现。
为什么同步时间对于cassandra很重要。
https://blog.logentries.com/2014/03/synchronizing-clocks-in-a-cassandra-cluster-pt-1-the-problem/