为什么nodetool status * keyspace *在TRUNCATE之后仍然显示数百MB的数据?

时间:2016-09-20 09:37:22

标签: cassandra cql cql3 cqlsh

我已将节点.20的CQLSH中的TRUNCATE命令用于我的表。

自发出命令以来已过去20分钟,nodetool status *myKeyspace*的输出仍显示6个节点中有4个节点的大量数据。

我正在使用Cassandra 3.0.8

192.168.178.20:/usr/share/cassandra$ nodetool status *myKeyspace*
Datacenter: dc1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address         Load       Tokens       Owns (effective)  Host ID                               Rack
UN  192.168.178.24  324,57 MB  256          32,7%             4d852aea-65c7-42e1-b2bd-f38a320ec827  rack1
UN  192.168.178.28  650,86 KB  256          35,7%             82b67dc5-9f4f-47e9-81d7-a93f28a3e9da  rack1
UN  192.168.178.30  155,68 MB  256          31,9%             28cf5138-7b61-42ca-8b0c-e4be1b5418ba  rack1
UN  192.168.178.32  321,62 MB  256          33,3%             64e106ed-770f-4654-936d-db5b80aa37dc  rack1
UN  192.168.178.36  640,91 KB  256          33,0%             76152b07-caa6-4214-8239-e8a51bbc4b62  rack1
UN  192.168.178.20  103,07 MB  256          33,3%             539a6333-c4ef-487a-b1e4-aac40949af4c  rack1

以下命令在.24节点上运行。看起来还有某些快照/备份被保存在哪里?但是,节点.24的数据量为658 MB,与nodetool status报告的324 MB的数据量不匹配。那里发生了什么?

192.168.178.24:/usr/share/cassandra$ nodetool cfstats *myKeyspace*
Keyspace: *myKeyspace*
        Read Count: 0
        Read Latency: NaN ms.
        Write Count: 0
        Write Latency: NaN ms.
        Pending Flushes: 0
                Table: data
                SSTable count: 0
                Space used (live): 0
                Space used (total): 0
                Space used by snapshots (total): 658570012
                Off heap memory used (total): 0
                SSTable Compression Ratio: 0.0
                Number of keys (estimate): 0
                Memtable cell count: 0
                Memtable data size: 0
                Memtable off heap memory used: 0
                Memtable switch count: 0
                Local read count: 0
                Local read latency: NaN ms
                Local write count: 0
                Local write latency: NaN ms
                Pending flushes: 0
                Bloom filter false positives: 0
                Bloom filter false ratio: 0,00000
                Bloom filter space used: 0
                Bloom filter off heap memory used: 0
                Index summary off heap memory used: 0
                Compression metadata off heap memory used: 0
                Compacted partition minimum bytes: 0
                Compacted partition maximum bytes: 0
                Compacted partition mean bytes: 0
                Average live cells per slice (last five minutes): 3.790273556231003
                Maximum live cells per slice (last five minutes): 103
                Average tombstones per slice (last five minutes): 1.0
                Maximum tombstones per slice (last five minutes): 1

请注意,除了我在键区中清理的表之外,没有其他表。可能会有cassandra-lucene-index的某些索引数据,但是如果在使用TRUNCATE时没有清除它们。

1 个答案:

答案 0 :(得分:1)

nodetool status的密钥空间选项实际上仅用于了解计算所有权时要包含的复制因子和数据中心。负载实际上适用于所有sstables,而不仅仅是一个密钥空间。就像IP地址,主机ID和令牌数量不受设置键空间选项的影响一样。 status更像是一次全球检查。

Space used by snapshots预计仍有旧数据。当您执行截断时,它会快照数据(可以通过将auto_snapshot中的cassandra.yaml设置为false来禁用)。要清除所有快照,您可以使用nodetool clearsnapshot <keyspace>