cleanup — 더 이상 노드에 속하지 않는 키 정리
cleanup — 더 이상 노드에 속하지 않는 키 정리
nodetool cleanup 명령은 노드가 더 이상 소유하지 않는 키(keys)를 SSTable에서 즉시 정리하는 명령이에요. 기본적으로 모든 키스페이스(keyspace)를 대상으로 하며, 특정 키스페이스와 테이블을 지정할 수도 있어요.
출처: nodetool cleanup
본문
클러스터에 노드가 추가되거나 제거된 뒤에는 토큰 범위가 바뀌면서 각 노드가 옛 범위의 데이터를 더 갖게 돼요. cleanup은 이런 더 이상 자기 범위가 아닌 키를 삭제해 디스크 공간을 되돌려 주는 명령이에요. 기본값은 모든 키스페이스지만 특정 키스페이스·테이블만 지정해서 정리할 수도 있어요. 아래는 완전한 사용법이에요.
NAME
nodetool cleanup - Triggers the immediate cleanup of keys no longer
belonging to a node. By default, clean all keyspaces
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>)] cleanup
[(-j <jobs> | --jobs <jobs>)] [--] [<keyspace> <tables>...]
OPTIONS
-h <host>, --host <host>
Node hostname or ip address
-j <jobs>, --jobs <jobs>
Number of sstables to cleanup simultanously, set to 0 to use all
available compaction threads
-p <port>, --port <port>
Remote jmx agent port number
-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
-u <username>, --username <username>
Remote jmx agent username
--
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>...]
The keyspace followed by one or many tables
-j/--jobs 옵션으로 동시에 정리할 SSTable 수를 지정할 수 있고, 0으로 두면 가용한 모든 컴팩션 스레드를 사용해요. 대상은 <keyspace> 뒤에 하나 이상의 테이블 이름을 나열해 지정하고, 인자를 생략하면 모든 키스페이스를 정리해요.
더 알아보기 (Learn more)
- nodetool compact — 강제 컴팩션
- 컴팩션 — 컴팩션 동작 원리