compact — 강제 컴팩션 실행
compact — 강제 컴팩션 실행
nodetool compact 명령은 하나 이상의 테이블에 메이저 컴팩션(major compaction)을 강제로 실행하거나, 주어진 SSTable에 사용자 정의 컴팩션을 실행하는 명령이에요.
출처: nodetool compact
본문
compact는 평소 자동으로 돌아가는 컴팩션을 관리자가 원하는 시점에 수동으로 트리거할 때 써요. 특정 토큰 범위만 컴팩션하거나(-st, -et), 파티션 키를 지정하거나(--partition), --user-defined로 특정 SSTable 파일들만 컴팩션에 제출할 수도 있어요. 아래는 완전한 사용법이에요.
NAME
nodetool compact - Force a (major) compaction on one or more tables or
user-defined compaction on given SSTables
SYNOPSIS
nodetool [(-h <host> | --host <host>)] [(-p <port> | --port <port>)]
[(-pp | --print-port)] [(-pw <password> | --password <password>)]
[(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
[(-u <username> | --username <username>)] compact
[(-et <end_token> | --end-token <end_token>)]
[--partition <partition_key>] [(-s | --split-output)]
[(-st <start_token> | --start-token <start_token>)] [--user-defined]
[--] [<keyspace> <tables>...] or <SSTable file>...
OPTIONS
-et <end_token>, --end-token <end_token>
Use -et to specify a token at which compaction range ends
(inclusive)
-h <host>, --host <host>
Node hostname or ip address
-p <port>, --port <port>
Remote jmx agent port number
--partition <partition_key>
String representation of the partition key
-pp, --print-port
Operate in 4.0 mode with hosts disambiguated by port number
-pw <password>, --password <password>
Remote jmx agent password
-pwf <passwordFilePath>, --password-file <passwordFilePath>
Path to the JMX password file
-s, --split-output
Use -s to not create a single big file
-st <start_token>, --start-token <start_token>
Use -st to specify a token at which the compaction range starts
(inclusive)
-u <username>, --username <username>
Remote jmx agent username
--user-defined
Use --user-defined to submit listed files for user-defined
compaction
--
This option can be used to separate command-line options from the
list of argument, (useful when arguments might be mistaken for
command-line options
[<keyspace> <tables>...] or <SSTable file>...
The keyspace followed by one or many tables or list of SSTable data
files when using --user-defined
-st/--start-token과 -et/--end-token은 컴팩션할 토큰 범위의 시작·끝(포함)을 지정해요. -s/--split-output은 하나의 큰 파일을 만들지 않도록 분할 출력하고, --user-defined를 쓰면 인자로 나열한 SSTable 데이터 파일들을 사용자 정의 컴팩션에 제출해요.
더 알아보기 (Learn more)
- 컴팩션 — 컴팩션 동작 원리
- nodetool compactionstats — 컴팩션 진행 상황