简体   繁体   English

EC2上的mongodb EBS

[英]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. 我在ec2上使用mongodb和nodejs,我想部署它以便每天支持10,000个请求。 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. 我知道我需要创建一个用于存储数据的EBS卷。

I tried http://www.mongodb.org/display/DOCS/Amazon+EC2+Quickstart#AmazonEC2Quickstart-ConfigureStorage but it didn't work. 我试过http://www.mongodb.org/display/DOCS/Amazon+EC2+Quickstart#AmazonEC2Quickstart-ConfigureStorage但它没有用。 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' 我到了应该运行的地步[ec2-user @ domU -...〜] $ sudo chown mongod:mongod / data但是我得到:chown:无效用户:`mongod:mongod'

solved it by : sudo chown mongod.mongod /data still can't run mongod working : 解决了它:sudo chown mongod.mongod / data仍然无法运行mongod工作:

$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! 谢谢!

the problem I ran into is described in : http://doubleclix.wordpress.com/2012/05/04/notes-on-mongo-at-aws/ 我遇到的问题描述如下: 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 最后我按照指南: http//d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

And mongo is running! 而mongo正在运行! I created only one EBS (20 GiB) in addition to the root volume ebs and mounted it to /data/db 除了根卷ebs之外,我只创建了一个EBS(20 GiB)并将其安装到/ data / db

I hope my deployment will work fine with nodejs and 10,000 client requests a day. 我希望我的部署能够在每天使用nodejs和10,000个客户端请求时正常工作。 (if I'm wrong or if someone has any suggestion about the deployment i described i would really appreciate it) (如果我错了,或者有人对我所描述的部署有任何建议,我会非常感激)

Thank you 谢谢

The step 这一步

sudo yum -y install mongo-10gen-server sudo yum -y install mongo-10gen-server

should have created a user to run mongodb under. 应该创建一个用户来运行mongodb。 However, 10Gen's documentation is conflicted as to whether that user is called mongod or mongo . 但是,10Gen的文档是否与该用户名为mongodmongo有冲突。

Try the following instead: 请尝试以下方法:

sudo chown mongo:mongo /data sudo chown mongo:mongo / data

That step changes ownership of the /data directory to the user mongo and to the group mongo . 该步骤将/ data目录的所有权更改为用户mongo和组mongo

It might be easier to use a mongodb management solution like Scalegrid.io which creates mongodb instances in your EC2 account. 使用像Scalegrid.io这样的mongodb管理解决方案可能更容易,它可以在您的EC2帐户中创建mongodb实例。 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. 区域出现故障时的高可用性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM