How to run MongoDB with Zadara Storage at AWS

Zadara Storage provides high performance and security via dedicated SAS and SSD drives per user.
With Zadara it is possible to put the data of mongodb in RAID10 config and the journal in a separated RAID1 volume. The sequential access of the journal makes it an excellent use of the dedicated drives of Zadara.

This article provides step by step instructions on how to run a MongoDB instance with Zadara VPSA.

It assumes a Zadara account and a VPSA have already been created.

If you need to create a Zadara account, please visit the link below:

Once the Zadara account and VPSA are created, it is time to create a MongoDB environment.

Launch a MongoDB instance from the AWS market place:

1 – Go to AWS marketplace to the 10gen’s page:

2 – Click continue
3 – Click on tab “Launch with EC2 console”
4 – Choose US East and press the button “Launch with EC2 console”
5 – You should see the AWS cloud console open on Request Instances Wizard. Click continue
6 – Choose the size of the instance and VPC, with the appropriate subnet
7 – Check the instance details and click continue
8 – Add a value for the instance name and click continue
9 – Choose the key pair and hit continue
10 – Choose the default (or other) firewall configuration and click continue
11 – Click launch!

Mount VPSA volumes to a MongoDB instance:

1 – Connect to your instance via ssh
2 – Install iscsi initiator #sudo yum install iscsi-initiator-utils
3 – Start iscsi service #sudo service iscsi start
4 – Check the IQN of the initiator #cat /etc/iscsi/initiatorname.iscsi
5 – At this point, iSCSI initiator is installed. Next, in order to attach VPSA volumes, you need to use iscsiadm to discover the target and add the CHAP Auth.
In order to restart iSCSI after boot, do chkconfig #chkconfig iscsi on
6 – Go to the VPSA GUI/ Servers and click Connect
7 – Select Linux and iSCSI (you will see the instructions you need to run on the VM to connect to VPSA)
8 – Go back to the MongoDB servers. Copy/paste the wget command, and the chmod and the vpsa_linux commands
9 – At this point, if you hit in the VPSA GUI Servers /Refresh, you should see the new linux server listed
10 – Go to VPSA GUI/Volumes. Create a new volume and attach it to the MongoDB server
11 – On the MongoDB server, you should see the new device by typing #ls -l /dev/disk/by-path
12 – Create a file system: #sudo mkfs.ext4 /dev/sda 
13 – Mount the new file system into /data: #sudo mount /dev/sda /data
14 – It is recommendable to put the journal into a separated volume from a RAID 1 group.  #sudo mount /dev/sdb /data/journal

15 – Edit /etc/mongod.conf file and point the dbpath = /data

16 – Change owner of data directory to mongod $ sudo chown mongod:mongod /data
17 – If desired, create new volumes for journal and logs, and adjust the mongod.conf file appropriately

Run MongoDB:

1 – Run MongoDB:
$ sudo chkconfig mongod on
$ sudo /etc/init.d/mongod start
Starting mongod:                                           [  OK  ]
forked process: 1234
all output going to: /var/log/mongo/mongod.log
2 – Test with mongo shell:
$ mongo
MongoDB shell version: 2.0.4
connecting to: test

Share This Post

More To Explore