I am trying to setup a rails stack on AWS Opsworks and i want to use mongodb as the database.
我正在尝试在AWS Opsworks上设置rails堆栈,我想使用mongodb作为数据库。
I think that you set this up by creating a new custom layer and adding your chef reciepts to the relevant life cycle hooks but i am unsure as to what receipts to put where.
我认为你通过创建一个新的自定义图层并将你的厨师收据添加到相关的生命周期钩子来设置它,但我不确定要放在哪里的收据。
Can anyone help with how to add mongodb via a chef to AWS Opsworks?
任何人都可以帮助如何通过厨师将mongodb添加到AWS Opsworks?
I have seen there is a community mongodb cookbook but from what i can see its not compatible with Opsworks.
我已经看到有一个社区mongodb食谱,但从我可以看到它与Opsworks不兼容。
Does anyone have any experience of setting this up ?
有没有人有任何设置的经验?
Please can anyone help with this.
请任何人都可以帮忙。
thanks a lot Rick
非常感谢Rick
2 个解决方案
#1
5
I tried setting up a MongoDB 3-node replica set in OpsWorks a few months back. I will share a bit of my experience:
几个月前,我尝试在OpsWorks中设置一个MongoDB 3节点副本集。我将分享一些我的经验:
1) How to install a single MongoDB: It is possible and easy to install a single mongodb using the EDelight Chef MongoDB Cookbook. Just add it as a submodule in your custom opsworks chef repository.
1)如何安装单个MongoDB:使用EDelight Chef MongoDB Cookbook可以轻松安装单个mongodb。只需将其添加为自定义opsworks chef存储库中的子模块即可。
To get it to work create a custom layer and call it MongoDB and excecute the following recipes
要使其工作,请创建一个自定义图层并将其命名为MongoDB并执行以下配方
- SETUP: mongodb:10gen_repo
- 设置:mongodb:10gen_repo
- CONFIGURE: mongodb:default
- 配置:mongodb:默认
This will install the latest version of MongoDB.
这将安装最新版本的MongoDB。
NOTE: I used Ubuntu instances.
注意:我使用了Ubuntu实例。
2) MongoDB Best Practices If you talk to MongoDB engineers or customer service reps, they will all tell you that the recommended setup for MongoDB is a 3 node replica set. This means one master and two read replicas hopefully in different availability zones. Also an ideal setup will have lots of RAM, to give you an example: the smallest instance provided by MongoDB that you can find in the AWS market place is a standard large:
2)MongoDB最佳实践如果您与MongoDB工程师或客户服务代表交谈,他们都会告诉您MongoDB的推荐设置是3节点副本集。这意味着希望在不同的可用区域中有一个主副本和两个只读副本。另外一个理想的设置将拥有大量的RAM,为您举个例子:您可以在AWS市场中找到的MongoDB提供的最小实例是标准的大型:
You also have to consider using EBS on RAID10, maybe reserved IOPS...
您还必须考虑在RAID10上使用EBS,也许保留IOPS ...
See the white paper MongoDB on AWS for more info.
有关详细信息,请参阅AWS上的白皮书MongoDB。
3) Security Considerations Ideally you want only application instances to access the DB instances. In AWS you could create a security group with custom rules and assign EC2 instances to the group you just created... Is not quite like this when it comes to OpsWorks as it forces you to have default security groups that have very lax restrictions. AWS will always adopt lax permissions over stricter ones.
3)安全注意事项理想情况下,您只希望应用程序实例访问数据库实例。在AWS中,您可以创建一个包含自定义规则的安全组,并将EC2实例分配给您刚刚创建的组...当涉及到OpsWorks时,它不是这样的,因为它会强制您拥有非常宽松的默认安全组。 AWS将始终对更严格的权限采用宽松的权限。
4) Time and Money Considerations If the recommended setup is a 3 node replica set using large instances you are looking at at least $600 (on demand) for the DB and this doesn't add reserved IOPS, EBS, and so on. Automating this setup is possible yet not simple. It will take time or an expert in the subject to get you going. If you have the resources and personnel to deal with this go for it. If you are part of a small development team that want's to code more and do less operations, read on.
4)时间和金钱注意事项如果建议的设置是使用大型实例的3节点副本集,则您至少要查看600(按需)数据库,这不会添加保留的IOPS,EBS等。自动化此设置可能并不简单。需要时间或专家才能帮助您前进。如果你有资源和人员来处理这个问题。如果您是一个小型开发团队的成员,希望能够编写更多代码并执行更少的操作,请继续阅读。
5) Find a reliable Managed Solution At first I was reluctant to the idea of using a third party company that offered MongoDB as a service. After much evaluation of the different options (Managed, AWS Marketplace, OpsWorks, Direct EC2 installation), I concluded that for our small team the best thing to do was to use either MongoLab or MongoHQ. They host and mange MongoDB instances of all sizes and prices. They even let you choose the hosting (AWS, Rackspace, etc), region and AZ. Price wise will be more expensive if you look at the hardware alone, but like I mentioned before you have to consider not only the price but the operational time MongoDB will require.
5)找到可靠的托管解决方案起初,我不愿意使用提供MongoDB服务的第三方公司。经过对不同选项(Managed,AWS Marketplace,OpsWorks,Direct EC2安装)的大量评估后,我得出结论,对于我们的小团队,最好的办法是使用MongoLab或MongoHQ。他们托管和管理各种规模和价格的MongoDB实例。他们甚至允许您选择托管(AWS,Rackspace等),区域和AZ。如果你单独看硬件,价格会更贵,但就像我之前提到的那样,你不仅要考虑价格,还要考虑MongoDB需要的运营时间。
I have been there, done that, and ended up not using OpsWorks to host MongodDB. Hopefully this will save you some time and headaches.
我去过那里,做到了,最终没有使用OpsWorks来托管MongodDB。希望这会为您节省一些时间和头痛。
#2
1
I just tested this repo on github, it works for MongoDB / OpsWorks. Goto OpsWorks > Layers > In the "Custom Chef Recipes" section reference this github link "https://github.com/Cyclic/cookbooks" then add "yum::default" to the Setup lifecycle event. Then add "mongodb::10gen_repo" "mongodb::default" and "mongodb::10gen_remrepo" to the Setup lifecycle event
我刚刚在github上测试了这个repo,它适用于MongoDB / OpsWorks。转到OpsWorks>图层>在“自定义厨师食谱”部分中引用此github链接“https://github.com/Cyclic/cookbooks”,然后将“yum :: default”添加到安装程序生命周期事件中。然后将“mongodb :: 10gen_repo”“mongodb :: default”和“mongodb :: 10gen_remrepo”添加到安装程序生命周期事件
#1
5
I tried setting up a MongoDB 3-node replica set in OpsWorks a few months back. I will share a bit of my experience:
几个月前,我尝试在OpsWorks中设置一个MongoDB 3节点副本集。我将分享一些我的经验:
1) How to install a single MongoDB: It is possible and easy to install a single mongodb using the EDelight Chef MongoDB Cookbook. Just add it as a submodule in your custom opsworks chef repository.
1)如何安装单个MongoDB:使用EDelight Chef MongoDB Cookbook可以轻松安装单个mongodb。只需将其添加为自定义opsworks chef存储库中的子模块即可。
To get it to work create a custom layer and call it MongoDB and excecute the following recipes
要使其工作,请创建一个自定义图层并将其命名为MongoDB并执行以下配方
- SETUP: mongodb:10gen_repo
- 设置:mongodb:10gen_repo
- CONFIGURE: mongodb:default
- 配置:mongodb:默认
This will install the latest version of MongoDB.
这将安装最新版本的MongoDB。
NOTE: I used Ubuntu instances.
注意:我使用了Ubuntu实例。
2) MongoDB Best Practices If you talk to MongoDB engineers or customer service reps, they will all tell you that the recommended setup for MongoDB is a 3 node replica set. This means one master and two read replicas hopefully in different availability zones. Also an ideal setup will have lots of RAM, to give you an example: the smallest instance provided by MongoDB that you can find in the AWS market place is a standard large:
2)MongoDB最佳实践如果您与MongoDB工程师或客户服务代表交谈,他们都会告诉您MongoDB的推荐设置是3节点副本集。这意味着希望在不同的可用区域中有一个主副本和两个只读副本。另外一个理想的设置将拥有大量的RAM,为您举个例子:您可以在AWS市场中找到的MongoDB提供的最小实例是标准的大型:
You also have to consider using EBS on RAID10, maybe reserved IOPS...
您还必须考虑在RAID10上使用EBS,也许保留IOPS ...
See the white paper MongoDB on AWS for more info.
有关详细信息,请参阅AWS上的白皮书MongoDB。
3) Security Considerations Ideally you want only application instances to access the DB instances. In AWS you could create a security group with custom rules and assign EC2 instances to the group you just created... Is not quite like this when it comes to OpsWorks as it forces you to have default security groups that have very lax restrictions. AWS will always adopt lax permissions over stricter ones.
3)安全注意事项理想情况下,您只希望应用程序实例访问数据库实例。在AWS中,您可以创建一个包含自定义规则的安全组,并将EC2实例分配给您刚刚创建的组...当涉及到OpsWorks时,它不是这样的,因为它会强制您拥有非常宽松的默认安全组。 AWS将始终对更严格的权限采用宽松的权限。
4) Time and Money Considerations If the recommended setup is a 3 node replica set using large instances you are looking at at least $600 (on demand) for the DB and this doesn't add reserved IOPS, EBS, and so on. Automating this setup is possible yet not simple. It will take time or an expert in the subject to get you going. If you have the resources and personnel to deal with this go for it. If you are part of a small development team that want's to code more and do less operations, read on.
4)时间和金钱注意事项如果建议的设置是使用大型实例的3节点副本集,则您至少要查看600(按需)数据库,这不会添加保留的IOPS,EBS等。自动化此设置可能并不简单。需要时间或专家才能帮助您前进。如果你有资源和人员来处理这个问题。如果您是一个小型开发团队的成员,希望能够编写更多代码并执行更少的操作,请继续阅读。
5) Find a reliable Managed Solution At first I was reluctant to the idea of using a third party company that offered MongoDB as a service. After much evaluation of the different options (Managed, AWS Marketplace, OpsWorks, Direct EC2 installation), I concluded that for our small team the best thing to do was to use either MongoLab or MongoHQ. They host and mange MongoDB instances of all sizes and prices. They even let you choose the hosting (AWS, Rackspace, etc), region and AZ. Price wise will be more expensive if you look at the hardware alone, but like I mentioned before you have to consider not only the price but the operational time MongoDB will require.
5)找到可靠的托管解决方案起初,我不愿意使用提供MongoDB服务的第三方公司。经过对不同选项(Managed,AWS Marketplace,OpsWorks,Direct EC2安装)的大量评估后,我得出结论,对于我们的小团队,最好的办法是使用MongoLab或MongoHQ。他们托管和管理各种规模和价格的MongoDB实例。他们甚至允许您选择托管(AWS,Rackspace等),区域和AZ。如果你单独看硬件,价格会更贵,但就像我之前提到的那样,你不仅要考虑价格,还要考虑MongoDB需要的运营时间。
I have been there, done that, and ended up not using OpsWorks to host MongodDB. Hopefully this will save you some time and headaches.
我去过那里,做到了,最终没有使用OpsWorks来托管MongodDB。希望这会为您节省一些时间和头痛。
#2
1
I just tested this repo on github, it works for MongoDB / OpsWorks. Goto OpsWorks > Layers > In the "Custom Chef Recipes" section reference this github link "https://github.com/Cyclic/cookbooks" then add "yum::default" to the Setup lifecycle event. Then add "mongodb::10gen_repo" "mongodb::default" and "mongodb::10gen_remrepo" to the Setup lifecycle event
我刚刚在github上测试了这个repo,它适用于MongoDB / OpsWorks。转到OpsWorks>图层>在“自定义厨师食谱”部分中引用此github链接“https://github.com/Cyclic/cookbooks”,然后将“yum :: default”添加到安装程序生命周期事件中。然后将“mongodb :: 10gen_repo”“mongodb :: default”和“mongodb :: 10gen_remrepo”添加到安装程序生命周期事件