ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Docs Menu

Downgrade 6.0 Sharded Cluster to 5.0

다운그레이드를 시도하기 전에 이 페이지의 내용을 숙지합니다.

중요

Before you upgrade or downgrade a sharded cluster, ensure all sharded cluster members are running. If you do not, the upgrade or downgrade will not complete until all members are started.

6.0에서 다운그레이드해야 하는 경우 최신 패치 릴리스인 5.0으로 다운그레이드하세요.

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

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

다운그레이드 절차를 시작하기 전에 다음 사전 필수 단계를 완료해야 합니다.

1

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

백업 을 만드는 방법을 학습 보려면 자체 관리 배포서버를 위한 백업 방법을 참조하세요.

2

6.0에서 5.0으로 다운그레이드하려면 5.0과 호환되지 않는 6.0 기능을 제거해야 합니다. 호환되지 않는 기능 목록과 해당 기능을 제거하는 방법은 다운그레이드 고려 사항을 참조하세요.

3

Ensure that any resharding operations have successfully completed. 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 not complete.

4

To downgrade the FCV of your sharded cluster:

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

  2. 복제본 세트 구성newlyAdded 필드가 있는 노드가 없는지 확인합니다. 복제본 세트의 각 노드에서 다음 명령을 실행하여 이를 확인합니다.

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

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

  3. ROLLBACK 또는 RECOVERING 상태에 있는 복제본 세트 멤버가 없는지 확인합니다.

  4. Use mongosh to connect to your mongos instance.

  5. featureCompatibilityVersion"5.0"로 다운그레이드합니다.

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

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

    참고

    Troubleshooting

  6. 복제본 세트의 모든 멤버에 업데이트된 featureCompatibilityVersion 이(가) 있는지 확인하려면 각 복제본 세트 멤버에 연결하여 featureCompatibilityVersion 을(를) 확인합니다.

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

    액세스 제어

    For a sharded cluster that has access control enabled, to run the adminCommand on a shard replica set member, you must connect to the member as a shard local user.

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

    "featureCompatibilityVersion" : { "version" : "5.0" }

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

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

경고

Before proceeding with the downgrade procedure, ensure that all sharded cluster members, including delayed replica set members, have the prerequisite changes. To do that, check the featureCompatibilityVersion and the remove the incompatible features for each node before downgrading.

1

Using either a package manager or a manual download, get the latest release in the 5.0 series. If using a package manager, add a new repository for the 5.0 binaries, then perform the actual downgrade process.

중요

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

6.0에서 다운그레이드해야 하는 경우 최신 패치 릴리스인 5.0으로 다운그레이드하세요.

2

5.0 바이너리가 시스템 경로에 있는지 확인합니다. 바이너리 버전을 확인하려면 다음 명령을 실행합니다.

mongod --version

명령 출력에 5.0 시리즈 릴리스가 표시되어야 합니다.

3

To disable the balancer, connect mongosh to a mongos instance in the sharded cluster, and run the following command:

sh.stopBalancer()

참고

If a migration is in progress, MongoDB completes the in-progress migration before stopping the balancer. To check the balancer's current state, run sh.isBalancerRunning().

To verify that the balancer is disabled, run the following command:

sh.getBalancerState()

sh.getBalancerState() returns false if the balancer is disabled.

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

4
  1. To stop mongos, run the following command:

    db.shutdownServer()
  2. 다시 시작 mongos with the 5.0 binary.

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

    1. 멤버를 종료합니다.

      To shut down the mongod process, use mongosh to connect to the deployment and run the following command:

      db.adminCommand( { shutdown: 1 } )
    2. 멤버를 다시 시작합니다.

      mongod 프로세스를 시작하려면 다음 명령을 실행합니다:

      mongod --dbpath </path-to-data-folder>
    3. 멤버가 SECONDARY 상태가 될 때까지 기다립니다.

      Before downgrading the next secondary, wait for the member to recover to the SECONDARY state. To check the member's state, use the rs.status() method in mongosh.

    4. Repeat the previous steps to downgrade each secondary member.

  2. Downgrade the shard arbiter, if any.

    Skip this step if the replica set does not include an arbiter.

    Downgrade the arbiter member of the sharded cluster:

    1. 멤버를 종료합니다.

      To shut down the arbiter, use mongosh to connect to the arbiter and run the following command:

      db.adminCommand( { shutdown: 1 } )
    2. 중재자 데이터 디렉토리의 내용을 삭제합니다.

      중재자 mongod 의 데이터 디렉토리를 찾으려면 storage.dbPath 구성 설정 또는 --dbpath 명령줄 옵션을 확인하세요.

      다음 명령을 실행합니다:

      rm -rf /path/to/mongodb/datafiles/*
    3. 중재자를 다시 시작합니다.

      mongod 프로세스를 시작하려면 다음 명령을 실행합니다:

      mongod --dbpath </path-to-mongodb-datafiles>
    4. 멤버가 ARBITER 상태가 될 때까지 기다립니다.

      Before downgrading the primary, wait for the member to recover to the ARBITER state. To check the member's state, use the rs.status() method in mongosh.

  3. Downgrade the shard primary.

    1. 프라이머리을 내려놓습니다.

      In mongosh, use rs.stepDown() to step down the primary and start an election for a new primary:

      rs.stepDown()
    2. 프라이머리가 물러났는지 확인합니다.

      다음 명령을 실행합니다:

      rs.status()

      Verify that the primary has stepped down and another member has assumed the PRIMARY state.

    3. Shut down the former primary member.

      To shut down the former primary, connect to the deployment using mongosh and run the following command:

      db.adminCommand( { shutdown: 1 } )
    4. Restart the mongod with the 5.0 binary.

      mongod 프로세스를 시작하려면 다음 명령을 실행합니다:

      mongod --dbpath </path-to-mongodb-datafiles>
    5. Repeat for the remaining shards.

6
  1. Downgrade the shard's secondary members of the config servers replica set (CSRS) one at a time:

    1. 세컨더리를 종료합니다.

      Connect to the secondary and run the following command:

      db.adminCommand( { shutdown: 1 } )
    2. 멤버를 다시 시작합니다.

      mongod 프로세스를 시작하려면 다음 명령을 실행합니다:

      mongod --dbpath </path-to-data-folder>
    3. 멤버가 SECONDARY 상태가 될 때까지 기다립니다.

      Before downgrading the next secondary, wait for the member to recover to the SECONDARY state. To check the member's state, use the rs.status() method in mongosh.

    4. Repeat the previous steps to downgrade each secondary member.

  2. Downgrade the config server primary.

    1. 프라이머리을 내려놓습니다.

      In mongosh, run rs.stepDown() to step down the primary and start an election for a new primary:

      rs.stepDown()
    2. 프라이머리가 물러났는지 확인합니다.

      다음 명령을 실행합니다:

      rs.status()

      Verify that the primary has stepped down and another member has assumed the PRIMARY state.

    3. Shut down the former primary member.

      To shut down the former primary, connect to the deployment using mongosh and run the following command:

      db.adminCommand( { shutdown: 1 } )
    4. Restart the mongod with the 5.0 binary.

      mongod 프로세스를 시작하려면 다음 명령을 실행합니다:

      mongod --dbpath </path-to-mongodb-datafiles>
7

After you downgrade all of the sharded cluster components, connect to a mongos and run the following command to re-enable the balancer:

sh.startBalancer()

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