drain — 노드 배수(쓰기 중단 + 플러시)
drain — 노드 배수(쓰기 중단 + 플러시)
nodetool drain 명령은 노드를 배수(drain)하는 명령이에요. 쓰기 수신을 중단하고 모든 테이블을 SSTable로 플러시해요.
출처: nodetool drain
본문
drain은 노드를 안전하게 내리기 전에 잔여 작업을 정리할 때 써요. 새로운 쓰기를 받지 않도록 막고, 메모리(멤테이블)에 남아 있는 데이터를 디스크(SSTable)로 플러시해서 데이터 손실 없이 정지 준비를 마쳐요. 주로 롤링 재시작이나 유지보수 전에 사용해요. 아래는 완전한 사용법이에요.
NAME
nodetool drain - Drain the node (stop accepting writes and flush all
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>)] drain
OPTIONS
-h <host>, --host <host>
Node hostname or ip address
-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
드레인한 뒤에는 노드가 더 이상 클러스터의 쓰기 경로에 참여하지 않으므로, 운영 중인 서비스에서는 시간을 잘 골라 실행하는 게 중요해요.
더 알아보기 (Learn more)
- nodetool stopdaemon — 데몬 정지
- nodetool flush — 테이블 강제 플러시