How to run MongoDB with VPSA storage at AWS

This article describes step by step how to run a mongodb instance with Zadara VPSA.

It assumes a Zadara account and VPSA was already created.

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

 

http://blog.zadarastorage.com/2012/10/how-to-create-zadara-cloud-block-and.html

 

Once the Zadara account and VPSA is created it is time to create a mongodb environment.

 

Launch MongoDB instance from AWS market place

 

 1 - Go to AWS marketplace to the 10gen's page

 

   https://aws.amazon.com/marketplace/pp/B007IBMJPI/ref=srh_res_product_title?ie=UTF8&sr=0-2&qid=1352492158652

 

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 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

 InitiatorName=iqn.1994-05.com.redhat:3131e417923

5 - At this point iSCSI initiator is installed. Next, in order to attach VPSA volumes 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 - Got 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, 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 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 filesystem  i.e.  #sudo mkfs /dev/sda   

13 - create a directory for data i.e.   #sudo mkdir /mnt/data

14 - mount the new filesystem  #sudo mount /dev/sda /mnt/data

15 - edit /etc/mongod.conf file and point the dbpath = /mnt/data

16 - change owner of data directory to mongod $ sudo chown mongod:mongod /mnt/data

17 - if desired create new volumes for journal and logs and adjust the mongod.conf file appropriately

 

Run Mongodb 

1 - Run mongo db

$ 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

>


Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.