代码之家  ›  专栏  ›  技术社区  ›  j9dy

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

  •  2
  • j9dy  · 技术社区  · 8 年前

    我使用了 TRUNCATE 来自node.20的CQLSH命令。

    自我发出命令和输出 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节点上运行。看起来仍有快照/备份保存在某处?但是Node.24的658 MB数据量与报告的324 MB数据量不匹配 nodetool status .那里发生了什么事?

    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
    

    请注意,除了我在keyspace中清理的表之外,没有其他表。可能有来自的一些索引数据 cassandra-lucene-index 但如果在使用时未清除 TRUNCATE公司 .

    1 回复  |  直到 8 年前
        1
  •  1
  •   Chris Lohfink    8 年前

    nodetool status status 更像是一种全局检查。

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