简体   繁体   English

将Rails应用程序从MySQL迁移到MongoDB

[英]Migrating a Rails app from MySQL to MongoDB

I have a fairly simple rails app (a few controllers, views, gem requirements, etc.) that currently runs on MySQL. 我有一个目前在MySQL上运行的相当简单的Rails应用程序(一些控制器,视图,gem要求等)。 We are considering migrating the application to MongoDB. 我们正在考虑将应用程序迁移到MongoDB。 The app hasn't gone live, so we don't have any data to migrate. 该应用尚未上线,因此我们没有任何数据可迁移。 The app is running on ruby 1.9.2 and Rails 3, if that is relevant. 如果相关,该应用程序将在ruby 1.9.2和Rails 3上运行。

We were also considering using both MySQL and MongoDB together. 我们还考虑同时使用MySQL和MongoDB。 What, if anything, should we know about using both databases? 关于使用两个数据库,我们应该知道什么?

There are no cache sweepers if you switch to Mongoid from ActiveRecord. 如果从ActiveRecord切换到Mongoid,则没有缓存清除程序。 Also it will be harder to work with grouping data functions. 同样,使用分组数据功能将更加困难。 You'll need to use map/reduce or something like that. 您将需要使用map / reduce或类似的方法。 Other than that I can't think of any downsides. 除此之外,我没有其他缺点。 You'll love MongoDB. 您会爱上MongoDB的。

UPD: Start MongoDB with --journal flag :) It will make your life simple and easy after server crash. UPD:使用--journal标志启动MongoDB :)服务器崩溃后,将使您的生活变得简单而轻松。

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

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