Skip to content

Commit 1594c0b

Browse files
author
Bob Grabar
committed
DOCS-239, edits to first 3 of the 5 topics listed
1 parent d5b88a9 commit 1594c0b

File tree

3 files changed

+113
-123
lines changed

3 files changed

+113
-123
lines changed

source/tutorial/add-shards-to-shard-cluster.txt

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,37 @@ Add Shards to an Existing Cluster
77
Synopsis
88
--------
99

10-
This document outlines the procedure for adding a :term:`shard` to an
11-
existing :term:`shard cluster`. If you have a shard cluster as your
12-
data set grows, you will add additional shards. See the
13-
":doc:`/administration/sharding`" document for additional sharding
14-
procedures.
10+
This document describes how to add a :term:`shard` to an
11+
existing :term:`shard cluster`. If you have a shard cluster, then as your
12+
data set grows you will add additional shards. For additional sharding
13+
procedures, see :doc:`/administration/sharding`.
1514

1615
Concerns
1716
--------
1817

1918
Distributing :term:`chunks <chunk>` among your cluster requires some
2019
capacity to support the migration process. When adding a shard to your
2120
cluster, you should always ensure that your cluster has enough
22-
capacity to support the migration without impacting legitimate
21+
capacity to support the migration without affecting legitimate
2322
production traffic.
2423

2524
In production environments, all shards should be :term:`replica sets
2625
<replica set>`. Furthermore, *all* interaction with your sharded
27-
cluster should pass through a :program:`mongos` instance, and this
26+
cluster should pass through a :program:`mongos` instance. This
2827
tutorial assumes that you already have a :program:`mongo` shell
2928
connection to a :program:`mongos` instance.
3029

3130
Process
3231
-------
3332

34-
First, you need to tell the cluster where to find the individual
33+
Tell the cluster where to find the individual
3534
shards. You can do this using the :dbcommand:`addShard` command:
3635

3736
.. code-block:: javascript
3837

3938
db.runCommand( { addShard: mongodb0.example.net, name: "mongodb0" } )
4039

41-
More practically you will use the :func:`sh.addShard()` helper:
40+
Optionally you can use the :func:`sh.addShard()` helper:
4241

4342
.. code-block:: javascript
4443

@@ -64,14 +63,14 @@ For example:
6463

6564
replicaSetName/<seed1>,<seed2>,<seed3>
6665

67-
For example, if the name of the replica set is "``repl0``", then
66+
For example, if the name of the replica set is ``repl0``, then
6867
your :func:`sh.addShard` command would be:
6968

7069
.. code-block:: javascript
7170

7271
sh.addShard( "repl0/mongodb0.example.net:27027,mongodb1.example.net:27017,mongodb2.example.net:27017" )
7372

74-
Repeat this step for each shards in your cluster.
73+
Repeat this step for each shard in your cluster.
7574

7675
.. optional::
7776

@@ -83,16 +82,18 @@ Repeat this step for each shards in your cluster.
8382
db.runCommand( { addShard: mongodb0.example.net, name: "mongodb0" } )
8483
sh.addShard( mongodb0.example.net, name: "mongodb0" )
8584

86-
If you do not specify a shard name, then MongoDB will assign a
85+
If you do not specify a shard name, then MongoDB assigns a
8786
name upon creation.
8887

8988
.. note::
9089

9190
It may take some time for :term:`chunks <chunk>` to migrate to the new
92-
shard, because the system must copy data from one :program:`mongod`
91+
shard because the system must copy data from one :program:`mongod`
9392
instance to another while maintaining data consistency.
9493

95-
See the ":ref:`Balancing and Distribution <sharding-balancing>`"
96-
section for an overview of the balancing operation and the
97-
":ref:`Balancing Internals <sharding-balancing-internals>`" section
98-
for additional information.
94+
For an overview of the balancing operation,
95+
see the :ref:`Balancing and Distribution <sharding-balancing>`
96+
section.
97+
98+
For additional information on balancing, see the
99+
:ref:`Balancing Internals <sharding-balancing-internals>` section.

source/tutorial/deploy-shard-cluster.txt

Lines changed: 69 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,24 @@ Deploy a Shard Cluster
77
Synopsis
88
--------
99

10-
This document outlines the full procedure for deploying a
11-
:term:`shard cluster` in MongoDB. Use the
12-
":doc:`/tutorial/convert-replica-set-to-replicated-shard-cluster`"
13-
procedure if you have an existing replica set. If you have a
14-
standalone :program:`mongod` instance you can use this tutorial to
15-
deploy a shard cluster.
10+
This document describes how to deploy a :term:`shard cluster` for a
11+
standalone :program:`mongod` instance.
12+
13+
To deploy a shard cluster for an existing replica set, see instead
14+
:doc:`/tutorial/convert-replica-set-to-replicated-shard-cluster`.
1615

1716
Requirements
1817
------------
1918

