forked from mongodb/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert-replica-set-to-replicated-shard-cluster.txt
127 lines (84 loc) · 3.67 KB
/
convert-replica-set-to-replicated-shard-cluster.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
==========================================
Convert a Replica Set to a Sharded Cluster
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Overview
--------
This tutorial converts a single three-member replica set to a sharded
cluster with two shards. Each shard is an independent three-member
replica set. This tutorial is specific to MongoDB |version|. For other
versions of MongoDB, refer to the corresponding version of the MongoDB
Manual.
The procedure is as follows:
#. Create the initial three-member replica set and insert data into a
collection. See :ref:`convert-setup-initial-set`.
#. Start the config servers and a :program:`mongos`. See
:ref:`convert-deploy-sharding-infrastructure`.
#. Add the initial replica set as a shard. See
:ref:`convert-add-initial-shard`.
#. Create a second shard and add to the cluster. See
:ref:`convert-add-second-shard`.
#. Shard the desired collection. See :ref:`convert-shard-collection`.
Prerequisites
-------------
This tutorial uses a total of ten servers: one server for the
:program:`mongos` and three servers each for the first :term:`replica
set`, the second replica set, and the :doc:`config server replica set
</core/sharded-cluster-config-servers>`.
Each server must have a resolvable domain, hostname, or IP address
within your system.
The tutorial uses the default data directories (e.g. ``/data/db`` and
``/data/configdb``). Create the appropriate directories with
appropriate permissions. To use different paths, see
:doc:`/reference/configuration-options` .
Procedures
----------
.. _convert-setup-initial-set:
Set Up Initial Replica Set
~~~~~~~~~~~~~~~~~~~~~~~~~~
This procedure creates the initial three-member replica set ``rs0``.
The replica set members are on the following hosts:
``mongodb0.example.net``, ``mongodb1.example.net``, and
``mongodb2.example.net``.
.. include:: /includes/steps/convert-replica-set-shard-deploy-test-data.rst
For more information on deploying a replica set, see
:doc:`/tutorial/deploy-replica-set`.
Restart the Replica Set as a Shard
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionchanged:: 3.4
.. include:: /includes/fact-3.4-shardsvr-required.rst
.. include:: /includes/steps/convert-replica-set-shard-aware.rst
.. _convert-deploy-sharding-infrastructure:
Deploy Config Server Replica Set and ``mongos``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This procedure deploys the three-member replica set for the :doc:`config
servers </core/sharded-cluster-config-servers>` and the
:program:`mongos`.
- The config servers use the following hosts: ``mongodb7.example.net``,
``mongodb8.example.net``, and ``mongodb9.example.net``.
- The :program:`mongos` uses ``mongodb6.example.net``.
.. include:: /includes/steps/convert-replica-set-shard-deploy-infrastructure.rst
.. _convert-add-initial-shard:
Add Initial Replica Set as a Shard
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following procedure adds the initial replica set ``rs0`` as a shard.
.. include:: /includes/steps/convert-replica-set-add-shards.rst
.. _convert-add-second-shard:
Add Second Shard
~~~~~~~~~~~~~~~~
The following procedure deploys a new replica set ``rs1`` for the
second shard and adds it to the cluster. The replica set members are on
the following hosts: ``mongodb3.example.net``,
``mongodb4.example.net``, and ``mongodb5.example.net``.
.. versionchanged:: 3.4
.. include:: /includes/fact-3.4-shardsvr-required.rst
.. include:: /includes/steps/convert-replica-set-add-new-shard.rst
.. _convert-shard-collection:
Shard a Collection
~~~~~~~~~~~~~~~~~~
.. include:: /includes/steps/convert-replica-set-enable-sharding.rst