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

レプリカセット ノードの状態

レプリカセットの各ノードにはそれぞれ状態があります。

番号
名前
状態の説明

0

Not yet an active member of any set. All members start up in this state. The mongod parses the replica set configuration document while in STARTUP.

1

ステートプライマリのノードは、書込み操作を受け付けることができる唯一のノードです。これらのノードには、投票資格があります。

2

状態セカンダリのノードは、データ ストアをレプリケートします。これらのノードには、投票資格があります。

3

ノードは、起動時のセルフチェックを実行するか、ロールバックまたは再同期の完了から移行します。このノードからの読み取りにはデータを使用できません。これらのノードには、投票資格があります。

5

ノードは最初の同期を実行中です。 レプリカセットに新しく追加された場合を除き、投票資格があります。

6

セットの別のノードから見て、ノードの状態はまだわかりません。

7

アービタはデータをレプリケートせず、選挙に参加するためだけに存在します。これらのノードには、投票資格があります。

8

セット内の別のノードから見て、そのノードは到達不可能です。

9

このノードはロールバックを積極的に実行します。これらのノードには、投票資格があります。このノードからの読み取りにはデータを使用できません。

バージョン4.2 以降、 MongoDB はノードがROLLBACK 状態になると、進行中のすべてのユーザー操作を強制終了します。

10

このノードはかつてレプリカセットに含まれていましたが、その後削除されました。

PRIMARY

PRIMARY状態のメンバーは書込み操作を受け入れます。レプリカセットには、一度に最大 1 つのプライマリが含まれます。 []1 SECONDARYメンバーは選挙後にプライマリになります。PRIMARY 状態のメンバーには投票資格があります。

SECONDARY

Members in SECONDARY state replicate the primary's data set and can be configured to accept read operations. Secondaries are eligible to vote in elections, and may be elected to the PRIMARY state if the primary becomes unavailable.

ARBITER

Members in ARBITER state do not replicate data or accept write operations. They are eligible to vote, and exist solely to break a tie during elections. Replica sets should only have a member in the ARBITER state if the set would otherwise have an even number of voting members, and could suffer from tied elections. There should only be at most one arbiter configured in any replica set. For considerations when using an arbiter, see Replica Set Arbiter.

コア状態について詳しくは、「レプリカセット ノード」を参照してください。

STARTUP

Each member of a replica set starts up in STARTUP state. mongod then loads that member's replica set configuration, and transitions the member's state to STARTUP2 or ARBITER. Members in STARTUP are not eligible to vote, as they are not yet a recognized member of any replica set.

STARTUP2

バージョン5.0で変更。

Each data-bearing member of a replica set enters the STARTUP2 state as soon as mongod finishes loading that member's configuration.

The member then decides whether or not to undertake an initial sync. If a member begins an initial sync, the member remains in STARTUP2 until all data is copied and all indexes are built. Afterwards, the member transitions to RECOVERING.

に新しく追加されたメンバーには投票資格がなく、投票できません。最初の同期プロセス中に選択されます。STARTUP2 MongoDB.5 0より前は、STARTUP2 のメンバーには投票資格がありました。

RECOVERING

A member of a replica set enters RECOVERING state when it is not ready to accept reads. The RECOVERING state can occur during normal operation, and doesn't necessarily reflect an error condition. Members in the RECOVERING state are eligible to vote in elections, but are not eligible to enter the PRIMARY state.

A member transitions from RECOVERING to SECONDARY after replicating enough data to guarantee a consistent view of the data for client reads. The only difference between RECOVERING and SECONDARY states is that RECOVERING prohibits client reads and SECONDARY permits them. SECONDARY state does not guarantee anything about the staleness of the data with respect to the primary.

Due to overload, a secondary may fall far enough behind the other members of the replica set such that it may need to resync with the rest of the set. When this happens, the member enters the RECOVERING state and requires manual intervention.

ROLLBACK

Whenever the replica set replaces a primary in an election, the old primary may contain documents that did not replicate to the secondary members. In this case, the old primary member reverts those writes. During rollback, the member will have ROLLBACK state. Members in the ROLLBACK state are eligible to vote in elections.

Starting in version 4.2, MongoDB kills all in-progress user operations when a member enters the ROLLBACK state.

エラー状態のノードは投票できません。

UNKNOWN

Members that have never communicated status information to the replica set are in the UNKNOWN state.

DOWN

Members that lose their connection to the replica set are seen as DOWN by the remaining members of the set.

REMOVED

Members that are removed from the replica set enter the REMOVED state. When members enter the REMOVED state, the logs will mark this event with a replSet REMOVED message entry.

[1]

状況によっては、 replica set内の 2 つのノードが一時的に自分たちがプライマリであると認識することがありますが、最大でそのうちの 1 つが{ w: "majority" }書き込み懸念で書き込みを完了できます。 { w: "majority" }書き込みを完了できるノードは現在のプライマリであり、もう一方のノードは、通常はネットワークパーティションが原因で降格をまだ認識していない以前のプライマリです。これが発生すると、以前のプライマリに接続するクライアントは、読み取り設定primaryを要求したにもかかわらず、古いデータを検出する可能性があり以前のプライマリへの新しい書き込みは最終的にロールバックされます。

このページを評価