정의
fsyncUnlock서버 또는 cluster의 잠금 횟수를 줄입니다. 쓰기 작업을 활성화하려면 잠금 횟수가 0이어야 합니다.
MongoDB 7.1 부터 시작( 7.0.2 부터 사용 가능), 6.0.11 및 5.0.22)
fsync및fsyncUnlock명령을mongos에서 실행하여 샤드 클러스터를 잠그고 잠금 해제할 수 있습니다.백업 작업을 완료한 후 쓰기 차단을 해제하려면 이 명령을 사용합니다.
중요
Servers maintain an fsync lock count. The
fsynccommand with thelockfield set totrueincrements the lock count while thefsyncUnlockcommand decrements it. To enable writes on a locked server or cluster, call thefsyncUnlockcommand until the lock count reaches zero.fsyncUnlockis an administrative operation. Typically you will usefsyncUnlockfollowing a database backup operation.팁
In
mongosh, this command can also be run through thedb.fsyncUnlock()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.adminCommand( { fsyncUnlock: 1, comment: <any> } )
comment 필드는 선택 사항이며 모든 데이터 유형의 주석을 포함할 수 있습니다.
결과
이 작업은 다음 필드가 있는 문서를 반환합니다.
필드 | 설명 |
|---|---|
| 작업 상태에 대한 정보 |
| 작업 후 인스턴스에 남아 있는 잠금 수입니다. |
| 상태 코드입니다. |
예시
Consider a situation where db.fsyncLock() has been issued two times. The following fsyncUnlock operation reduces the locks taken by db.fsyncLock() by 1:
db.adminCommand( { fsyncUnlock: 1 } )
연산은 다음 문서를 반환합니다.
{ "info" : "fsyncUnlock completed", "lockCount" : Long(1), "ok" : 1 }
lockCount 가 0보다 크면 mongod 인스턴스가 쓰기에 대해 잠깁니다. 쓰기를 위해 인스턴스의 잠금을 해제하려면 잠금 해제 작업을 다시 실행합니다.
db.adminCommand( { fsyncUnlock: 1 } )
연산은 다음 문서를 반환합니다.
{ "info" : "fsyncUnlock completed", "lockCount" : Long(0), "ok" : 1 }
mongod 인스턴스는 쓰기에 대해 잠금 해제됩니다.