Skip to content

Commit a219035

Browse files
authored
(DOCSP-10926) Add --type --shard to cluster create (#127)
* (DOCSP-10926) Add --type --shard to cluster create
1 parent faf6edd commit a219035

File tree

2 files changed

+146
-26
lines changed

2 files changed

+146
-26
lines changed

snooty.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name = "mongocli"
22

3+
intersphinx = ["https://docs.mongodb.com/manual/objects.inv","https://docs.atlas.mongodb.com/objects.inv"]
4+
35
[constants]
46
default-profile = ":ref:`default profile <mcli-profiles>`"
57
mcli = "MongoDB CLI"

source/reference/atlas/cluster-create.txt

Lines changed: 144 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mongocli atlas cluster create
99
.. contents:: On this page
1010
:local:
1111
:backlinks: none
12-
:depth: 1
12+
:depth: 2
1313
:class: singlecol
1414

1515
.. include:: /includes/styles/corrections.rst
@@ -30,16 +30,18 @@ Syntax
3030

3131
mongocli atlas cluster create <cluster-name>
3232
[ --backup ]
33-
[ --tier <cluster-tier> ]
3433
[ --diskSizeGB <size-of-disk> ]
3534
[ --file|-f <path-to-cluster-config-file> ]
3635
[ --mdbVersion <mongodb-version> ]
3736
[ --members|-m <number-of-members> ]
38-
[ --projectId <project-ID> ]
3937
[ --profile|-P <profile-name> ]
38+
[ --projectId <project-ID> ]
4039
--provider AWS|GCP|AZURE
4140
--region|-r <region-name>
42-
41+
[ --shards|-s <number-of-shards> ]
42+
[ --tier <cluster-tier> ]
43+
[ --type <replicaset-or-sharded>]
44+
4345
.. include:: /includes/fact-command-line-help.rst
4446

4547
.. _atlas-cluster-create-options:
@@ -56,15 +58,6 @@ Options
5658
- Description
5759
- Required?
5860

59-
* - ``--backup``
60-
-
61-
- Flag to enable :atlas:`backup </backup-cluster>` on
62-
``M10`` and larger clusters. This option is not available
63-
for clusters smaller than ``M10``. If omitted, :atlas:`cloud
64-
provider snapshots </backup/cloud-provider-snapshots>` is
65-
disabled.
66-
- no
67-
6861
* - ``<cluster-name>``
6962
- string
7063
- Name of the cluster. The cluster name cannot
@@ -73,12 +66,13 @@ Options
7366
hyphen.
7467
- yes
7568

76-
* - ``--tier``
77-
- string
78-
- Name of the :atlas:`cluster tier </cluster-tier/>` you want to
79-
use. You can later modify your cluster tier with the
80-
:ref:`mongocli atlas cluster update <mcli-atlas-cluster-update-command>`
81-
command. If omitted, uses the tier ``M2``.
69+
* - ``--backup``
70+
-
71+
- Flag to enable :atlas:`backup </backup-cluster>` on
72+
``M10`` and larger clusters. This option is not available
73+
for clusters smaller than ``M10``. If omitted, :atlas:`cloud
74+
provider snapshots </backup/cloud-provider-snapshots>` is
75+
disabled.
8276
- no
8377

8478
* - ``--diskSizeGB``
@@ -134,8 +128,7 @@ Options
134128

135129
* - ``--members``, ``-m``
136130
- integer
137-
- Number of members in the :atlas:`replica set
138-
</reference/glossary/#term-replica-set>`. The
131+
- Number of members in the :term:`replica set`. The
139132
default value is ``3``.
140133
- no
141134

@@ -206,6 +199,34 @@ Options
206199

207200
- yes
208201

202+
* - ``--shards``, ``-s``
203+
- integer
204+
- Number of shards in the :term:`sharded cluster`. The
205+
default value is ``1``, which is equivalent to a replica set.
206+
- no
207+
208+
* - ``--tier``
209+
- string
210+
- Name of the :atlas:`cluster tier </cluster-tier/>` you want to
211+
use. You can later modify your cluster tier with the
212+
:ref:`mongocli atlas cluster update <mcli-atlas-cluster-update-command>`
213+
command. If omitted, uses the tier ``M2``.
214+
- no
215+
216+
* - ``--type``
217+
- string
218+
- Type of cluster to deploy. Value can be:
219+
220+
- ``REPLICASET`` to deploy a
221+
:term:`replica set`,
222+
or
223+
224+
- ``SHARDED`` to deploy a
225+
:term:`sharded cluster`.
226+
227+
By default, deploys a replica set.
228+
- no
229+
209230
.. _atlas-cluster-create-output-fields:
210231

211232
Output
@@ -220,15 +241,15 @@ Output
220241
Examples
221242
--------
222243

223-
Example 1
224-
~~~~~~~~~
244+
Create a Cluster
245+
~~~~~~~~~~~~~~~~
225246

226247
The following ``mongocli atlas cluster create`` command creates a sample
227248
``M2`` cluster named ``myCluster`` in the AWS region ``US_EAST_1`` with
228249
``3`` nodes. The command uses the {+default-profile+},
229250
which contains the public and private keys for accessing |service|.
230251

231-
.. code-block:: text
252+
.. code-block:: sh
232253
:copyable: false
233254

234255
mongocli atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --members 3 --tier M2 --mdbVersion {+mdbVersion+} --diskSizeGB 10
@@ -297,8 +318,8 @@ these fields, see :ref:`Output <atlas-cluster-create-output-fields>`.
297318
"stateName": "CREATING"
298319
}
299320

