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

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

replSetGetConfig

レプリカセット の現在の 構成 を説明するドキュメントを返します。

Tip

In mongosh, this command can also be run through the rs.conf() 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.

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

  • MongoDB Atlas はクラウドでの MongoDB 配置のための完全管理サービスです

重要

このコマンドは、M0 および Flex クラスターではサポートされていません。詳細については、サポートされていないコマンド を参照してください。

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

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

To run, replSetGetConfig must be issued against the admin database. The command has the following syntax:

db.adminCommand(
{
replSetGetConfig: 1,
commitmentStatus: <boolean>,
comment: <any>
}
)
フィールド
タイプ
説明

replSetGetConfig

any

任意の値

ブール値

Optional. Specify true to include a commitmentStatus field in the output. The commitmentStatus output field indicates whether the replica set's previous reconfig has been committed, so that the replica set is ready to be reconfigured again. For details, see commitmentStatus Output Field.

プライマリで コマンドを実行する場合にのみcommitmentStatus: trueオプションを指定できます。 セカンダリでcommitmentStatus: trueを使用して実行すると、コマンドはエラーになります。

comment

any

任意。このコマンドに添付するユーザー指定のコメント。設定すると、このコメントは以下の場所にこのコマンドの記録と合わせて表示されます。

コメントには、有効な BSON 型(string, integer, object, array など)を使用できます。

mongosh provides the rs.conf() method that wraps the replSetGetConfig command:

rs.conf();

The following is an example output of the replSetGetConfig command run with commitmentStatus: true on the primary:

{
"config" : {
"_id" : "myRepl",
"version" : 180294,
"term" : 1,
"protocolVersion" : Long(1),
"writeConcernMajorityJournalDefault" : true,
"members" : [
{
"_id" : 0,
"host" : "m1.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : Long(0),
"votes" : 1
},
{
"_id" : 1,
"host" : "m2.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : Long(0),
"votes" : 1
},
{
"_id" : 2,
"host" : "m3.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : Long(0),
"votes" : 1
}
],
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : -1,
"catchUpTakeoverDelayMillis" : 30000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("5eaa1e9ac4d650aa7817623d")
}
},
"commitmentStatus" : true,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1588212091, 1),
"signature" : {
"hash" : BinData(0,"veOHa2mOeRTzuR0LKqnzGxWV77k="),
"keyId" : Long("6821298283919441923")
}
},
"operationTime" : Timestamp(1588212091, 1)
}
フィールド
説明

config

レプリカセットの構成。 各構成設定の説明については、「自己管理型レプリカセットの構成 」を参照してください。

最新のレプリカセット構成がコミットされたかどうかを示すブール値。すなわち

  • プライマリの最新のレプリカセット構成が大多数のノードに反映され、 かつ

  • 以前の構成のレプリカセットへの最後の書込み操作は、新しい構成ではmajority-committedでした。

If true, then the configuration has been committed, and the replica set can be reconfigured. To reconfigure the replica set, see replSetReconfig command or the mongosh method rs.reconfig().

falseの場合、構成はコミットされておらず、レプリカセットは再構成できません。

ok

コマンドが成功したか( 1 )失敗したか( 0 )を示す数値。

operationTime
$clusterTime

レプリカセットのすべてのコマンドで返されます。 詳細については、 db.adminCommand レスポンスを参照してください。