20-
See the ":ref:`Requirements for Shard Clusters
21-
<sharding-requirements>`" section for more information about potential
22-
requirements for shard cluster.
19+
Before deploying a shard cluster, see the requirements listed in
20+
:ref:`Requirements for Shard Clusters <sharding-requirements>`.
2321

2422
.. warning:: Sharding and "localhost" Addresses
2523

26-
If you use either "localhost" or "``127.0.0.1``" as the hostname
27-
portion of any host identifier, either the ``host`` argument to
24+
If you use either "localhost" or ``127.0.0.1`` as the hostname
25+
portion of any host identifier, for example as the ``host`` argument to
2826
:dbcommand:`addShard` or the value to the :option:`mongos --configdb`
29-
run time option, then you must use "localhost" or "``127.0.0.1``"
27+
run time option, then you must use "localhost" or ``127.0.0.1``
3028
for *all* host settings. If you mix localhost addresses and remote
3129
host address, MongoDB will produce errors.
3230

@@ -40,105 +38,97 @@ Begin by configuring three config servers. These are very small
4038
:program:`mongod` instances that provide cluster metadata. You must
4139
have exactly *three* instances in production deployments. For
4240
redundancy these instances should run on different systems and
43-
servers.
41+
servers. It's important to separate config server :program:`mongod`
42+
instances to provide redundancy and to ensure that cluster
43+
metadata is secure and durable.
44+
45+
Because the config server :program:`mongod` instances receive relatively
46+
little traffic and demand only a small portion of system resources, you
47+
can run the instances on systems that run other services, such as on
48+
shards or on servers that run :program:`mongos`.
4449

45-
At a system prompt use the following command to start a config server:
50+
To start a config server, type the following command at a system prompt:
4651

4752
.. code-block:: sh
4853

4954
mongod --configsvr
5055

51-
The :option:`--configsrv` stores config database in the `configdb/`
52-
subdirectory of the :setting:`dbpath` directory, which is
53-
``/data/db/`` by default. Additionally, a config server instance will
54-
be accessible via port ``27019``. You may use other :doc:`mongod
55-
runtime options </reference/configuration-options>` in addition to
56-
:setting:`configsvr` as needed.
56+
The :option:`--configsrv` stores a config database in the `configdb/`
57+
subdirectory of the :setting:`dbpath` directory. By default, the
58+
:setting:`dbpath` directory is ``/data/db/``. The config server instance
59+
is accessible via port ``27019``. In addition to :setting:`configsvr`,
60+
use other :doc:`mongod runtime options </reference/configuration-options>`
61+
as needed.
5762

5863
Repeat this process for all three config servers.
5964

60-
.. note::
61-
62-
It's important to separate config server :program:`mongod`
63-
instances to provide redundancy and ensure that the cluster
64-
metadata is secure and durable. Nevertheless, config
65-
:program:`mongod` instances themselves do not demand a large number
66-
of system resources and receive relatively little traffic. As a
67-
result you may choose to run config server instances on a system
68-
that also runs another service: on three of the shards, on a server
69-
that has a :program:`mongos`, or another component of your
70-
infrastructure.
71-
7265
Start ``mongos`` Instances
7366
~~~~~~~~~~~~~~~~~~~~~~~~~~
7467

75-
All operations against a shard cluster use a :program:`mongos`
76-
instance to route queries and operations to the appropriate shards,
77-
and to interact with the configdb instances. :program:`mongos`
78-
instances are lightweight and a shard cluster can have many
79-
:program:`mongos` instances: typically, you will run one
80-
:program:`mongos` instance on each of your application servers.
68+
All operations against a shard cluster go through the :program:`mongos`
69+
instance. The :program:`mongos` instance routes queries and operations
70+
to the appropriate shards and interacts with the configdb instances.
71+
72+
:program:`mongos` instances are lightweight, and a shard cluster can
73+
have multiple instances. Typically, you run one :program:`mongos`
74+
instance on each of your application servers.
75+
76+
You must specify three config servers. Use resolvable host names for
77+
all hosts, using DNS or your system's hostfile to provide operational
78+
flexibility.
79+
80+
The :program:`mongos` instance runs on the default MongoDB port of ``27017``.
8181

8282
Use the following command at a system prompt to start a
83-
:program:`mongos`:
83+
:program:`mongos` instance:
8484

8585
.. code-block:: sh
8686

8787
mongos --configdb config0.mongodb.example.net,config1.mongodb.example.net,config2.mongodb.example.net --port 27017
8888

89-
This invocation assumes that you have config servers running on the
90-
following hosts:
89+
The above example assumes that you have config servers running on the following hosts:
9190

9291
- ``config0.mongodb.example.net``
9392
- ``config1.mongodb.example.net``
9493
- ``config2.mongodb.example.net``
9594

96-
The :program:`mongos` will run on the default MongoDB port of
97-
``27017``.
98-
99-
You must specify three config servers. Use resolvable host names for
100-
all hosts, using DNS or your systems hostfile to provide operational
101-
flexibility.
102-
10395
Add Shards to the Cluster
10496
~~~~~~~~~~~~~~~~~~~~~~~~~
10597

10698
In a production shard cluster, each shard is itself a :term:`replica
107-
set`. Deploy at least two replica sets, for use as shards. See
108-
":doc:`/tutorial/deploy-replica-set`" for instructions regarding
109-
replica set deployment. When you have two active and functioning
110-
replica sets, continue below.
99+
set`. You must deploy at least two replica sets for use as shards. For
100+
instructions on deploying replica sets, see
101+
:doc:`/tutorial/deploy-replica-set`.
111102

