MongoDB vs. Cassandra [英] MongoDB vs. Cassandra

查看:193
本文介绍了MongoDB vs. Cassandra的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估什么是最好的迁移选项。



目前,我在一个分片的MySQL(水平分区),我的大部分数据存储在JSON blob。我没有任何复杂的SQL查询(从我分区我的数据库后已经迁移)。



现在,似乎MongoDB和Cassandra都是可能的选项。我的情况:




  • 每个查询中的大量阅读,少于常规写入

  • 大规模的可扩展性

  • 更关心简单的设置,维护和代码

  • 最小化硬件/服务器成本


解决方案

每个查询中的大量阅读,少量常规写入



这两个数据库在热数据集适合内存的读取中运行良好。两者都强调无联接数据模型(并鼓励反规范化),并且都提供了关于文档,但MongoDB的索引目前更灵活。



Cassandra的存储引擎提供了恒定时间的写入,无论数据集的增长有多大。在MongoDB中写入更加有问题,部分原因是基于b-tree的存储引擎,但更多的原因是

对于分析,MongoDB提供了一个自定义的map / reduce实现; Cassandra提供原生Hadoop支持,包括 Hive (基于Hadoop map / reduce构建的SQL数据仓库)和 Pig (许多人认为Hadoop特有的分析语言比SQL更适合map / reduce工作负载)。

不担心大规模可扩展性



如果您正在查看单个服务器,MongoDB可能是更好的合适。对于那些更关心缩放的人,Cassandra的非单点故障架构将更容易设置和更可靠。 (MongoDB的全局写锁定也会变得更加痛苦。)Cassandra还对复制的工作原理提供了更多的控制,包括对多个数据中心的支持。



strong>更关心简单的设置,维护和代码



这两种设置都很简单,只需一个合适的开箱即用的默认值服务器。 Cassandra更容易在多服务器配置中设置,因为没有特殊角色节点需要担心;这里是一个屏幕录像,演示在两分钟内设置4节点Cassandra群集



如果你目前使用JSON blob,MongoDB是一个疯狂的适合你的用例,因为它使用BSON来存储数据。您将能够获得比您当前数据库中更丰富,更可查询的数据。这将是对Mongo最重要的胜利。


I am evaluating what might be the best migration option.

Currently, I am on a sharded MySQL (horizontal partition), with most of my data stored in JSON blobs. I do not have any complex SQL queries (already migrated away after since I partitioned my db).

Right now, it seems like both MongoDB and Cassandra would be likely options. My situation:

  • Lots of reads in every query, less regular writes
  • Not worried about "massive" scalability
  • More concerned about simple setup, maintenance and code
  • Minimize hardware/server cost

解决方案

Lots of reads in every query, fewer regular writes

Both databases perform well on reads where the hot data set fits in memory. Both also emphasize join-less data models (and encourage denormalization instead), and both provide indexes on documents or rows, although MongoDB's indexes are currently more flexible.

Cassandra's storage engine provides constant-time writes no matter how big your data set grows. Writes are more problematic in MongoDB, partly because of the b-tree based storage engine, but more because of the per database write lock.

For analytics, MongoDB provides a custom map/reduce implementation; Cassandra provides native Hadoop support, including for Hive (a SQL data warehouse built on Hadoop map/reduce) and Pig (a Hadoop-specific analysis language that many think is a better fit for map/reduce workloads than SQL).

Not worried about "massive" scalability

If you're looking at a single server, MongoDB is probably a better fit. For those more concerned about scaling, Cassandra's no-single-point-of-failure architecture will be easier to set up and more reliable. (MongoDB's global write lock tends to become more painful, too.) Cassandra also gives a lot more control over how your replication works, including support for multiple data centers.

More concerned about simple setup, maintenance and code

Both are trivial to set up, with reasonable out-of-the-box defaults for a single server. Cassandra is simpler to set up in a multi-server configuration since there are no special-role nodes to worry about; here is a screencast demonstrating setting up a 4-node Cassandra cluster in two minutes.

If you're presently using JSON blobs, MongoDB is an insanely good match for your use case, given that it uses BSON to store the data. You'll be able to have richer and more queryable data than you would in your present database. This would be the most significant win for Mongo.

这篇关于MongoDB vs. Cassandra的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