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로 다운그레이드하려면 지속되고 호환되지 않는 기능을 제거하거나 호환되지 않는 구성 설정을 업데이트해야 합니다. 여기에는 다음이 포함됩니다.
1. 클러스터 기본 읽기 및 쓰기 고려
MongoDB 5.0에서는 클러스터 전체 읽기 및 쓰기 고려 기본값이 변경되었으며, MongoDB 4.4로 다운그레이드하면 이러한 기본값이 다시 변경될 수 있습니다. 다운그레이드하기 전에 클러스터의 기본 읽기 및 쓰기 고려를 수동으로 구성하는 것이 좋습니다.
클러스터의 읽기 또는 쓰기 고려에 대한 기본값을 수동으로 구성하려면
setDefaultRWConcern
명령을 사용합니다.클러스터에 중재자가 포함되어 있고 특정 상황에서 캐시 압력을 방지하기 위해 이전에
"Majority"
읽기 고려를 비활성화했다면, 다운그레이드 후--enableMajorityReadConcern false
또는replication.enableMajorityReadConcern: false
를 구성할 수 있습니다.
2. .
또는 $
문자가 있는 문서 필드
MongoDB 5.0은 문서 필드 이름에 .
또는 $
문자를 포함하는 기능을 지원합니다. MongoDB 4.4로 다운그레이드하기 전에 .
또는 $
문자가 포함된 필드 이름이 포함된 문서를 모두 삭제해야 합니다.
3. 슬림형 시간대 데이터 파일
MongoDB 5.0은 슬림형 시간대 데이터 파일을 지원합니다. --timeZoneInfo
명령줄 옵션 또는 processManagement.timeZoneInfo
구성 파일 설정으로 MongoDB에 제공된 대로 배포에서 슬림형 시간대 데이터 파일을 사용하는 경우, MongoDB 4.4.7 이상으로 다운그레이드하거나, 그렇지 않으면 이전의 비슬림형 데이터 파일을 사용하도록 시간대 데이터 파일을 되돌려야 합니다.
4. Resharding
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.
5. Downgrade Feature Compatibility Version (FCV)
먼저 다음을 확인합니다.
초기 동기화가 진행 중이 아닌지 확인합니다. 초기 동기화가 진행 중일 때
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:
mongo
셸을mongos
인스턴스에 연결합니다.featureCompatibilityVersion
을"4.4"
로 다운그레이드합니다.db.adminCommand({setFeatureCompatibilityVersion: "4.4"}) setFeatureCompatibilityVersion
명령은 내부 시스템 컬렉션에 대한 쓰기를 수행하며 멱등원입니다. 어떤 이유로든 명령이 성공적으로 완료되지 않으면mongos
인스턴스에서 명령을 다시 시도합니다.참고
샤딩된 클러스터에서
setFeatureCompatibilityVersion
가 실행되는 동안 청크 마이그레이션, 분할 및 병합은ConflictingOperationInProgress
로 인해 실패할 수 있습니다.If
setFeatureCompatibilityVersion
fails with aManualInterventionRequired
error, and the cluster has recently undergone a resharding operation that had failed due to an election, you must run thecleanupReshardCollection
command before attemptingsetFeatureCompatibilityVersion
again.
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 thefeatureCompatibilityVersion
:팁
액세스 제어가 활성화된 샤딩된 클러스터의 경우, 복제본 세트 노드에 다음을 명령하려면 반드시 노드를 샤드 로컬 사용자로 연결해야 합니다.
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 가져오기를 참조하세요.
6. Remove FCV 5.0 Persisted Features
다음 단계는 fCV가 "5.0"
로 설정된 적이 있는 경우에만 필요합니다.
4.4와 호환되지 않는 영구적인 5.0 기능을 모두 제거합니다. 여기에는 다음이 포함됩니다.
- time series 컬렉션
- 모든 time series 컬렉션을 제거합니다.
- 런타임 감사 필터 관리
7. Remove 5.0 Features
5.0 기능을 사용하는 모든 영구 기능을 제거합니다. 여기에는 다음이 포함되지만 이에 국한되지는 않습니다.
뷰 정의에
$dateAdd
또는$sampleRate
와 같은 5.0 연산자가 포함된 경우 해당 연산자를 제거해야 합니다. 전체 목록은 새 집계 연산자를 참조하세요.
절차
Downgrade a Sharded Cluster
경고
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.
밸런서를 비활성화합니다.
mongosh
를 샤드된 클러스터의 mongos
인스턴스에 연결하고 sh.stopBalancer()
를 실행하여 밸런서를 사용하지 않도록 설정합니다.
sh.stopBalancer()
참고
마이그레이션이 진행 중인 경우 시스템은 밸런서를 중지하기 전에 진행 중인 마이그레이션을 완료합니다. sh.isBalancerRunning()
을 실행하여 밸런서의 현재 상태를 확인할 수 있습니다.
밸런서가 비활성화되었는지 확인하려면 sh.getBalancerState()
를 실행하면 밸런서가 비활성화된 경우 false를 반환합니다.
sh.getBalancerState()
밸런서 비활성화에 대한 자세한 내용은 밸런서 비활성화를 참조하세요.
각 샤드를 한 번에 하나씩 다운그레이드합니다.
Downgrade the shards one at a time.
Downgrade the shard's secondary members one at a time:
mongosh
에서 다음 명령을 실행하여 완전히 종료하거나mongod
프로세스를 안전하게 종료하는 추가 방법을 보려면
mongod
프로세스 중지를 참조합니다.
db.adminCommand( { shutdown: 1 } ) Replace the 5.0 binary with the 4.4 binary and restart.
Wait for the member to recover to
SECONDARY
state before downgrading the next secondary member. To check the member's state, connectmongosh
to the shard and runrs.status()
method.Repeat to downgrade for each secondary member.
Downgrade the shard arbiter, if any.
복제본 세트에 중재자가 포함되어 있지 않으면 이 단계를 건너뛰세요.
mongosh
에서 다음 명령을 실행하여 완전히 종료하거나mongod
프로세스를 안전하게 종료하는 추가 방법을 보려면
mongod
프로세스 중지를 참조합니다.
db.adminCommand( { shutdown: 1 } ) 중재자 데이터 디렉토리의 내용을 삭제합니다.
storage.dbPath
구성 설정 또는--dbpath
명령줄 옵션이 중재자mongod
의 데이터 디렉토리를 지정합니다.rm -rf /path/to/mongodb/datafiles/* 5.0 바이너리를 4.4 바이너리로 바꾸고 다시 시작합니다.
멤버가
ARBITER
상태로 복구될 때까지 기다립니다. 멤버의 상태를 확인하려면mongosh
를 멤버에 연결하고rs.status()
메서드를 실행합니다.
Downgrade the shard's primary.
Step down the replica set primary. Connect
mongosh
to the primary and users.stepDown()
to step down the primary and force an election of a new primary:rs.stepDown() Run
rs.status()
.rs.status() When the status shows that the primary has stepped down and another member has assumed
PRIMARY
state, proceed.Run the following command from
mongosh
to perform a clean shutdown of the stepped-down primary, or refer tomongod
프로세스 중지 for additional ways to safely terminate themongod
process:db.adminCommand( { shutdown: 1 } ) Replace the 5.0 binary with the 4.4 binary and restart.
나머지 샤드에 대해서도 이 과정을 반복합니다.
config 서버를 다운그레이드합니다.
Downgrade the secondary members of the config servers replica set (CSRS) one at a time:
mongosh
에서 다음 명령을 실행하여 완전히 종료하거나mongod
프로세스를 안전하게 종료하는 추가 방법을 보려면
mongod
프로세스 중지를 참조합니다.
db.adminCommand( { shutdown: 1 } ) Replace the 5.0 binary with the 4.4 binary and restart.
Wait for the member to recover to
SECONDARY
state before downgrading the next secondary member. To check the member's state, connectmongosh
to the shard and runrs.status()
method.Repeat to downgrade for each secondary member.
Step down the config server primary.
프라이머리에
mongosh
를 연결하고rs.stepDown()
을 사용하여 기존 프라이머리를 우선 순위에서 내려오게 하고 강제로 새 프라이머리에 대한 투표를 진행합니다.rs.stepDown() Run
rs.status()
.rs.status() When the status shows that the primary has stepped down and another member has assumed
PRIMARY
state, proceed.Run the following command from
mongosh
to perform a clean shutdown of the stepped-down primary, or refer tomongod
프로세스 중지 for additional ways to safely terminate themongod
process:db.adminCommand( { shutdown: 1 } ) Replace the 5.0 binary with the 4.4 binary and restart.
밸런서 다시 활성화
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.