112-
Log into a :program:`mongos` using the :program:`mongo` shell. If the
113-
:program:`mongos` is accessible at ``mongos0.mongodb.example.net`` on
114-
port ``27017`` then this invocation would resemble:
103+
When you have two active and functioning replica sets, perform the procedure here:
104+
105+
Using the :program:`mongo` shell, log into a :program:`mongos`. For example,
106+
if the :program:`mongos` is accessible at
107+
``mongos0.mongodb.example.net`` on port ``27017`` you would type:
115108

116109
.. code-block:: sh
117110

118111
mongo mongos0.mongodb.example.net
119112

120-
Then, use the :func:`sh.addShard()` to add each shard to the cluster.
113+
To add each shard to the cluster, Use :func:`sh.addShard()`. For
114+
example, to add two shards with the hostnames ``shard0.example.net`` and
115+
``shard1.example.net`` on port ``27017``, type:.
121116

122117
sh.addShard( "shard0.example.net" )
123118
sh.addShard( "shard1.example.net" )
124119

125-
This will add two shards with the hostnames ``shard0.example.net`` and
126-
``shard1.example.net`` on port ``27017``.
127-
128-
.. note:: In production deployments, all shards should be replica sets.
129-
130120
.. versionchanged:: 2.0.3
131121

132122
After version 2.0.3, you may use the above form to add replica
133-
sets to a cluster and the cluster will automatically discover
123+
sets to a cluster. The cluster will automatically discover
134124
the members of the replica set and adjust its configuration
135125
accordingly.
136126

137127
Before version 2.0.3, you must specify the shard in the
138128
following form: the replica set name, followed by a forward
139129
slash, followed by a comma-separated list of seeds for the
140130
replica set. For example, if the name of the replica set is
141-
"``repl0``", then your :func:`sh.addShard` command might resemble:
131+
``repl0``, then your :func:`sh.addShard` command might resemble:
142132

143133
.. code-block:: javascript
144134

@@ -162,28 +152,26 @@ connected to a :program:`mongos` instance in your cluster:
162152

163153
sh.enableSharding("records")
164154

165-
Where ``records`` is the name of the database that holds a collection
166-
that you want to shard. :func:`sh.enableSharding()` is a wrapper
155+
Where ``records`` is the name of the database that holds the collection
156+
you want to shard. :func:`sh.enableSharding()` is a wrapper
167157
around the :dbcommand:`enableSharding` :term:`database command`. You
168-
may enable sharding for as many databases as you like in your
169-
deployment.
158+
can enable sharding for multiple databases in your deployment.
170159

171160
Enable Sharding for Collections
172161
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173162

174-
Finally, you may enable sharding on a per-collection basis. Because
163+
You can enable sharding on a per-collection basis. Because
175164
MongoDB uses "range based sharding," you must specify a :term:`shard
176-
key` that MongoDB can use to distribute your documents among the
177-
shards. See the section of this manual that provides an :ref:`overview
178-
of shard keys <sharding-shard-key>` as well as the section that
179-
explores the :ref:`features of good shard keys in-depth
180-
<sharding-shard-key>`.
181-
182-
Enable sharding for a collection using the
183-
:func:`sh.shardCollection()` helper in the :program:`mongo` shell,
184-
which provides a wrapper around the :dbcommand:`shardCollection`
185-
:term:`database command`. The shell helper has the following prototype
186-
form:
165+
key` MongoDB can use to distribute your documents among the
166+
shards. For more information, see the sections of this manual that give
167+
an :ref:`overview of shard keys <sharding-shard-key>` and that
168+
give an in-depth exploration of the
169+
:ref:`features of good shard keys <sharding-shard-key>`.
170+
171+
To enable sharding for a collection, use the
172+
:func:`sh.shardCollection()` helper in the :program:`mongo` shell.
173+
The helper provides a wrapper around the :dbcommand:`shardCollection`
174+
:term:`database command` and has the following prototype form:
187175

188176
.. code-block:: javascript
189177

@@ -240,6 +228,6 @@ In order, these operations shard:
240228
``{ "hashed_id": 1 }``.
241229

242230
This shard key distributes documents by the value of the
243-
``hashed_id`` field. Presumably this is a is a computed value that
244-
holds the hash of some value in your documents, and will be able to
231+
``hashed_id`` field. Presumably this is a computed value that
232+
holds the hash of some value in your documents and is able to
245233
evenly distribute documents throughout your cluster.

0 commit comments

Comments
 (0)