Skip to content

Commit ebc6f03

Browse files
committed
DOCSP-3185: removes out-of-date install instructions and directs users to manual in place
1 parent f1b5592 commit ebc6f03

File tree

1 file changed

+23
-173
lines changed

1 file changed

+23
-173
lines changed

source/platforms/amazon-ec2.txt

Lines changed: 23 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ Amazon EC2
99
.. contents:: On this page
1010
:local:
1111
:backlinks: none
12-
:depth: 1
13-
:class: twocols
12+
:depth: 2
13+
:class: singlecol
1414

1515
To deploy MongoDB on `Amazon EC2 <http://aws.amazon.com/ec2/>`_, you
1616
can either:
1717

18-
* :ref:`Set up a new instance manually <deploy-mongodb-ec2>`, or
18+
- Use `MongoDB Atlas <https://www.mongodb.com/cloud/atlas?jmp=docs>`_, or
1919

20-
* Use MongoDB Atlas.
21-
20+
- :ref:`Set up a new instance manually install MongoDB <deploy-mongodb-ec2>`.
2221

23-
MongoDB Atlas and EC2
24-
---------------------
22+
Deploy MongoDB on EC2 with MongoDB Atlas
23+
----------------------------------------
2524

26-
`MongoDB Atlas <https://www.mongodb.com/cloud/atlas?jmp=docs>`_ is a hosted
25+
`MongoDB Atlas`_ is a hosted
2726
database as a service from the team that engineers the database. Atlas
2827
deploys MongoDB on AWS EC2 instances. The MongoDB Atlas GUI allows you:
2928

@@ -40,10 +39,21 @@ deploys MongoDB on AWS EC2 instances. The MongoDB Atlas GUI allows you:
4039
.. image:: /figures/ec2-atlas.png
4140
:width: 697px
4241

42+
.. _deploy-mongodb-ec2:
43+
44+
Manually Deploy MongoDB on EC2
45+
------------------------------
46+
47+
.. admonition:: Installation
48+
:class: Warning
49+
50+
To install MongoDB on Amazon Linux, refer to the :manual:`installation
51+
instructions in the MongoDB manual </tutorial/install-mongodb-on-amazon>`.
52+
4353
.. _storage-considerations:
4454

4555
Storage Considerations
46-
----------------------
56+
~~~~~~~~~~~~~~~~~~~~~~
4757

4858
EC2 instances can be configured with either ephemeral storage or
4959
persistent storage using the Elastic Block Store (EBS). Ephemeral
@@ -76,174 +86,14 @@ performance, it also provides limited availability and can lead to
7686
reduced performance on read operations, particularly when using
7787
Amazon’s EBS volumes.
7888

