AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

replSetSyncFrom(データベースコマンド)

replSetSyncFrom

現在のmongodのデフォルトの同期ターゲットを一時的に上書きします。 この操作は、さまざまなパターンをテストしたり、セット ノードが目的のホストから複製されていない状況に役立ちます。

Tip

In mongosh, this command can also be run through the rs.syncFrom() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

Run replSetSyncFrom in the admin database.

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

重要

このコマンドは、MongoDB Atlas クラスターではサポートされていません。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。

このコマンドの構文は、次のとおりです。

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

このコマンドは、次のフィールドを使用します。

フィールド
タイプ
説明

replSetSyncFrom

string

このノードが複製するレプリカセット ノードの名前とポート番号。 [hostname]:[port]形式を使用します。

1 voteを持つレプリカセット メンバーは、 0 votesを持つメンバーからは同期できません。

For replSetSyncFrom to override the default sync target, settings.chainingAllowed must be set to true.

If settings.chainingAllowed is set to false, replSetSyncFrom returns ok:1 but does not set the sync target.

MongoDB 5.0.2 以降、サーバーパラメータ enableOverrideClusterChainingSettingtrue に設定することで、settings.chainingAllowed を上書きできます。これにより、settings.chainingAllowedfalse であってもセカンダリ メンバーからの同期は許可されます。

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と同期ターゲットの間の接続が閉じます。

  • 同期ターゲットが maxSyncSourceLagSecs(デフォルトでは30)秒以上遅れている場合 :レプリカセットの別のノード。

For more information the use of replSetSyncFrom, see Configure a Self-Managed Secondary's Sync Target.