300-
Example 2
301-
~~~~~~~~~
321+
Create a Cluster using a Configuration File
322+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302323

303324
The following ``mongocli atlas cluster create`` command creates a
304325
sample ``M40`` cluster named ``myCluster`` in the |aws| region
@@ -417,3 +438,100 @@ these fields, see :ref:`Output <atlas-cluster-create-output-fields>`.
417438
],
418439
"stateName": "CREATING"
419440
}
441+
442+
Create a Sharded Cluster
443+
~~~~~~~~~~~~~~~~~~~~~~~~
444+
445+
The following ``mongocli atlas cluster create`` command creates a sample
446+
``M10`` sharded cluster named ``myShardedCluster`` in the |gcp| region
447+
``EASTERN_US`` with ``2`` shards and ``3`` nodes per shard. The command
448+
uses the {+default-profile+}, which contains the public and private
449+
keys for accessing |service|, as well as a default project ID.
450+
451+
.. code-block:: sh
452+
:copyable: false
453+
454+
mongocli atlas cluster create myShardedCluster \
455+
--provider GCP \
456+
--region EASTERN_US \
457+
--type SHARDED \
458+
--shards 2 \
459+
--members 3 \
460+
--tier M10 \
461+
--mdbVersion {+mdbVersion+} \
462+
--diskSizeGB 10
463+
464+
The command returns the following to the terminal. To learn more about
465+
these fields, see :ref:`Output <atlas-cluster-create-output-fields>`.
466+
467+
.. code-block:: json
468+
:copyable: false
469+
470+
{
471+
"autoScaling": {
472+
"diskGBEnabled": true,
473+
"compute": {
474+
"enabled": false,
475+
"scaleDownEnabled": false
476+
}
477+
},
478+
"backupEnabled": false,
479+
"biConnector": {
480+
"enabled": false,
481+
"readPreference": "secondary"
482+
},
483+
"clusterType": "SHARDED",
484+
"diskSizeGB": 10,
485+
"encryptionAtRestProvider": "NONE",
486+
"labels": [
487+
{
488+
"key": "Infrastructure Tool",
489+
"value": "mongoCLI"
490+
}
491+
],
492+
"id": "5efe19b205e4b2501fb14374",
493+
"groupId": "5dd6fab7493979f10faffb78",
494+
"mongoDBVersion": "4.2.8",
495+
"mongoDBMajorVersion": "4.2",
496+
"mongoURIUpdated": "2020-07-02T17:30:25Z",
497+
"name": "testShard",
498+
"numShards": 2,
499+
"paused": false,
500+
"pitEnabled": false,
501+
"providerBackupEnabled": false,
502+
"providerSettings": {
503+
"instanceSizeName": "M10",
504+
"providerName": "GCP",
505+
"regionName": "EASTERN_US",
506+
"autoScaling": {
507+
"compute": {}
508+
}
509+
},
510+
"replicationFactor": 3,
511+
"replicationSpec": {
512+
"EASTERN_US": {
513+
"analyticsNodes": 0,
514+
"electableNodes": 3,
515+
"priority": 7,
516+
"readOnlyNodes": 0
517+
}
518+
},
519+
"replicationSpecs": [
520+
{
521+
"id": "505e4b24efe19b1fb1437429",
522+
"numShards": 2,
523+
"zoneName": "Zone 1",
524+
"regionsConfig": {
525+
"EASTERN_US": {
526+
"analyticsNodes": 0,
527+
"electableNodes": 3,
528+
"priority": 7,
529+
"readOnlyNodes": 0
530+
}
531+
}
532+
}
533+
],
534+
"stateName": "CREATING",
535+
"connectionStrings": {}
536+
}
537+

0 commit comments

Comments
 (0)