Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/core/sharded-cluster-components.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Sharded Cluster Components
A MongoDB :term:`sharded cluster` consists of the following components:

* :doc:`shard </core/sharded-cluster-shards>`: Each shard contains a
subset of the sharded data. Each shard can be deployed as a :term:`replica
set`.
subset of the sharded data. As of MongoDB 3.6, shards must be deployed
as a :term:`replica set`.

* :doc:`/core/sharded-cluster-query-router`: The ``mongos`` acts as a
query router, providing an interface between client applications and the
Expand Down
4 changes: 2 additions & 2 deletions source/core/sharded-cluster-shards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ A :term:`shard` contains a subset of sharded data for a :term:`sharded
cluster`. Together, the cluster's shards hold the entire data set for the
cluster.

Shards should be deployed as a :term:`replica set` to provide redundancy and
high availability.
As of MongoDB 3.6, shards must be deployed as a :term:`replica set` to
provide redundancy and high availability.

Users, clients, or applications should only directly connect to a shard to
perform local administrative and maintenance operations.
Expand Down
12 changes: 9 additions & 3 deletions source/includes/apiargs-dbcommand-addShard-field.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
arg_name: field
description: |
The hostname and port of the :binary:`~bin.mongod` instance to be added
as a shard. To add a replica set as a shard, specify the name
of the replica set and the hostname and port of a member of the replica set.
The replica set name and hostname of at least one member of the
shard's replica set. Include the port number if the instance is
running on a non-standard port. All additional hostnames must be comma
separated and belong to the same replica set. For example:

.. code-block:: sh

<replica_set>/<hostname><:port>,<hostname><:port>, ...

interface: dbcommand
name: addShard
operation: addShard
Expand Down
13 changes: 9 additions & 4 deletions source/includes/apiargs-method-sh.addShard-param.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
arg_name: param
description: |
The hostname of either a standalone database instance or of a replica
set. Include the port number if the instance is running on a
non-standard port. Include the replica set name if the instance is a
replica set, as explained below.
The replica set name and hostname of at least one member of the
shard's replica set. Include the port number if the instance is
running on a non-standard port. All additional hostnames must be comma
separated and belong to the same replica set. For example:

.. code-block:: sh

<replica_set>/<hostname><:port>,<hostname><:port>, ...

interface: method
name: host
operation: sh.addShard
Expand Down
9 changes: 9 additions & 0 deletions source/includes/fact-bind-ip-sharded-clusters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. note::

The :option:`--bind_ip <mongod --bind_ip>` option must be specified when
the sharded cluster members are run on different hosts or if
remote clients connect to the sharded cluster. If you are
deploying the entire sharded cluster on a single host and
do not require external client connections, you can omit the
:option:`--bind_ip <mongod --bind_ip>` option. For more information, see
:ref:`3.6-bind_ip-compatibility`.
7 changes: 7 additions & 0 deletions source/includes/options-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,13 @@ description: |
- Start this instance as a :term:`shard`. The instance starts
on port ``27018`` by default.
post: |
.. note::

Setting ``sharding.clusterRole`` requires the :binary:`~bin.mongod`
instance to be running with replication. To deploy the instance as
a replica set member, use the :setting:`~replication.replSetName`
setting and specify the name of the replica set to join.

The {{role}} setting is available only for :binary:`~bin.mongod`.
---
program: conf
Expand Down
15 changes: 15 additions & 0 deletions source/includes/options-mongod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,21 @@ description: |
Configures this {{program}} instance as a shard in a
sharded cluster. The default port for these instances is
``27018``.

.. important::

.. versionchanged:: 3.6

You must deploy shards as replica sets with the :option:`--replSet`
option or :setting:`~replication.replSetName` setting
specified. To deploy sharded clusters with shard replica
sets, follow the appropriate tutorial depending on your
:ref:`sharding strategy<sharding-strategy>`:

- :doc:`/tutorial/deploy-sharded-cluster-hashed-sharding`

- :doc:`/tutorial/deploy-sharded-cluster-ranged-sharding`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. As for the sharded-cluster-components and sharded-cluster-shards, I used the "As of MongoDB 3.X, ..." Language. Is this ok or should I use .. versionchanged:: or none of that stuff?


optional: false
---
program: mongod
Expand Down
119 changes: 66 additions & 53 deletions source/includes/steps-3.6-upgrade-sharded-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,38 @@ title: "Upgrade the config servers."
level: 4
ref: 3.6-upgrade-config-servers
content: |-
If the config servers are replica sets:

1. Upgrade the :ref:`secondary <replica-set-secondary-members>`
members of the replica set one at a time:

a. Shut down the secondary :binary:`~bin.mongod` instance and replace
the |oldversion| binary with the |newversion| binary.

#. Start the |newversion| binary with both the ``--configsvr``,
``--port`` options,

