2016-09-20 37 views
2

我已經在節點.20的CQLSH中爲我的表使用了TRUNCATE命令。爲什麼在TRUNCATE之後nodetool status * keyspace *仍然顯示數百MB的數據?

20分鐘已經過去了,因爲我發出命令,並且nodetool status *myKeyspace*的輸出仍然在6個節點中的4個節點上顯示大量數據。

我使用卡桑德拉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 

下面的命令0.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 

請注意,除了我在密鑰空間中清理的表之外,沒有其他表。如果TRUNCATE使用cassandra-lucene-index時,可能會有一些索引數據被清除。

回答

1

nodetool status的密鑰空間選項實際上僅用於瞭解計算所有權時要包含的複製因子和數據中心。負載實際上是針對所有sstables的,而不僅僅是一個按鍵空間。就像IP地址,主機ID和令牌數量不受設置密鑰空間選項的影響一樣。 status更多的是全局檢查。

Space used by snapshots預計仍舊有舊的數據。當你做一個截斷它快照的數據(可以通過設置auto_snapshot爲false來禁用)。要清除可以使用的所有快照,nodetool clearsnapshot <keyspace>

+0

將在使用截斷時清除所有二級索引數據嗎? – j9dy

+1

是的,truncate的一部分是刪除索引和視圖 –

相關問題