nodetool compact
Forces a major compaction on one or more tables.
Note: Forces a major compaction on one or more tables using
SizeTieredCompactionStrategy (STCS) or DateTieredCompactionStrategy (DTCS).
Synopsis
nodetool <options> compact <keyspace> ( <table> ... )
Short | Long | Description |
---|---|---|
-h |
--host |
Hostname or IP address |
-p |
--port |
Port number |
-pwf |
--password-file |
Password file path |
-pw |
--password |
Password |
-u |
--username |
User name |
-s |
--split-output | Split output of STCS files to 50%-25%-12.5% etc.of the total size. |
Note:
- For tarball installations, execute the command from the install_location/bin directory.
- If a username and password for RMI authentication are set explicitly in the cassandra-env.sh file for the host, then you must specify credentials.
- No
-s
will create one large SSTable for STCS. -s
will not affect DTCS; it will create one large SSTable.
Description
- If you do not specify a keyspace or table, a major compaction is run on all keyspaces and tables.
- If you specify only a keyspace, a major compaction is run on all tables in that keyspace.
- If you specify one or more tables, a major compaction is run on those tables.
Major compactions may behave differently depending which compaction strategy is used for the affected tables:
- Size-tiered compaction (STCS) splits repaired and unrepaired data into separate pools for separate compactions. A major compaction generates two SSTables, one for each pool of data.
- Leveled compaction (LCS) performs size-tiered compaction on unrepaired data. After repair completes, Casandra moves data from the set of unrepaired SSTables to L0.
- Date-tiered (DTCS) splits repaired and unrepaired data into separate pools for separate compactions. A major compaction generates two SSTables, one for each pool of data.
For more details, see How is data maintained? and Configuring compaction.
Note: A major compaction can cause considerably more disk I/O than minor compactions.