정의
killOpTerminates an operation as specified by the operation ID.
mongoshprovides thedb.killOp()helper. To find operations and their corresponding IDs, see$currentOpordb.currentOp().killOp명령은admin데이터베이스에 대해 실행해야 합니다.killOp를 실행하려면
db.runCommand( { <command> } )메서드를 사용합니다.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스
중요
이 명령은 모든 MongoDB Atlas 클러스터에서 제한적으로 지원 됩니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령의 형식은 다음과 같습니다.
db.adminCommand( { killOp: 1, op: <opid>, comment: <any> } )
명령 필드
Parameter | 유형 | 설명 |
|---|---|---|
| 숫자 | 작업 ID입니다. |
| any | 선택 사항. 이 명령에 첨부할 사용자 제공 코멘트입니다. 설정되면 이 설명은 다음 위치에서 이 명령의 레코드와 함께 표시됩니다.
댓글은 유효한 모든 BSON types (문자열, 정수, 객체, 배열 등)이 될 수 있습니다. |
경고
Terminate running operations with extreme caution. Only use killOp to terminate operations initiated by clients and do not terminate internal database operations.
행동
Do not use killOp to terminate an in-progress index builds in replica sets or sharded clusters. Use dropIndexes on the primary to drop the index. See Stop In-Progress Index Builds.
액세스 제어
authorization 으로 실행되는 시스템에서 사용자가 소유하지 않은 조치를 종료하려면 사용자에게 killop 권한 조치가 포함된 액세스 권한이 있어야 합니다.
샤딩된 클러스터
The killOp command can be run on a mongos and can kill queries (i.e. read operations) that span shards in a cluster. The killOp command from the mongos does not propagate to the shards when the operation to be killed is a write operation.
mongos에서 활성화된 샤딩 작업을 나열하는 방법에 관한 정보는 $currentOp의 localOps 매개변수에서 확인 가능합니다.
샤드 cluster에서의 작업 종료에 대한 자세한 내용 및 예시는 다음을 참조하세요.
예시
The following example uses killOp to target the running operation with opid 3478.
db.adminCommand( { "killOp": 1, "op": 3478 } )
이 연산은 다음과 같은 결과를 반환합니다.
{ "info" : "attempting to kill op", "ok" : 1 }
killOp reports success if it succeeded in marking the specified operation for termination. Operations may not actually be terminated until they reach an appropriate interruption point. Use $currentOp or db.currentOp() to confirm the target operation was terminated.