garbagecollect — 삭제 데이터 제거

garbagecollect — 삭제 데이터 제거

nodetool garbagecollect 명령은 하나 이상의 테이블에서 삭제된 데이터를 제거하는 명령이에요. 컴팩션 외에 별도로 툼스톤·삭제 데이터를 정리할 때 써요.

출처: nodetool garbagecollect

본문

garbagecollect는 삭제된 파티션·행(ROW 단위) 기본값으로 정리하거나, -g/--granularityCELL로 주면 덮어쓰이거나 삭제된 셀까지 제거해요. -j/--jobs 기본값은 1이라 최신 테이블 컬렉션이 삭제 사실을 보고 툼스톤도 함께 제거할 수 있어요. 아래는 완전한 사용법이에요.

NAME
        nodetool garbagecollect - Remove deleted data from one or more tables

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>)] garbagecollect
                [(-g <granularity> | --granularity <granularity>)]
                [(-j <jobs> | --jobs <jobs>)] [--] [<keyspace> <tables>...]

OPTIONS
        -g <granularity>, --granularity <granularity>
            Granularity of garbage removal. ROW (default) removes deleted
            partitions and rows, CELL also removes overwritten or deleted cells.

        -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. Defaults to 1 so that collections of
            newer tables can see the data is deleted and also remove tombstones.

        -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

평소에는 컴팩션이 삭제 데이터를 처리하지만, STCS 같은 전략에서는 툼스톤이 오래 남을 수 있어요. 이런 경우 garbagecollect로 수동 정리하면 디스크 공간을 회수할 수 있어요.

더 알아보기 (Learn more)