79-
.. _deploy-mongodb-ec2:
80-
81-
Manually Deploy MongoDB on EC2
82-
------------------------------
83-
84-
The following steps can be used to deploy MongoDB on EC2 yourself. The
85-
instances will be configured with the following characteristics:
86-
87-
* Amazon Linux
88-
* MongoDB installed via ``yum``
89-
* Individual PIOPS EBS volumes for data (1000 IOPS), journal (250 IOPS),
90-
and log (100 IOPS)
91-
* Updated read-ahead values for each block device
92-
* Update ulimit settings
93-
94-
Before continuing be sure to have the following:
95-
96-
* Install `EC2 command line tools <http://aws.amazon.com/developertools/351>`_
97-
* `Generate an EC2 key pair <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/generating-a-keypair.html>`_ for connecting to the instance via SSH
98-
* `Create a security group <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#creating-security-group>`_ that allows SSH connections
99-
100-
Create the instance using the key pair and security group previously
101-
created and also include the :setting:`--ebs-optimized` flag and
102-
specify individual PIOPS EBS volumes (:file:`/dev/xvdf` for data,
103-
:file:`/dev/xvdg` for journal, :file:`/dev/xvdh` for log). Refer to the
104-
documentation for `ec2-run-instances
105-
<http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-RunInstances.html>`_
106-
for more information on devices and parameters.:
107-
108-
.. code-block:: sh
109-
110-
ec2-run-instances ami-05355a6c -t m1.large -g [SECURITY-GROUP] -k [KEY-PAIR] -b "/dev/xvdf=:200:false:io1:1000" -b "/dev/xvdg=:25:false:io1:250" -b "/dev/xvdh=:10:false:io1:100" --ebs-optimized true
111-
112-
You can use the returned instance-id to ascertain the IP Address or
113-
DNS information for the instance:
114-
115-
.. code-block:: sh
116-
117-
ec2-describe-instances [INSTANCE-ID]
118-
119-
Now SSH into the instance:
120-
121-
.. code-block:: sh
122-
123-
ssh -i /path/to/keypair.pem [email protected]
124-
125-
After login, update installed packages, add the MongoDB yum repo, and install MongoDB:
126-
127-
.. code-block:: sh
128-
129-
echo "[mongodb-org-3.4]
130-
name=MongoDB Repository
131-
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
132-
gpgcheck=1
133-
enabled=1
134-
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc" |
135-
sudo tee -a /etc/yum.repos.d/mongodb-org-3.4.repo
136-
137-
.. code-block:: sh
138-
139-
sudo yum -y update && sudo yum install -y mongodb-org-server \
140-
mongodb-org-shell mongodb-org-tools
141-
142-
Next, create/configure the mount points, mount each volume, set
143-
ownership (MongoDB runs under the :setting:`mongod` user/group), and
144-
set the :file:`/journal` link:
145-
146-
.. code-block:: sh
147-
148-
sudo mkdir /data /log /journal
149-
150-
sudo mkfs.xfs /dev/xvdf
151-
sudo mkfs.xfs /dev/xvdg
152-
sudo mkfs.xfs /dev/xvdh
153-
154-
echo '/dev/xvdf /data xfs defaults,auto,noatime,noexec 0 0
155-
/dev/xvdg /journal xfs defaults,auto,noatime,noexec 0 0
156-
/dev/xvdh /log xfs defaults,auto,noatime,noexec 0 0' | sudo tee -a /etc/fstab
157-
158-
sudo mount /data
159-
sudo mount /journal
160-
sudo mount /log
161-
162-
sudo chown mongod:mongod /data /journal /log
163-
164-
sudo ln -s /journal /data/journal
165-
166-
Now configure the following MongoDB parameters by editing the
167-
configuration file :file:`/etc/mongod.conf` so that it contains the
168-
following:
169-
170-
.. code-block:: ini
171-
172-
dbpath = /data
173-
logpath = /log/mongod.log
174-
175-
If you don't want MongoDB to start at boot, you can issue the following
176-
command:
177-
178-
.. code-block:: sh
179-
180-
sudo chkconfig mongod off
181-
182-
By default Amazon Linux uses :program:`ulimit` settings that are not
183-
appropriate for MongoDB. To setup :program:`ulimit` to match the
184-
documented :manual:`ulimit settings </reference/ulimit>`, run the
185-
following command:
186-
187-
.. code-block:: sh
188-
189-
echo '* soft nofile 64000
190-
* hard nofile 64000
191-
* soft nproc 64000
192-
* hard nproc 64000' | sudo tee /etc/security/limits.d/90-mongodb.conf
193-
194-
Additionally, default read ahead settings on EC2 may not be optimized for
195-
MongoDB. Refer to the :manual:`Production
196-
Notes </administration/production-notes>` for the recommended configuration
197-
for your Linux distribution and selected MongoDB storage engine.
198-
For example, to set readahead to 0 for use with the WiredTiger storage engine,
199-
200-
.. code-block:: sh
201-
202-
sudo blockdev --setra 0 /dev/xvdf
203-
204-
To make this change persistent across system boot, issue the following
205-
command:
206-
207-
.. code-block:: sh
208-
209-
echo 'ACTION=="add|change", KERNEL=="xvdf", ATTR{bdi/read_ahead_kb}="0"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
210-
211-
Once again, repeat the above command for all required volumes (note:
212-
the device we created was named :file:`/dev/xvdf` but the name used by
213-
the system is :file:`xvdf`).
214-
215-
To start :program:`mongod`, issue the following command:
216-
217-
.. code-block:: sh
218-
219-
sudo service mongod start
220-
221-
Then connect to the MongoDB instance using the :program:`mongo` shell:
222-
223-
.. code-block:: sh
224-
225-
mongo
226-
227-
To have MongoDB startup automatically at boot issue the following command:
228-
229-
.. code-block:: sh
230-
231-
sudo chkconfig mongod on
232-
233-
For production deployments consider using :manual:`Replica Sets
234-
</replication/>` or :manual:`Sharding </sharding/>`.
235-
23689
Backup, Restore, Verify
237-
-----------------------
90+
~~~~~~~~~~~~~~~~~~~~~~~
23891

23992
Depending upon the configuration of your EC2 instances, there are a
24093
number of ways to conduct regular backups of your data. For specific
24194
instructions on backing up, restoring and verifying refer to
24295
:ref:`ec2-backup-and-restore`.
24396

244-
Deployment Notes
245-
----------------
246-
24797
Instance Types
24898
~~~~~~~~~~~~~~
24999

@@ -253,7 +103,7 @@ to ensure your selected platform is compatible with your version
253103
of MongoDB.
254104

255105
Running MongoDB
256-
```````````````
106+
~~~~~~~~~~~~~~~
257107

258108
Before starting a :program:`mongod` instance, decide where to put your
259109
data files. Run :program:`df -h` to see a list of available
@@ -280,7 +130,7 @@ start the :program:`mongod` server:
280130

281131

282132
Operating System
283-
````````````````
133+
~~~~~~~~~~~~~~~~
284134

285135
Refer to the MongoDB on Virtual Environments section of the
286136
:manual:`Production Notes </administration/production-notes>` for
@@ -326,7 +176,7 @@ app servers or clients.
326176

327177
Create a rule in your MongoDB security group with the "source" field set
328178
to the Security Group name containing your app servers and the port set
329-
to 27017 (or whatever port you use for your MongoDB). This will ensure
179+
to ``27017`` (or whatever port you use for your MongoDB). This will ensure
330180
that only your app servers have permission to connect to your MongoDB
331181
instances.
332182

0 commit comments

Comments
 (0)