4

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!

4

3 回答 3

3

我遇到的问题描述在: http ://doubleclix.wordpress.com/2012/05/04/notes-on-mongo-at-aws/

最后我按照指南: http ://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

mongo 正在运行!除了根卷 ebs 之外,我只创建了一个 EBS (20 GiB) 并将其挂载到 /data/db

我希望我的部署能够与 nodejs 和每天 10,000 个客户端请求一起正常工作。(如果我错了,或者如果有人对我描述的部署有任何建议,我将不胜感激)

谢谢

于 2012-10-30T10:50:12.520 回答
2

步骤

sudo yum -y 安装 mongo-10gen-server

应该已经创建了一个用户来运行 mongodb。但是,10Gen 的文档对于该用户是被称为mongod还是mongo存在冲突。

请尝试以下操作:

sudo chown mongo:mongo /数据

该步骤将/data目录的所有权更改为用户mongo和组mongo

于 2012-10-29T14:50:04.047 回答
0

使用像Scalegrid.io这样的 mongodb 管理解决方案可能更容易,它在您的 EC2 帐户中创建 mongodb 实例。让实例运行实际上是工作中更容易的部分。你需要考虑

  1. 备份
  2. 恢复
  3. 监控
  4. 高可用性,以防您的区域出现故障。
于 2012-10-30T16:20:50.353 回答