Docs Menu

Downgrade 5.0 Sharded Cluster to 4.4

다운그레이드를 시도하기 전에 이 문서의 내용을 숙지하세요.

중요

복제본 세트를 업그레이드하거나 다운그레이드하기 전에 모든 복제본 세트 멤버가 실행 중인지 확인하세요. 그렇지 않으면 모든 구성원이 시작될 때까지 업그레이드 또는 다운그레이드가 완료되지 않습니다.

5.0에서 다운그레이드해야 하는 경우 최신 패치 릴리스인 4.4로 다운그레이드합니다.

MongoDB는 단일 버전 다운그레이드만 지원합니다. 현재 릴리스보다 이전 버전인 릴리스로 다운그레이드할 수 없습니다.

예시 들어 5.0시리즈를 4.4시리즈 배포서버 로 다운그레이드할 수 있습니다. 그러나 해당 4.4시리즈 배포서버 4.2시리즈 배포서버 로 한 단계 더 다운그레이드하는 것은 지원되지 않습니다.

선택 사항이지만 권장됩니다. 데이터베이스의 백업을 만듭니다.

5.0에서 4.4로 다운그레이드하려면 지속되고 호환되지 않는 기능을 제거하거나 호환되지 않는 구성 설정을 업데이트해야 합니다. 여기에는 다음이 포함됩니다.

MongoDB 5.0에서는 클러스터 전체 읽기 및 쓰기 고려 기본값이 변경되었으며, MongoDB 4.4로 다운그레이드하면 이러한 기본값이 다시 변경될 수 있습니다. 다운그레이드하기 전에 클러스터의 기본 읽기 및 쓰기 고려를 수동으로 구성하는 것이 좋습니다.

MongoDB 5.0은 문서 필드 이름에 . 또는 $ 문자를 포함하는 기능을 지원합니다. MongoDB 4.4로 다운그레이드하기 전에 . 또는 $ 문자가 포함된 필드 이름이 포함된 문서를 모두 삭제해야 합니다.

MongoDB 5.0은 슬림형 시간대 데이터 파일을 지원합니다. --timeZoneInfo 명령줄 옵션 또는 processManagement.timeZoneInfo 구성 파일 설정으로 MongoDB에 제공된 대로 배포에서 슬림형 시간대 데이터 파일을 사용하는 경우, MongoDB 4.4.7 이상으로 다운그레이드하거나, 그렇지 않으면 이전의 비슬림형 데이터 파일을 사용하도록 시간대 데이터 파일을 되돌려야 합니다.

Ensure that any resharding operations have successfully completed before attempting any downgrade procedure. If a recent resharding operation has failed due to a primary failover, you must first run the cleanupReshardCollection command before downgrading the featureCompatibilityVersion of your sharded cluster.

If a resharding operation is still running while you downgrade the featureCompatibilityVersion of your sharded cluster, the resharding operation will abort.

먼저 다음을 확인합니다.

  • 초기 동기화가 진행 중이 아닌지 확인합니다. 초기 동기화가 진행 중일 때 setFeatureCompatibilityVersion 명령을 실행하면 초기 동기화가 다시 시작됩니다.

  • Ensure that no nodes have a newlyAdded field in their replica set configuration. Run the following command on each node in your sharded cluster to verify this:

    use local
    db.system.replset.find( { "members.newlyAdded" : { $exists : true } } );

    newlyAdded 필드는 초기 동기화 중과 초기 동기화 직후 노드의 복제본 세트 구성 문서에 나타납니다.

  • 2} 또는 상태의 ROLLBACK RECOVERING 복제본 집합 구성원이 없는지 확인합니다.

Next, to downgrade the featureCompatibilityVersion of your sharded cluster:

  1. mongo 셸을 mongos 인스턴스에 연결합니다.

  2. featureCompatibilityVersion"4.4"로 다운그레이드합니다.

    db.adminCommand({setFeatureCompatibilityVersion: "4.4"})

    setFeatureCompatibilityVersion 명령은 내부 시스템 컬렉션에 대한 쓰기를 수행하며 멱등원입니다. 어떤 이유로든 명령이 성공적으로 완료되지 않으면 mongos 인스턴스에서 명령을 다시 시도합니다.

    참고

    • 샤딩된 클러스터에서 setFeatureCompatibilityVersion가 실행되는 동안 청크 마이그레이션, 분할 및 병합은 ConflictingOperationInProgress로 인해 실패할 수 있습니다.

    • If setFeatureCompatibilityVersion fails with a ManualInterventionRequired error, and the cluster has recently undergone a resharding operation that had failed due to an election, you must run the cleanupReshardCollection command before attempting setFeatureCompatibilityVersion again.

  3. To ensure that all members of the sharded cluster reflect the updated featureCompatibilityVersion, connect to each shard replica set member and each config server replica set member and check the featureCompatibilityVersion:

    액세스 제어가 활성화된 샤딩된 클러스터의 경우, 복제본 세트 노드에 다음을 명령하려면 반드시 노드를 샤드 로컬 사용자로 연결해야 합니다.

    db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

    모든 멤버는 다음을 포함하는 결과를 반환해야 합니다.

    "featureCompatibilityVersion" : { "version" : "4.4" }

    멤버가 "5.0"featureCompatibilityVersion 를 반환하는 경우 계속하기 전에 멤버가 버전 "4.4" 를 반영할 때까지 기다립니다.

참고

중재자는 admin.system.version 컬렉션을 복제하지 않습니다. 이로 인해 중재자는 복제본 세트의 FCV 값에 관계없이 바이너리의 다운그레이드 버전과 동일한 기능 호환성 버전을 항상 갖게 됩니다.

예시 들어 MongoDB 5.0 클러스터 의 중재자 의 FCV 값은 4.4입니다.

반환된 featureCompatibilityVersion 값에 대한 자세한 내용은 FeatureCompatibilityVersion 가져오기를 참조하세요.

다음 단계는 fCV가 "5.0"로 설정된 적이 있는 경우에만 필요합니다.

4.4와 호환되지 않는 영구적인 5.0 기능을 모두 제거합니다. 여기에는 다음이 포함됩니다.

time series 컬렉션
모든 time series 컬렉션을 제거합니다.
런타임 감사 필터 관리
  • 노드 구성 파일에서 auditLog.runtimeConfigurationfalse로 설정하여 런타임 감사 필터 관리를 비활성화합니다.

  • Update the audit filters for this mongod or mongos instance in the local configuration file.

5.0 기능을 사용하는 모든 영구 기능을 제거합니다. 여기에는 다음이 포함되지만 이에 국한되지는 않습니다.

경고

Before proceeding with the downgrade procedure, ensure that all members, including delayed replica set members in the sharded cluster, reflect the prerequisite changes. That is, check the featureCompatibilityVersion and the removal of incompatible features for each node before downgrading.

1

패키지 관리자나 수동 다운로드를 사용하여 4.4 시리즈의 최신 릴리스를 다운로드합니다. 패키지 관리자를 사용하는 경우 4.4 바이너리에 대한 새 리포지토리를 추가한 다음 실제 다운그레이드 프로세스를 수행합니다.

중요

복제본 세트를 업그레이드하거나 다운그레이드하기 전에 모든 복제본 세트 멤버가 실행 중인지 확인하세요. 그렇지 않으면 모든 구성원이 시작될 때까지 업그레이드 또는 다운그레이드가 완료되지 않습니다.

5.0에서 다운그레이드해야 하는 경우 최신 패치 릴리스인 4.4로 다운그레이드합니다.

2

mongosh를 샤드된 클러스터의 mongos 인스턴스에 연결하고 sh.stopBalancer()를 실행하여 밸런서를 사용하지 않도록 설정합니다.

sh.stopBalancer()

참고

마이그레이션이 진행 중인 경우 시스템은 밸런서를 중지하기 전에 진행 중인 마이그레이션을 완료합니다. sh.isBalancerRunning()을 실행하여 밸런서의 현재 상태를 확인할 수 있습니다.

밸런서가 비활성화되었는지 확인하려면 sh.getBalancerState()를 실행하면 밸런서가 비활성화된 경우 false를 반환합니다.

