定義
replSetGetConfigレプリカセット の現在の 構成 を説明するドキュメントを返します。
Tip
In
mongosh, this command can also be run through thers.conf()helper method.Helper methods are convenient for
mongoshusers, 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> } )
コマンドフィールド
フィールド | タイプ | 説明 |
|---|---|---|
| any | 任意の値 |
ブール値 | Optional. Specify プライマリで コマンドを実行する場合にのみ | |
| 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) }
フィールド | 説明 |
|---|---|
| レプリカセットの構成。 各構成設定の説明については、「自己管理型レプリカセットの構成 」を参照してください。 |
最新のレプリカセット構成がコミットされたかどうかを示すブール値。すなわち
If
| |
| コマンドが成功したか( |
| レプリカセットのすべてのコマンドで返されます。 詳細については、 db.adminCommand レスポンスを参照してください。 |