nodetool repair — 테이블 복구

nodetool repair — 테이블 복구

repair 명령은 하나 이상의 테이블을 복구하는 nodetool 명령이에요. 노드 간 데이터 일관성을 맞추기 위해 가장 널리 쓰는 운영 명령 중 하나예요.

출처: nodetool repair

본문

이 명령은 지정한 테이블의 복구(repair)를 수행해요. 기본은 증분(incremental) 복구이며, -full 옵션으로 전체 복구를 실행할 수 있어요. -dc로 특정 데이터센터만, -local로 동일 데이터센터 내에서만, -pr로 파티셔너의 첫 범위만 복구할 수 있어요.

원문의 사용법은 다음과 같습니다.

NAME
        nodetool repair - Repair 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>)] repair
                [(-dc <specific_dc> | --in-dc <specific_dc>)...]
                [(-dcpar | --dc-parallel)] [(-et <end_token> | --end-token <end_token>)]
                [(-force | --force)] [(-full | --full)]
                [(-hosts <specific_host> | --in-hosts <specific_host>)...]
                [(-iuk | --ignore-unreplicated-keyspaces)]
                [(-j <job_threads> | --job-threads <job_threads>)]
                [(-local | --in-local-dc)] [(-os | --optimise-streams)]
                [(-paxos-only | --paxos-only)] [(-pl | --pull)]
                [(-pr | --partitioner-range)] [(-prv | --preview)]
                [(-seq | --sequential)] [(-skip-paxos | --skip-paxos)]
                [(-st <start_token> | --start-token <start_token>)] [(-tr | --trace)]
                [(-vd | --validate)] [--] [<keyspace> <tables>...]
OPTIONS
        -dc <specific_dc>, --in-dc <specific_dc>
            Use -dc to repair specific datacenters
        -dcpar, --dc-parallel
            Use -dcpar to repair data centers in parallel.
        -et <end_token>, --end-token <end_token>
            Use -et to specify a token at which repair range ends (inclusive)
        -force, --force
            Use -force to filter out down endpoints
        -full, --full
            Use -full to issue a full repair.
        -h <host>, --host <host>
            Node hostname or ip address
        -hosts <specific_host>, --in-hosts <specific_host>
            Use -hosts to repair specific hosts
        -iuk, --ignore-unreplicated-keyspaces
            Use --ignore-unreplicated-keyspaces to ignore keyspaces which are
            not replicated, otherwise the repair will fail
        -j <job_threads>, --job-threads <job_threads>
            Number of threads to run repair jobs. Usually this means number of
            CFs to repair concurrently. WARNING: increasing this puts more load
            on repairing nodes, so be careful. (default: 1, max: 4)
        -local, --in-local-dc
            Use -local to only repair against nodes in the same datacenter
        -os, --optimise-streams
            Use --optimise-streams to try to reduce the number of streams we do
            (EXPERIMENTAL, see CASSANDRA-3200).
        -p <port>, --port <port>
            Remote jmx agent port number
        -paxos-only, --paxos-only
            If the --paxos-only flag is included, no table data is repaired,
            only paxos operations..
        -pl, --pull
            Use --pull to perform a one way repair where data is only streamed
            from a remote node to this node.
        -pp, --print-port
            Operate in 4.0 mode with hosts disambiguated by port number
        -pr, --partitioner-range
            Use -pr to repair only the first range returned by the partitioner
        -prv, --preview
            Determine ranges and amount of data to be streamed, but don't
            actually perform repair
        -pw <password>, --password <password>
            Remote jmx agent password
        -pwf <passwordFilePath>, --password-file <passwordFilePath>
            Path to the JMX password file
        -seq, --sequential
            Use -seq to carry out a sequential repair
        -skip-paxos, --skip-paxos
            If the --skip-paxos flag is included, the paxos repair step is
            skipped. Paxos repair is also skipped for preview repairs.
        -st <start_token>, --start-token <start_token>
            Use -st to specify a token at which the repair range starts
            (exclusive)
        -tr, --trace
            Use -tr to trace the repair. Traces are logged to
            system_traces.events.
        -u <username>, --username <username>
            Remote jmx agent username
        -vd, --validate
            Checks that repaired data is in sync between nodes. Out of sync
            repaired data indicates a full repair should be run.
        --
            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