sh.getBalancerState()

밸런서 비활성화에 대한 자세한 내용은 밸런서 비활성화를 참조하세요.

3

Downgrade the binaries and restart.

4

Downgrade the shards one at a time.

  1. Downgrade the shard's secondary members one at a time:

    1. mongosh에서 다음 명령을 실행하여 완전히 종료하거나 mongod 프로세스를 안전하게 종료하는 추가 방법을 보려면 mongod 프로세스 중지를 참조합니다.

      db.adminCommand( { shutdown: 1 } )
    2. Replace the 5.0 binary with the 4.4 binary and restart.

    3. Wait for the member to recover to SECONDARY state before downgrading the next secondary member. To check the member's state, connect mongosh to the shard and run rs.status() method.

      Repeat to downgrade for each secondary member.

  2. Downgrade the shard arbiter, if any.

    복제본 세트에 중재자가 포함되어 있지 않으면 이 단계를 건너뛰세요.

    1. mongosh에서 다음 명령을 실행하여 완전히 종료하거나 mongod 프로세스를 안전하게 종료하는 추가 방법을 보려면 mongod 프로세스 중지를 참조합니다.

      db.adminCommand( { shutdown: 1 } )
    2. 중재자 데이터 디렉토리의 내용을 삭제합니다. storage.dbPath 구성 설정 또는 --dbpath 명령줄 옵션이 중재자 mongod 의 데이터 디렉토리를 지정합니다.

      rm -rf /path/to/mongodb/datafiles/*
    3. 5.0 바이너리를 4.4 바이너리로 바꾸고 다시 시작합니다.

    4. 멤버가 ARBITER 상태로 복구될 때까지 기다립니다. 멤버의 상태를 확인하려면 mongosh 를 멤버에 연결하고 rs.status() 메서드를 실행합니다.

  3. Downgrade the shard's primary.

    1. Step down the replica set primary. Connect mongosh to the primary and use rs.stepDown() to step down the primary and force an election of a new primary:

      rs.stepDown()
    2. Run rs.status().

      rs.status()

      When the status shows that the primary has stepped down and another member has assumed PRIMARY state, proceed.

    3. Run the following command from mongosh to perform a clean shutdown of the stepped-down primary, or refer to mongod 프로세스 중지 for additional ways to safely terminate the mongod process:

      db.adminCommand( { shutdown: 1 } )
    4. Replace the 5.0 binary with the 4.4 binary and restart.

나머지 샤드에 대해서도 이 과정을 반복합니다.

5
  1. Downgrade the secondary members of the config servers replica set (CSRS) one at a time:

    1. mongosh에서 다음 명령을 실행하여 완전히 종료하거나 mongod 프로세스를 안전하게 종료하는 추가 방법을 보려면 mongod 프로세스 중지를 참조합니다.

      db.adminCommand( { shutdown: 1 } )
    2. Replace the 5.0 binary with the 4.4 binary and restart.

    3. Wait for the member to recover to SECONDARY state before downgrading the next secondary member. To check the member's state, connect mongosh to the shard and run rs.status() method.

      Repeat to downgrade for each secondary member.

  2. Step down the config server primary.

    1. 프라이머리에 mongosh를 연결하고 rs.stepDown()을 사용하여 기존 프라이머리를 우선 순위에서 내려오게 하고 강제로 새 프라이머리에 대한 투표를 진행합니다.

      rs.stepDown()
    2. Run rs.status().

      rs.status()

      When the status shows that the primary has stepped down and another member has assumed PRIMARY state, proceed.

    3. Run the following command from mongosh to perform a clean shutdown of the stepped-down primary, or refer to mongod 프로세스 중지 for additional ways to safely terminate the mongod process:

      db.adminCommand( { shutdown: 1 } )
    4. Replace the 5.0 binary with the 4.4 binary and restart.

6

Once the downgrade of sharded cluster components is complete, connect mongosh to a mongos and re-enable the balancer.

sh.startBalancer()

The mongosh method sh.startBalancer() also enables auto-splitting for the sharded cluster.