Docs Menu

replSetSyncFrom

replSetSyncFrom

Temporarily overrides the default sync target for the current mongod. This operation is useful for testing different patterns and in situations where a set member is not replicating from the desired host.

mongosh에서 이 명령을 rs.syncFrom() 헬퍼 메서드를 통해서도 실행할 수 있습니다.

헬퍼 메서드는 mongosh 사용자에게 편리하지만 데이터베이스 명령과 동일한 수준의 정보를 반환하지 못할 수 있습니다. 편의가 필요하지 않거나 추가 리턴 필드가 필요한 경우 데이터베이스 명령을 사용합니다.

Run replSetSyncFrom in the admin database.

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

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

중요

이 명령은 M0, M2, M5, M10+ 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.

명령은 다음과 같은 구문을 가집니다:

db.adminCommand(
{
replSetSyncFrom: "hostname<:port>"
}
)

The command takes the following field:

필드
유형
설명

replSetSyncFrom

문자열

The name and port number of the replica set member that this member should replicate from. Use the [hostname]:[port] form.

Replica set members with 1 vote cannot sync from members with 0 votes.

If an initial sync operation is in progress when you run replSetSyncFrom, replSetSyncFrom stops the in-progress initial sync and restarts the sync process with the new target.

필요한 경우에만 기본 동기화 로직을 수정하고 항상 주의를 기울입니다.

동기화할 멤버는 세트의 데이터에 대한 유효한 소스여야 합니다. 구성원으로부터 동기화하려면 해당 구성원은 다음을 충족해야 합니다.

  • 데이터가 있습니다. 중재자가 될 수 없으며, 시작 또는 복구 모드 상태가 아니고, 데이터 쿼리에 응답할 수 있어야 합니다.

  • 접근이 가능해야 합니다.

  • 복제본 세트 구성에서 동일한 세트의 멤버여야 합니다.

  • members[n].buildIndexes 설정으로 인덱스를 빌드합니다.

  • 자체 동기화를 방지하기 위해 세트의 다른 구성원이어야 합니다.

현재 구성원보다 10초 이상 뒤처진 멤버로부터 복제를 시도하는 경우 mongod는 경고를 기록하지만 여전히 뒤처진 구성원으로부터 복제를 수행합니다. 복제 지연 및 흐름 제어를 참조하세요.

replSetSyncFrom provide a temporary override of default behavior. mongod will revert to the default sync behavior in the following situations:

  • mongod 인스턴스가 다시 시작됩니다.

  • mongod와 동기화 대상 간의 연결이 닫힙니다.

  • 동기화 대상이 복제본 세트의 다른 구성원보다 30초 이상 뒤처지는 경우.

For more information the use of replSetSyncFrom, see 자체 관리 세컨더리의 동기화 대상 구성.