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 は 1 つのバージョンのダウングレードのみをサポートします。現在のリリースより数バージョン前のリリースにダウングレードすることはできません。
例、6.0 シリーズの配置を 5.0 シリーズにダウングレードできます。ただし、5.0 シリーズの配置から 4.4 シリーズの配置へのさらなるダウングレードはサポートされていません。
前提条件
ダウングレード手順を開始する前に、次の前提条件手順を完了する必要があります。
バックアップの作成
任意ですが推奨します。 データベースのバックアップを作成します。
バックアップの作成方法については、「自己管理型配置のバックアップ メソッド 」を参照してください。
下位互換性のない機能を削除する
6.0 から 5.0 にダウングレードするには、5.0 と 互換性のない 6.0 の機能を削除する必要があります。 互換性のない機能のリストと削除方法については、「ダウングレードの考慮事項 」を参照してください。
Ensure No Resharding Operations are in Progress
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.
ダウングレード機能の互換性バージョン(FCV)
To downgrade the FCV of your sharded cluster:
最初の同期が進行中でないことを確認します。 最初の同期の進行中に
setFeatureCompatibilityVersion
コマンドを実行すると、最初の同期がリスタートされます。レプリカセット構成
に
newlyAdded
フィールドがないノードがないことを確認します。 これを確認するには、レプリカセット内の各ノードで次のコマンドを実行します。use local db.system.replset.find( { "members.newlyAdded" : { $exists : true } } ); newlyAdded
フィールドは、最初の同期の実行中とその直後にのみ、ノードのレプリカセット構成ドキュメントにのみ表示されます。レプリカセット ノードが
ROLLBACK
またはRECOVERING
状態になっていないことを確認します。featureCompatibilityVersion
を"5.0"
にダウングレードします。db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } ) setFeatureCompatibilityVersion
コマンドは内部システム コレクションへの書込みを実行し、冪等です。 コマンドが正常に完了しない場合は、mongos
インスタンスでコマンドを再試行してください。注意
Troubleshooting
While
setFeatureCompatibilityVersion
is running on the sharded cluster, chunk migrations, splits, and merges can fail withConflictingOperationInProgress
.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 you attempt to runsetFeatureCompatibilityVersion
again.
レプリカセットのすべてのノードに更新された
featureCompatibilityVersion
が適用されていることを確認するには、各レプリカセット ノードに接続し、featureCompatibilityVersion
を確認します。db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) Tip
アクセス制御
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.
最新の 5.0 バイナリをダウンロードします。
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 の最新パッチ リリースにダウングレードします。
バランサーを無効にします。
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.
バランサーを無効にする方法の詳細については、「 バランサーを無効にする 」を参照してください。
Downgrade each shard, one at a time.
Downgrade the shard's secondary members, one at a time.
ノードをシャットダウンします。
To shut down the
mongod
process, usemongosh
to connect to the deployment and run the following command:db.adminCommand( { shutdown: 1 } ) ノードを再起動します。
mongod
プロセスを開始するには、次のコマンドを実行します。mongod --dbpath </path-to-data-folder> ノードが
SECONDARY
状態になるまで待ちます。Before downgrading the next secondary, wait for the member to recover to the
SECONDARY
state. To check the member's state, use thers.status()
method inmongosh
.Repeat the previous steps to downgrade each secondary member.
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:
ノードをシャットダウンします。
To shut down the arbiter, use
mongosh
to connect to the arbiter and run the following command:db.adminCommand( { shutdown: 1 } ) アービタ データ ディレクトリの内容を削除します。
アービタ
mongod
のデータディレクトリを見つけるには、storage.dbPath
構成設定または--dbpath
コマンドライン オプションのいずれかを確認します。次のコマンドを実行します:
rm -rf /path/to/mongodb/datafiles/* アービタを再起動します。
mongod
プロセスを開始するには、次のコマンドを実行します。mongod --dbpath </path-to-mongodb-datafiles> ノードが
ARBITER
状態になるまで待ちます。Before downgrading the primary, wait for the member to recover to the
ARBITER
state. To check the member's state, use thers.status()
method inmongosh
.
Downgrade the shard primary.
プライマリを降格します。
In
mongosh
, users.stepDown()
to step down the primary and start an election for a new primary:rs.stepDown() プライマリが降格したことを確認します。
次のコマンドを実行します:
rs.status() Verify that the primary has stepped down and another member has assumed the
PRIMARY
state.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 } ) Restart the
mongod
with the 5.0 binary.mongod
プロセスを開始するには、次のコマンドを実行します。mongod --dbpath </path-to-mongodb-datafiles> Repeat for the remaining shards.
Downgrade the config servers.
Downgrade the shard's secondary members of the config servers replica set (CSRS) one at a time:
セカンダリをシャットダウンします。
Connect to the secondary and run the following command:
db.adminCommand( { shutdown: 1 } ) ノードを再起動します。
mongod
プロセスを開始するには、次のコマンドを実行します。mongod --dbpath </path-to-data-folder> ノードが
SECONDARY
状態になるまで待ちます。Before downgrading the next secondary, wait for the member to recover to the
SECONDARY
state. To check the member's state, use thers.status()
method inmongosh
.Repeat the previous steps to downgrade each secondary member.
Downgrade the config server primary.
プライマリを降格します。
In
mongosh
, runrs.stepDown()
to step down the primary and start an election for a new primary:rs.stepDown() プライマリが降格したことを確認します。
次のコマンドを実行します:
rs.status() Verify that the primary has stepped down and another member has assumed the
PRIMARY
state.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 } ) Restart the
mongod
with the 5.0 binary.mongod
プロセスを開始するには、次のコマンドを実行します。mongod --dbpath </path-to-mongodb-datafiles>
バランサーを再度有効にします。
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.