Compaction
nodetool compact (TODO)
Forces a major compaction on one or more tables.
nodetool [options] compact [(-et <end_token> | --end-token <end_token>)]
[(-s | --split-output)] [(-st <start_token> | --start-token <start_token>)] [--] [<keyspace> [<tables>...]]
[--user-defined] <SSTable file>...
nodetool compactionhistory
Provides the history of compaction operations.
The actual output of compaction history is seven columns wide. The first three columns show the id, keyspace name, and table name of the compacted SSTable.
nodetool connection_options compactionhistory [-F (json | yaml) | --format (json | yaml)]
nodetool compactionhistory
Compaction History:
id keyspace_name columnfamily_name compacted_at bytes_in bytes_out rows_merged
9bc883b0-58e3-11e8-ace5-9568ba4791d8 system sstable_activity 2018-05-16T08:32:02.923 2308 316 {1:65, 2:31}
b082db70-58de-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T07:56:50.215 106783580 107728180 {1:464280}
7f3286e0-58db-11e8-ace5-9568ba4791d8 system size_estimates 2018-05-16T07:33:58.990 200724 54008 {3:1, 4:3}
07ee7b50-58d8-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T07:09:10.405 183017355 183018300 {1:795735}
028040e0-58d8-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T07:09:01.294 706878215 575931770 {1:1879985, 2:591326}
d672a290-58d7-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T07:07:47.385 181895280 168256095 {1:649236, 2:70624}
69fe4fc0-58d6-11e8-ace5-9568ba4791d8 system peers 2018-05-16T06:57:35.932 5089 29 {4:1}
66a2e530-58d5-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T06:50:20.803 777537170 781357410 {1:3398242}
419ac320-58d5-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T06:49:18.674 945435530 949871515 {1:4130438, 2:9}
14be1500-58d5-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T06:48:03.408 180184355 180791065 {1:786188}
a245e200-58d4-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T06:44:51.360 180625415 181247510 {1:788364}
9bb48450-58d4-11e8-ace5-9568ba4791d8 keyspace1 standard1 2018-05-16T06:44:40.341 176142090 176583545 {1:768225}
ccb07420-58d3-11e8-ace5-9568ba4791d8 system_schema keyspaces 2018-05-16T06:38:53.026 647 329 {1:5, 3:1}
59b6c800-58c6-11e8-ace5-9568ba4791d8 system_schema keyspaces 2018-05-16T05:02:36.672 593 248 {1:4, 2:1}
59b5dda0-58c6-11e8-ace5-9568ba4791d8 system_schema tables 2018-05-16T05:02:36.666 3993 2689 {1:4, 2:1}
59b31e80-58c6-11e8-ace5-9568ba4791d8 system_schema columns 2018-05-16T05:02:36.648 6333 5650 {1:4, 2:1}
1c59ed90-58c4-11e8-ace5-9568ba4791d8 system local 2018-05-16T04:46:34.729 5397 5058 {7:1}
0486d660-58c4-11e8-ace5-9568ba4791d8 system local 2018-05-16T04:45:54.758 318 231 {4:1}
The four columns to the right of the table name show the timestamp, size of the SSTable before and after compaction, and the number of partitions merged. The notation means {tables:rows}. For example: {1:3, 3:1} means 3 rows were taken from one SSTable (1:3) and 1 row taken from 3 SSTables (3:1) to make the one SSTable in that compaction operation.
nodetool compactionhistory -F json
{"CompactionHistory":[{"keyspace_name":"system","bytes_out":316,"bytes_in":2308,"columnfamily_name":"sstable_activity","rows_merged":"{1:65, 2:31}","id":"9bc883b0-58e3-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T08:32:02.923"},{"ke
yspace_name":"keyspace1","bytes_out":107728180,"bytes_in":106783580,"columnfamily_name":"standard1","rows_merged":"{1:464280}","id":"b082db70-58de-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T07:56:50.215"},{"keyspace_name":"system"
,"bytes_out":54008,"bytes_in":200724,"columnfamily_name":"size_estimates","rows_merged":"{3:1, 4:3}","id":"7f3286e0-58db-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T07:33:58.990"},{"keyspace_name":"keyspace1","bytes_out":183018300,
"bytes_in":183017355,"columnfamily_name":"standard1","rows_merged":"{1:795735}","id":"07ee7b50-58d8-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T07:09:10.405"},{"keyspace_name":"keyspace1","bytes_out":575931770,"bytes_in":706878215,
"columnfamily_name":"standard1","rows_merged":"{1:1879985, 2:591326}","id":"028040e0-58d8-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T07:09:01.294"},{"keyspace_name":"keyspace1","bytes_out":168256095,"bytes_in":181895280,"columnfam
ily_name":"standard1","rows_merged":"{1:649236, 2:70624}","id":"d672a290-58d7-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T07:07:47.385"},{"keyspace_name":"system","bytes_out":29,"bytes_in":5089,"columnfamily_name":"peers","rows_mer
ged":"{4:1}","id":"69fe4fc0-58d6-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T06:57:35.932"},{"keyspace_name":"keyspace1","bytes_out":781357410,"bytes_in":777537170,"columnfamily_name":"standard1","rows_merged":"{1:3398242}","id":"6
6a2e530-58d5-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T06:50:20.803"},{"keyspace_name":"keyspace1","bytes_out":949871515,"bytes_in":945435530,"columnfamily_name":"standard1","rows_merged":"{1:4130438, 2:9}","id":"419ac320-58d5-11
e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T06:49:18.674"},{"keyspace_name":"keyspace1","bytes_out":180791065,"bytes_in":180184355,"columnfamily_name":"standard1","rows_merged":"{1:786188}","id":"14be1500-58d5-11e8-ace5-9568ba4791d8"
,"compacted_at":"2018-05-16T06:48:03.408"},{"keyspace_name":"keyspace1","bytes_out":181247510,"bytes_in":180625415,"columnfamily_name":"standard1","rows_merged":"{1:788364}","id":"a245e200-58d4-11e8-ace5-9568ba4791d8","compacted_at":"2018
-05-16T06:44:51.360"},{"keyspace_name":"keyspace1","bytes_out":176583545,"bytes_in":176142090,"columnfamily_name":"standard1","rows_merged":"{1:768225}","id":"9bb48450-58d4-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T06:44:40.341"}
,{"keyspace_name":"system_schema","bytes_out":329,"bytes_in":647,"columnfamily_name":"keyspaces","rows_merged":"{1:5, 3:1}","id":"ccb07420-58d3-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T06:38:53.026"},{"keyspace_name":"system_sch
ema","bytes_out":248,"bytes_in":593,"columnfamily_name":"keyspaces","rows_merged":"{1:4, 2:1}","id":"59b6c800-58c6-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T05:02:36.672"},{"keyspace_name":"system_schema","bytes_out":2689,"bytes_
in":3993,"columnfamily_name":"tables","rows_merged":"{1:4, 2:1}","id":"59b5dda0-58c6-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T05:02:36.666"},{"keyspace_name":"system_schema","bytes_out":5650,"bytes_in":6333,"columnfamily_name":"
columns","rows_merged":"{1:4, 2:1}","id":"59b31e80-58c6-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T05:02:36.648"},{"keyspace_name":"system","bytes_out":5058,"bytes_in":5397,"columnfamily_name":"local","rows_merged":"{7:1}","id":"1
c59ed90-58c4-11e8-ace5-9568ba4791d8","compacted_at":"2018-05-16T04:46:34.729"},{"keyspace_name":"system","bytes_out":231,"bytes_in":318,"columnfamily_name":"local","rows_merged":"{4:1}","id":"0486d660-58c4-11e8-ace5-9568ba4791d8","compact
ed_at":"2018-05-16T04:45:54.758"}]}
nodetool compactionhistory -F yaml
CompactionHistory:
- keyspace_name: system
bytes_out: 316
bytes_in: 2308
columnfamily_name: sstable_activity
rows_merged: '{1:65, 2:31}'
id: 9bc883b0-58e3-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T08:32:02.923'
- keyspace_name: keyspace1
bytes_out: 107728180
bytes_in: 106783580
columnfamily_name: standard1
rows_merged: '{1:464280}'
id: b082db70-58de-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T07:56:50.215'
- keyspace_name: system
bytes_out: 54008
bytes_in: 200724
columnfamily_name: size_estimates
rows_merged: '{3:1, 4:3}'
id: 7f3286e0-58db-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T07:33:58.990'
- keyspace_name: keyspace1
bytes_out: 183018300
bytes_in: 183017355
columnfamily_name: standard1
rows_merged: '{1:795735}'
id: 07ee7b50-58d8-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T07:09:10.405'
- keyspace_name: keyspace1
bytes_out: 575931770
bytes_in: 706878215
columnfamily_name: standard1
rows_merged: '{1:1879985, 2:591326}'
id: 028040e0-58d8-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T07:09:01.294'
- keyspace_name: keyspace1
bytes_out: 168256095
bytes_in: 181895280
columnfamily_name: standard1
rows_merged: '{1:649236, 2:70624}'
id: d672a290-58d7-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T07:07:47.385'
- keyspace_name: system
bytes_out: 29
bytes_in: 5089
columnfamily_name: peers
rows_merged: '{4:1}'
id: 69fe4fc0-58d6-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:57:35.932'
- keyspace_name: keyspace1
bytes_out: 781357410
bytes_in: 777537170
columnfamily_name: standard1
rows_merged: '{1:3398242}'
id: 66a2e530-58d5-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:50:20.803'
- keyspace_name: keyspace1
bytes_out: 949871515
bytes_in: 945435530
columnfamily_name: standard1
rows_merged: '{1:4130438, 2:9}'
id: 419ac320-58d5-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:49:18.674'
- keyspace_name: keyspace1
bytes_out: 180791065
bytes_in: 180184355
columnfamily_name: standard1
rows_merged: '{1:786188}'
id: 14be1500-58d5-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:48:03.408'
- keyspace_name: keyspace1
bytes_out: 181247510
bytes_in: 180625415
columnfamily_name: standard1
rows_merged: '{1:788364}'
id: a245e200-58d4-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:44:51.360'
- keyspace_name: keyspace1
bytes_out: 176583545
bytes_in: 176142090
columnfamily_name: standard1
rows_merged: '{1:768225}'
id: 9bb48450-58d4-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:44:40.341'
- keyspace_name: system_schema
bytes_out: 329
bytes_in: 647
columnfamily_name: keyspaces
rows_merged: '{1:5, 3:1}'
id: ccb07420-58d3-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T06:38:53.026'
- keyspace_name: system_schema
bytes_out: 248
bytes_in: 593
columnfamily_name: keyspaces
rows_merged: '{1:4, 2:1}'
id: 59b6c800-58c6-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T05:02:36.672'
- keyspace_name: system_schema
bytes_out: 2689
bytes_in: 3993
columnfamily_name: tables
rows_merged: '{1:4, 2:1}'
id: 59b5dda0-58c6-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T05:02:36.666'
- keyspace_name: system_schema
bytes_out: 5650
bytes_in: 6333
columnfamily_name: columns
rows_merged: '{1:4, 2:1}'
id: 59b31e80-58c6-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T05:02:36.648'
- keyspace_name: system
bytes_out: 5058
bytes_in: 5397
columnfamily_name: local
rows_merged: '{7:1}'
id: 1c59ed90-58c4-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T04:46:34.729'
- keyspace_name: system
bytes_out: 231
bytes_in: 318
columnfamily_name: local
rows_merged: '{4:1}'
id: 0486d660-58c4-11e8-ace5-9568ba4791d8
compacted_at: '2018-05-16T04:45:54.758'
nodetool compactionstats
Provide statistics about a compaction.
nodetool options compactionstats -H
The total column shows the total number of uncompressed bytes of SSTables being compacted. The system log lists the names of the SSTables compacted.
nodetool compactionstats
pending tasks: 2
- keyspace1.standard1: 2
id compaction type keyspace table completed total unit progress
b152b820-58ea-11e8-ace5-9568ba4791d8 Compaction keyspace1 standard1 4901774 179659495 bytes 2.73%
Active compaction remaining time : 0h00m10s