If the sharded cluster members are run on different hosts or
if you wish remote clients to connect to the sharded cluster,
you must also specify ``--bind_ip`` (or the
:setting:`net.bindIp` setting). For more information, see
:ref:`3.6-bind_ip-compatibility`.
#. Start the |newversion| binary with the :option:`--configsvr <mongod --configsvr>`,
:option:`--replSet <mongod --replSet>`, :option:`--port <mongod --port>`, and :option:`--bind_ip <mongod --bind_ip>`
options. Include any optional command line options used by the
previous deployment:

.. cssclass:: copyable-code
.. code-block:: sh

mongod --configsvr --port <port> --dbpath <path> --bind_ip localhost,<ip address>
mongod --configsvr --replSet <replSetName> --port <port> --dbpath <path> --bind_ip localhost,<ip address>

.. include:: /includes/fact-bind-ip-sharded-clusters.rst

If using a :doc:`configuration file
</reference/configuration-options>`, update the file to
specify :setting:`sharding.clusterRole: configsvr
<sharding.clusterRole>` and :setting:`net.port` (and
:setting:`net.bindIp` setting if needed) and start the
|newversion| binary:
<sharding.clusterRole>`, :setting:`replication.replSetName`,
:setting:`net.port`, and :setting:`net.bindIp`,
then start the |newversion| binary:

.. cssclass:: copyable-code
.. code-block:: yaml

sharding:
clusterRole: configsvr
replication:
replSetName: <string>
net:
port: <port>
bindIp: localhost,<ip address>
Expand All @@ -90,6 +90,7 @@ content: |-
:method:`rs.stepDown()` to step down the primary and force an
election of a new primary:

.. cssclass:: copyable-code
.. code-block:: javascript

rs.stepDown()
Expand All @@ -99,31 +100,32 @@ content: |-
the stepped-down primary and replace the :binary:`~bin.mongod` binary
with the |newversion| binary.

#. Start the |newversion| binary with both the ``--configsvr`` and
``--port`` options:

If the sharded cluster members are run on different hosts or
if you wish remote clients to connect to the sharded cluster,
you must also specify ``--bind_ip`` (or the
:setting:`net.bindIp` setting). For more information, see
:ref:`3.6-bind_ip-compatibility`.
#. Start the |newversion| binary with the :option:`--configsvr <mongod --configsvr>`,
:option:`--replSet <mongod --replSet>`, :option:`--port <mongod --port>`, and :option:`--bind_ip <mongod --bind_ip>`
options. Include any optional command line options used by the
previous deployment:

.. cssclass:: copyable-code
.. code-block:: sh

mongod --configsvr --port <port> --dbpath <path> --bind_ip localhost,<ip address>
mongod --configsvr --replSet <replSetName> --port <port> --dbpath <path> --bind_ip localhost,<ip address>

.. include:: /includes/fact-bind-ip-sharded-clusters.rst

If using a :doc:`configuration file
</reference/configuration-options>`, update the file to
specify :setting:`sharding.clusterRole: configsvr
<sharding.clusterRole>` and :setting:`net.port` (and
:setting:`net.bindIp` setting if needed), and start the
|newversion| binary:
<sharding.clusterRole>`, :setting:`replication.replSetName`,
:setting:`net.port`, and :setting:`net.bindIp`,
then start the |newversion| binary:

.. cssclass:: copyable-code
.. code-block:: yaml

sharding:
clusterRole: configsvr
replication:
replSetName: <string>
net:
port: <port>
bindIp: localhost,<ip address>
Expand All @@ -136,37 +138,43 @@ title: Upgrade the shards.
level: 4
ref: 3.6-upgrade-shards
content: |-
Upgrade the shards one at a time. If the shards are replica sets, for each shard:
Upgrade the shards one at a time. If you are running standalone
shards, first convert them to a
:doc:`replica set</tutorial/convert-standalone-to-replica-set>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location of this conversion seems not quite right. Since now, my config servers are already 3.6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we mention standalone in

https://docs-mongodbcom-staging.corp.mongodb.com/jdestefano/DOCS-11064/reference/method/sh.addShard.html

And, did you test whether if you had a standalone shard, that just changing to the repl set correctly updates the shard meta data held by the config servers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Sorry, I'm not sure I understand the first comment? Let's discuss tomorrow.
  • Updated sh.addShard and the addShard dbcommand.
  • I did not test the meta data scenario. I am not sure how to do this off the top of my head but can look into this tomorrow if needed.


For each shard:

1. Upgrade the :ref:`secondary <replica-set-secondary-members>`
members of the replica set one at a time:

a. Shut down the :binary:`~bin.mongod` instance and replace the |oldversion|
binary with the |newversion| binary.

#. Start the |newversion| binary with the ``--shardsvr`` and
``--port`` command line options.

If the sharded cluster members are run on different hosts or
if you wish remote clients to connect to the sharded cluster,
you must also specify ``--bind_ip`` (or the
:setting:`net.bindIp` setting). For more information, see
:ref:`3.6-bind_ip-compatibility`.
#. Start the |newversion| binary with the :option:`--shardsvr <mongod --shardsvr>`,
:option:`--replSet <mongod --replSet>`, :option:`--port <mongod --port>`, and :option:`--bind_ip <mongod --bind_ip>`
options. Include any optional command line options used by the
previous deployment:

.. cssclass:: copyable-code
.. code-block:: sh

mongod --shardsvr --port <port> --dbpath <path> --bind_ip localhost,<ip address>
mongod --shardsvr --replSet <replSetName> --port <port> --dbpath <path> --bind_ip localhost,<ip address>

.. include:: /includes/fact-bind-ip-sharded-clusters.rst

Of if using a :doc:`configuration file
If using a :doc:`configuration file
</reference/configuration-options>`, update the file to
include :setting:`sharding.clusterRole: shardsvr
<sharding.clusterRole>` and :setting:`net.port` (and
:setting:`net.bindIp` setting if needed) and start:
include :setting:`sharding.clusterRole: shardsvr <sharding.clusterRole>`,
:setting:`replication.replSetName`, :setting:`net.port`, and
:setting:`net.bindIp`, then start the |newversion| binary:

.. cssclass:: copyable-code
.. code-block:: yaml

sharding:
clusterRole: shardsvr
replication:
replSetName: <string>
net:
port: <port>
bindIp: localhost,<ip address>
Expand All @@ -188,6 +196,7 @@ content: |-
:method:`rs.stepDown()` to step down the primary and force an
election of a new primary:

.. cssclass:: copyable-code
.. code-block:: javascript

rs.stepDown()
Expand All @@ -199,30 +208,32 @@ content: |-
1. Shut down the stepped-down primary and replace the
:binary:`~bin.mongod` binary with the |newversion| binary.

#. Start the |newversion| binary with the ``--shardsvr`` and
``--port`` command line options.

If the sharded cluster members are run on different hosts or
if you wish remote clients to connect to the sharded cluster,
you must also specify ``--bind_ip`` (or the
:setting:`net.bindIp` setting). For more information, see
:ref:`3.6-bind_ip-compatibility`.
#. Start the |newversion| binary with the :option:`--shardsvr <mongod --shardsvr>`,
:option:`--replSet <mongod --replSet>`, :option:`--port <mongod --port>`, and :option:`--bind_ip <mongod --bind_ip>`
options. Include any optional command line options used by the
previous deployment:

.. cssclass:: copyable-code
.. code-block:: sh

mongod --shardsvr --port <port> --dbpath <path> --bind_ip localhost,<ip address>
mongod --shardsvr --replSet <replSetName> --port <port> --dbpath <path> --bind_ip localhost,<ip address>

Of if using a :doc:`configuration file
.. include:: /includes/fact-bind-ip-sharded-clusters.rst

If using a :doc:`configuration file
</reference/configuration-options>`, update the file to
specify :setting:`sharding.clusterRole: shardsvr
<sharding.clusterRole>` and :setting:`net.port` (and
:setting:`net.bindIp` setting if needed) and start the
<sharding.clusterRole>`, :setting:`replication.replSetName`,
:setting:`net.port`, and :setting:`net.bindIp`, then start the
|newversion| binary:

.. cssclass:: copyable-code
.. code-block:: yaml

sharding:
clusterRole: shardsvr
replication:
replSetName: <string>
net:
port: <port>
bindIp: localhost,<ip address>
Expand All @@ -245,6 +256,7 @@ content: |-
:setting:`net.bindIp` setting). For more information, see
:ref:`3.6-bind_ip-compatibility`.

.. cssclass:: copyable-code
.. code-block:: sh

mongos --configdb csReplSet/<rsconfigsver1:port1>,<rsconfigsver2:port2>,<rsconfigsver3:port3> --bind_ip localhost,<ip address>
Expand All @@ -259,7 +271,6 @@ content: |-
:method:`sh.setBalancerState()` to re-enable the balancer:

.. cssclass:: copyable-code

.. code-block:: javascript

sh.setBalancerState(true)
Expand All @@ -286,9 +297,11 @@ action:
On a :binary:`~bin.mongos` instance, run the
:dbcommand:`setFeatureCompatibilityVersion` command in the ``admin``
database:
copyable: true
language: javascript
code: |
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )

post: |
This command must perform writes to an internal system
collection. If for any reason the command does not complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ action:
following example:
language: sh
code: |
mongod --keyFile <path-to-keyfile> --shardsvr --replSet <replSetname> --dbpath <path>
mongod --keyFile <path-to-keyfile> --shardsvr --replSet <replSetName> --dbpath <path>
post: |
.. include:: /includes/extracts/default-bind-ip-security-additional-command-line.rst
---
Expand Down
Loading