@@ -6,19 +6,22 @@ addShard
6
6
7
7
.. dbcommand:: addShard
8
8
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`.
21
23
You must run this command against a :program:`mongos` instance.
24
+
22
25
The command takes the following form:
23
26
24
27
.. code-block:: javascript
@@ -28,13 +31,26 @@ addShard
28
31
Replace ``<hostname>:<port>`` with the hostname and port of the
29
32
database instance you want to add as a shard.
30
33
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.
33
46
34
47
.. code-block:: javascript
35
48
36
49
{ addShard: "replica-set/hostname:port" }
37
50
51
+ If you specify additional hostnames, all must be members of the same
52
+ replica set.
53
+
38
54
Send this command to only one :program:`mongos` instance, it will
39
55
store shard configuration information in the :term:`config database`.
40
56
@@ -48,7 +64,6 @@ addShard
48
64
migrating chunks to the shard when the value of
49
65
:status:`mem.mapped` exceeds the value of ``maxSize``.
50
66
51
-
52
67
.. seealso::
53
68
54
69
:method:`sh.addShard()`,
0 commit comments