옵션을 하나씩 살펴볼게요.

  • -dc <specific_dc>, --in-dc <specific_dc> — 특정 데이터센터만 복구할 때 쓰는 옵션이에요. 여러 번 지정할 수 있어요.
  • -dcpar, --dc-parallel — 데이터센터를 병렬로 복구해요.
  • -et <end_token>, --end-token <end_token> — 복구 범위가 끝나는 토큰(포함)을 지정해요.
  • -force, --force — 다운된 엔드포인트를 필터링해 제거해요.
  • -full, --full — 전체(full) 복구를 실행해요.
  • -hosts <specific_host>, --in-hosts <specific_host> — 특정 호스트만 복구할 때 써요.
  • -iuk, --ignore-unreplicated-keyspaces — 복제되지 않는 키스페이스를 무시해요. 지정하지 않으면 복구가 실패할 수 있어요.
  • -j <job_threads>, --job-threads <job_threads> — 복구 작업을 실행할 스레드 수예요. 보통 동시에 복구할 CF 수를 의미해요. 주의: 값을 높이면 복구 중인 노드에 부하가 커지니 주의하세요 (기본: 1, 최대: 4).
  • -local, --in-local-dc — 동일 데이터센터 내 노드로만 복구해요.
  • -os, --optimise-streams — 수행하는 스트림 수를 줄이려고 시도해요 (실험적 기능, CASSANDRA-3200 참고).
  • -paxos-only, --paxos-only — 이 플래그를 주면 테이블 데이터는 복구하지 않고 paxos 작업만 복구해요.
  • -pl, --pull — 원격 노드에서 이 노드로만 데이터가 스트리밍되는 단방향 복구를 수행해요.
  • -pr, --partitioner-range — 파티셔너가 반환한 첫 번째 범위만 복구해요.
  • -prv, --preview — 스트리밍할 범위와 데이터 양만 결정하고 실제 복구는 수행하지 않아요.
  • -seq, --sequential — 순차 복구를 수행해요.
  • -skip-paxos, --skip-paxos — 이 플래그를 주면 paxos 복구 단계를 건너뛰어요. 프리뷰 복구에서도 건너뜁니다.
  • -st <start_token>, --start-token <start_token> — 복구 범위가 시작되는 토큰(제외)을 지정해요.
  • -tr, --trace — 복구를 추적해요. 트레이스는 system_traces.events에 기록돼요.
  • -vd, --validate — 복구된 데이터가 노드 간 동기화됐는지 확인해요. 동기화되지 않은 복구 데이터는 전체 복구가 필요함을 나타내요.
  • -h <host>, --host <host> — 대상 노드의 호스트명 또는 IP 주소를 지정해요.
  • -p <port>, --port <port> — 원격 JMX 에이전트 포트 번호를 지정해요.
  • -pp, --print-port — 호스트를 포트 번호로 구분하는 4.0 모드로 동작해요.
  • -pw <password>, --password <password> — 원격 JMX 에이전트 비밀번호를 지정해요.
  • -pwf <passwordFilePath>, --password-file <passwordFilePath> — JMX 비밀번호 파일의 경로를 지정해요.
  • -u <username>, --username <username> — 원격 JMX 에이전트 사용자 이름을 지정해요.
  • -- — 명령줄 옵션과 인자 목록을 구분할 때 써요.
  • [<keyspace> <tables>...] — 복구할 키스페이스와 하나 이상의 테이블을 지정해요. 생략하면 전체를 대상으로 해요.

더 알아보기