Liatz
Liatz

Reputation: 5207

mongodb EBS on EC2

I use mongodb and nodejs on ec2,I would like to deploy it in order to support 10,000 request a day. I would like to make sure that if the instance terminates or reboots(?) somehow the database won't be lost. I understand that i need to create an EBS volumes for storing the data.

I tried http://www.mongodb.org/display/DOCS/Amazon+EC2+Quickstart#AmazonEC2Quickstart-ConfigureStorage but it didn't work. I get to the point where i should run [ec2-user@domU-... ~]$ sudo chown mongod:mongod /data but I get : chown: invalid user: `mongod:mongod'

solved it by : sudo chown mongod.mongod /data still can't run mongod working :

$sudo /etc/init.d/mongod start
Starting mongod: forked process: 1694
all output going to: /log/mongod.log
                                                           [FAILED][ec2-user@domU-... /]$ sudo mongod --dbpath=/data
Mon Oct 29 21:46:56 [initandlisten] MongoDB starting : pid=1675 port=27017 dbpath=/data 64-bit host=domU-...
Mon Oct 29 21:46:56 [initandlisten] db version v2.2.0, pdfile version 4.5
Mon Oct 29 21:46:56 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Mon Oct 29 21:46:56 [initandlisten] build info: Linux ... c8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Mon Oct 29 21:46:56 [initandlisten] options: { dbpath: "/data" }
Mon Oct 29 21:47:00 [initandlisten] journal dir=/data/journal
Mon Oct 29 21:47:00 [initandlisten] recover : no journal files present, no recovery needed
Mon Oct 29 21:47:00 [initandlisten] 
Mon Oct 29 21:47:00 [initandlisten] ERROR: Insufficient free space for journal files
Mon Oct 29 21:47:00 [initandlisten] Please make at least 3379MB available in /data/journal or use --smallfiles
Mon Oct 29 21:47:00 [initandlisten] 
Mon Oct 29 21:47:00 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Mon Oct 29 21:47:00 dbexit: 
Mon Oct 29 21:47:00 [initandlisten] shutdown: going to close listening sockets...
Mon Oct 29 21:47:00 [initandlisten] shutdown: going to flush diaglog...
Mon Oct 29 21:47:00 [initandlisten] shutdown: going to close sockets...
Mon Oct 29 21:47:00 [initandlisten] shutdown: waiting for fs preallocator...
Mon Oct 29 21:47:00 [initandlisten] shutdown: lock for final commit...
Mon Oct 29 21:47:00 [initandlisten] shutdown: final commit...
Mon Oct 29 21:47:00 [initandlisten] shutdown: closing all files...
Mon Oct 29 21:47:00 [initandlisten] closeAllFiles() finished
Mon Oct 29 21:47:00 [initandlisten] journalCleanup...
Mon Oct 29 21:47:00 [initandlisten] removeJournalFiles
Mon Oct 29 21:47:00 [initandlisten] shutdown: removing fs lock...
Mon Oct 29 21:47:00 dbexit: really exiting now

I DON'T UNDERSTAND A WORD IN THE GUIDE... is it only me...? Is there a more simple to understand guide for achieving this goal? Thank you!

Upvotes: 4

Views: 4705

Answers (3)

JoeDBA Seattle
JoeDBA Seattle

Reputation: 11

It might be easier to use a mongodb management solution like Scalegrid.io which creates mongodb instances in your EC2 account. Getting the instance running is actually the easier part of the job. You need to think about

  1. Backup
  2. Recovery
  3. Monitoring
  4. High availability in case your zone goes down.

Upvotes: 0

Liatz
Liatz

Reputation: 5207

the problem I ran into is described in : http://doubleclix.wordpress.com/2012/05/04/notes-on-mongo-at-aws/

Finally I followed the guide: http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

And mongo is running! I created only one EBS (20 GiB) in addition to the root volume ebs and mounted it to /data/db

I hope my deployment will work fine with nodejs and 10,000 client requests a day. (if I'm wrong or if someone has any suggestion about the deployment i described i would really appreciate it)

Thank you

Upvotes: 3

Eric J.
Eric J.

Reputation: 150108

The step

sudo yum -y install mongo-10gen-server

should have created a user to run mongodb under. However, 10Gen's documentation is conflicted as to whether that user is called mongod or mongo.

Try the following instead:

sudo chown mongo:mongo /data

That step changes ownership of the /data directory to the user mongo and to the group mongo.

Upvotes: 2

Related Questions