AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

moveChunk (데이터베이스 명령)

moveChunk

Internal administrative command. Moves chunks between shards. Issue the moveChunk command via a mongos instance while using the admin database. Use the following forms:

In mongosh, this command can also be run through the sh.moveChunk() helper method.

Helper methods are convenient for mongosh users, 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.

db.adminCommand( { moveChunk : <namespace> ,
find : <query> ,
to : <ID of the recipient shard>,
forceJumbo: <boolean>,
_secondaryThrottle : <boolean>,
writeConcern: <document>,
_waitForDelete : <boolean> } )

대신 다음을 사용할 수 있습니다.

db.adminCommand( { moveChunk : <namespace> ,
bounds : <array> ,
to : <ID of the recipient shard>,
forceJumbo: <boolean>,
_secondaryThrottle : <boolean>,
writeConcern: <document>,
_waitForDelete : <boolean> } )

참고

listShards 명령을 사용하여 수신자 샤드의 ID 조회.

The moveChunk command has the following fields:

필드
유형
설명

moveChunk

문자열

청크 존재하는 collection 의 네임스페이스 입니다. 데이터베이스 이름을 포함하여 컬렉션의 전체 네임스페이스를 지정합니다.

find

문서

이동할 청크의 샤드 키 값을 지정하는 샤드 키의 동등성 매치입니다. bounds 필드 또는 find 필드 중 하나만 지정하고 둘 다 지정하지는 않습니다. 해시 샤드 키 를사용하는 컬렉션에서 청크를 선택하는 데 필드를 사용하지 마세요 .find

bounds

배열

이동할 특정 청크의 경계입니다. 배열은 이동할 청크의 하위 및 상위 샤드 키 값을 지정하는 두 개의 문서로 구성되어야 합니다. bounds 필드 또는 find 필드 중 하나만 지정하고 둘 다 지정하지는 않습니다. bounds 를 사용하여 해시 샤드 키를 사용하는 컬렉션에서 청크를 선택합니다.

to

문자열

청크 에 대한 수신자 샤드 의 ID .

부울

선택 사항. 명령 이 마이그레이션하기에는 너무 큰 청크를 이동할 수 있는지 여부를 결정하는 플래그입니다. 청크에는 점보 레이블이 지정되거나 표시되지 않을 수 있습니다.

  • true 인 경우 명령은 청크를 이동할 수 있습니다.

  • false 인 경우 명령은 청크를 이동할 수 없습니다.

기본값은 false입니다.

경고:

forceJumbo=true 이 포함된 moveChunk 명령은 컬렉션 에 대한 쓰기 (write) 작업을 차단합니다.

이 옵션을 사용하면 청크가 구성된 청크 크기보다 큰 경우에도 샤드 가 청크를 마이그레이션 합니다. 마이그레이션 기간 동안 컬렉션 쓰기를 사용할 수 없습니다.

긴 차단 기간 없이 이러한 큰 청크를 마이그레이션하려면 대신 크기 제한을 초과하는 범위 균형 조정 을 참조하세요.

_secondaryThrottle

부울

선택 사항. WiredTiger 의 경우 기본값은 false 입니다.

  • true 인 경우 기본적으로 청크 마이그레이션 중에 이동하는 각 문서는 밸런서가 다음 문서를 진행하기 전에 적어도 하나의 보조 문서로 전파됩니다. 이는 { w: 2 } 의 쓰기 고려 (write concern)와 동일합니다.

    다른 쓰기 고려 (write concern)를 지정하려면 writeConcern 옵션을 사용합니다.

  • false 인 경우 밸런서는 보조 문서로의 복제를 기다리지 않고 대신 다음 문서를 계속 진행합니다.

자세한 내용은 보조 스로틀을 참조하세요.

writeConcern

문서

선택 사항. Express 청크 마이그레이션 중에 _secondaryThrottle 가 세컨더리를 기다리는 데 사용할 쓰기 고려 (write concern) 를 문서입니다.

writeConcern _secondaryThrottle: true 가 필요합니다.

_waitForDelete

부울

Optional. If set to true, the delete phase of a moveChunk operation is blocking. _waitForDelete defaults to false.

_waitForDelete 필드가 설정되면 MongoDB는 orphanCleanupDelaySecs 지연을 기다리지 않고 범위 삭제를 수행합니다. _waitForDelete 매개 변수를 사용하고 세컨더리에서 읽기 작업이 발생하는 경우, 마이그레이션의 삭제 단계로 인해 읽기 시 문서가 누락될 수 있습니다.

bounds 의 값은 다음과 같은 형식을 취합니다.

[ { hashedField : <minValue> } ,
{ hashedField : <maxValue> } ]

청크 마이그레이션 섹션에서는 MongoDB의 샤드 간에 청크가 이동하는 방법을 설명합니다.

이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스

Only use the moveChunk in special circumstances such as preparing your sharded cluster for an initial ingestion of data, or a large bulk import operation. In most cases allow the balancer to create and balance chunks in sharded clusters. See Create Ranges in a Sharded Cluster for more information.

moveChunk requires that all indexes exist on the target (i.e. to ) shard before migration and returns an error if a required index does not exist.

moveChunk returns the following error message if another metadata operation is in progress on the chunks collection:

errmsg: "The collection's metadata lock is already taken."

If another process, such as a balancer process, changes meta data while moveChunk is running, you may see this error. You may retry the moveChunk operation without side effects.

MongoDB 부터는 를 설정하다 전송 중인 청크 5.0 의 maxCatchUpPercentageBeforeBlockingWrites moveChunk 총 크기(MB)와 비교했을 때 작업 중에 아직 마이그레이션되지 않은 데이터의 최대 허용 비율을 지정할 수 있습니다.

이 페이지 평가하기

이 페이지의 내용