Skip to content

Commit 8baa217

Browse files
author
Ed Costello
committed
Add warning about localhost,
1 parent abf9358 commit 8baa217

File tree

3 files changed

+49
-19
lines changed

3 files changed

+49
-19
lines changed

source/reference/command/addShard.txt

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@ addShard
66

77
.. dbcommand:: addShard
88

9-
:option name: Optional. Unless specified, a name will be
10-
automatically provided to uniquely identify
11-
the shard.
12-
13-
:option maxSize: Optional. Unless specified, shards will consume
14-
the total amount of available space on their
15-
machines if necessary. Use the ``maxSize`` value
16-
to limit the amount of space the database can
17-
use. Specify this value in megabytes.
18-
19-
Use this method to add a database instance or replica set to a
20-
:term:`sharded cluster`.
9+
:param string hostname: a hostname or replica-set/hostname string.
10+
11+
:param string name: Optional. Unless specified, a name will be
12+
automatically provided to uniquely identify
13+
the shard.
14+
15+
:param integer maxSize: Optional. Unless specified, shards will consume
16+
the total amount of available space on their
17+
machines if necessary. Use the ``maxSize`` value
18+
to limit the amount of space the database can
19+
use. Specify this value in megabytes.
20+
21+
Use the :dbcommand:`addShard` command to add a database instance
22+
or replica set to a :term:`sharded cluster`.
2123
You must run this command against a :program:`mongos` instance.
24+
2225
The command takes the following form:
2326

2427
.. code-block:: javascript
@@ -28,13 +31,26 @@ addShard
2831
Replace ``<hostname>:<port>`` with the hostname and port of the
2932
database instance you want to add as a shard.
3033

31-
If the database instance is a member of a replica set, you must specify
32-
the replica set name and at least one member of the replica set:
34+
.. warning::
35+
36+
Do not use ``localhost`` for the hostname unless your
37+
:term:`configuration server <config database>`
38+
is also running on ``localhost``.
39+
40+
The optimal configuration is to deploy shards across
41+
:term:`replica sets <replica set>`.
42+
To add a shard on a replica set you must specify the name of the
43+
replica set and the hostname of at least one member of the replica
44+
set. You may specify all of the hostnames, but at least one member
45+
must be specified.
3346

3447
.. code-block:: javascript
3548

3649
{ addShard: "replica-set/hostname:port" }
3750

51+
If you specify additional hostnames, all must be members of the same
52+
replica set.
53+
3854
Send this command to only one :program:`mongos` instance, it will
3955
store shard configuration information in the :term:`config database`.
4056

@@ -48,7 +64,6 @@ addShard
4864
migrating chunks to the shard when the value of
4965
:status:`mem.mapped` exceeds the value of ``maxSize``.
5066

51-
5267
.. seealso::
5368

5469
:method:`sh.addShard()`,

source/reference/method/sh.addShard.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ sh.addShard()
99
:param string host: Specify the hostname of a database instance or a
1010
replica set configuration.
1111

12-
1312
Use this method to add a database instance or replica set to a
1413
:term:`sharded cluster`.
1514
This method must be run on a :program:`mongos` instance.
@@ -23,16 +22,26 @@ sh.addShard()
2322
You can specify shards using the hostname, or a hostname and port
2423
combination if the shard is running on a non-standard port.
2524

25+
.. warning::
26+
27+
Do not use ``localhost`` for the hostname unless your
28+
:term:`configuration server <config database>`
29+
is also running on ``localhost``.
30+
2631
The optimal configuration is to deploy shards across
2732
:term:`replica sets <replica set>`.
2833
To add a shard on a replica set you must specify the name of the
2934
replica set and the hostname of at least one member of the replica
30-
set. You can specify all of the hostnames, but at least one member
35+
set. You may specify all of the hostnames, but at least one member
3136
must be specified.
3237

33-
This method is a helper for the :dbcommand:`addShard` command.
38+
If you specify additional hostnames, all must be members of the same
39+
replica set.
40+
41+
The :method:`~sh.addShard()` method is a helper for the
42+
:dbcommand:`addShard` command.
3443
The :dbcommand:`addShard` command has additional options which are
35-
not available in this method.
44+
not available with this helper.
3645

3746
.. seealso::
3847

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Or you can use the :method:`sh.addShard()` helper in the
4848
Replace ``[hostname]`` and ``[port]`` with the hostname and TCP
4949
port number of where the shard is accessible.
5050

51+
.. warning::
52+
53+
Do not use ``localhost`` for the hostname unless your
54+
:term:`configuration server <config database>`
55+
is also running on ``localhost``.
56+
5157
For example:
5258

5359
.. code-block:: javascript

0 commit comments

Comments
 (0)