정의
구문
배포서버에 changeStreamOptions 를 설정하려면 admin 데이터베이스에서 다음 명령을 실행합니다.
db.adminCommand( { setClusterParameter: { changeStreamOptions: <value> } } )
changeStreamOptions 클러스터 매개변수의 현재 값을 보려면 admin 데이터베이스에서 다음 명령을 실행합니다.
db.adminCommand( { getClusterParameter: "changeStreamOptions" } )
매개변수 필드
changeStreamOptions.preAndPostImages.expireAfterSeconds버전 6.0에 추가 되었습니다.
Default(기본값): OFF(꺼짐)
change stream 사전 및 사후 이미지의 보존 정책을 제어합니다. 사전 및 사후 이미지는 각각 문서 수정 전과 후의 문서 버전입니다.
expireAfterSeconds은(는) MongoDB가 사전 및 사후 이미지를 보관하는 기간을 제어합니다.expireAfterSeconds가off면 MongoDB는 기본 보존 정책을 사용합니다. 즉, 해당 변경 스트림 이벤트가 oplog에서 제거될 때까지 사전 및 사후 이미지가 보존됩니다.이미지 전후의 최소 보존 시간을 설정하려면
expireAfterSeconds에 정수 값을 지정하세요.중요
Services that use change streams, including Triggers and Device Sync, might rely on the availability of pre-image data. If you set
expireAfterSecondstoo low, you may increase the risk of interrupting sync or triggers processing.사전 이미지에
expireAfterSeconds를 설정할 때 다음을 확인하세요.서비스의 일반적인 변경 스트림 지연보다 낮지 않은 값을 지정합니다.
버퍼 시간을 추가하여 oplog 데이터 손실 위험을 감수하기 전에 서비스가 수동으로 재개될 수 있도록 합니다.
행동
If a change stream event is removed from the oplog, then the corresponding pre- and post-images are also deleted regardless of the retention time specified with changeStreamOptions.preAndPostImages.expireAfterSeconds.
예시
다음 예에서는 change stream에서 사전 및 사후 이미지의 보존 시간을 100 초로 설정합니다.
db.runCommand( { setClusterParameter: { changeStreamOptions: { preAndPostImages: { expireAfterSeconds: 100 } } } } )