Cassandra 还是 MySQL/PostgreSQL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2529871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cassandra or MySQL/PostgreSQL?
提问by Ivri
I have huge database (kinda wordnet) and want to know if it's easier to use Cassandra instead of MySQL
|PostrgreSQL
我有庞大的数据库(有点像 wordnet),想知道使用 Cassandra 是否更容易,而不是MySQL
|PostrgreSQL
All my life I was using MySQL
and PostrgreSQL
and I could easily think in terms of relational algebra, but several weeks ago I learned about Cassandra and that it's used in Facebook and Twitter.
我一生都在使用MySQL
和PostrgreSQL
我可以很容易地从关系代数的角度思考,但几周前我了解了 Cassandra 并且它在 Facebook 和 Twitter 中使用。
Is it more convenient?
是不是更方便?
What DBMS are usually used nowadays to store social net's data, relationships between objects, wordnet?
现在通常使用什么 DBMS 来存储社交网络的数据、对象之间的关系、wordnet?
采纳答案by APC
回答by Ajay Tiwari
There is nothing like a Silver bullet solution, everything is built to solve specific problem and has its own pros and cons. It is up to you to decide - what problem statement you have and what is best solution that fits your problem. Whether you use Cassandra (NoSQL) or MySQL(RDBMS), it is all driven from your system's requirements. Below are the inputs that will help you in taking better decision while deciding on database.
没有什么能比得上银弹解决方案,一切都是为了解决特定问题而构建的,并且各有优缺点。由您决定 - 您有什么问题陈述以及适合您问题的最佳解决方案。无论您使用 Cassandra (NoSQL) 还是 MySQL (RDBMS),它都是由您的系统需求驱动的。以下是帮助您在决定数据库时做出更好决策的输入。
Why to Use NoSQL
为什么要使用 NoSQL
In the case of RDBMS database, making choice is quite easy because almost all the databases like MySQL, Oracle, MS SQL, PostgreSQL in this category offer almost same kind of solutions oriented to the ACID property. When it comes to NoSQL, decision becomes difficult because every NoSQL database offers different solution and you have to understand which one is best suited for your app/system requirement. For example, MongoDB fits for use cases where your system demands schema-less document store. HBase might fit for Search engines, analysing log data, any place where scanning huge, two-dimensional join-less tables is a requirement. Redis is built to provide In-Memory search for varieties of data structures like tree, queue, link list etc and can be good fit for making real time leader board, pub-sub kind of system. Similarly there are other database in this category (including Cassandra) which fits for different problems. Now lets move to original question, and answer them one by one.
在 RDBMS 数据库的情况下,选择非常容易,因为该类别中的几乎所有数据库(如 MySQL、Oracle、MS SQL、PostgreSQL)都提供了几乎相同类型的面向 ACID 属性的解决方案。当谈到 NoSQL 时,决定变得困难,因为每个 NoSQL 数据库都提供不同的解决方案,您必须了解哪一个最适合您的应用程序/系统要求。例如,MongoDB 适用于您的系统需要无模式文档存储的用例。HBase 可能适用于搜索引擎,分析日志数据,任何需要扫描巨大的二维无连接表的地方。Redis 旨在为树、队列、链接列表等各种数据结构提供内存中搜索,非常适合制作实时排行榜、发布订阅类系统。同样,该类别中还有其他数据库(包括 Cassandra),适用于不同的问题。现在让我们转到原始问题,并一一回答。
When to use Cassandra
何时使用 Cassandra
Being a part of NoSQL family, Cassandra offers solution for problem where your requirement is to have very heavy write system and you want to have quite responsive reporting system on top of that stored data. Consider use case of Web analytics where log data is stored for each request and you want to built analytical platform around it to count hits by hour, by browser, by IP, etc in real time manner. You can refer to blog post (http://blogs.shephertz.com/2015/04/22/why-cassandra-excellent-choice-for-realtime-analytics-workload/) to understand more about the use cases where Cassandra fits in.
作为 NoSQL 家族的一员,Cassandra 为您的要求是拥有非常繁重的写入系统并且您希望在存储的数据之上拥有反应灵敏的报告系统的问题提供了解决方案。考虑 Web 分析的用例,其中为每个请求存储日志数据,并且您希望围绕它构建分析平台以实时计算按小时、浏览器、IP 等的点击量。您可以参考博客文章 ( http://blogs.shephertz.com/2015/04/22/why-cassandra-excellent-choice-for-realtime-analytics-workload/) 以了解有关 Cassandra 适合的用例的更多信息在。
When to Use a RDMS instead of Cassandra/NoSQL
何时使用 RDMS 而不是 Cassandra/NoSQL
Cassandra is based on NoSQL database and does not provide ACID and relational data property. If you have strong requirement of ACID property (for example Financial data), Cassandra would not be a fit in that case. Obviously, you can make work out of it, however you will end up writing lots of application code to handle ACID property and will loose on time to market badly. Also managing that kind of system with Cassandra would be complex and tedious for you.
Cassandra 基于 NoSQL 数据库,不提供 ACID 和关系数据属性。如果您对 ACID 属性(例如财务数据)有强烈要求,那么 Cassandra 将不适合这种情况。显然,您可以解决这个问题,但是您最终会编写大量应用程序代码来处理 ACID 属性,并且会严重影响上市时间。此外,使用 Cassandra 管理这种系统对您来说既复杂又乏味。
回答by Robert Zaremba
I would suggest to analyse your request.
我建议分析您的要求。
- If you are going with more clusters, machines take NoSQL
- If your data model is complicated - require efficient structures take NoSQL (no limits with type of columns)
- If you fit in a few machines without scales, and you don't need super performance for multi request (as for example in social network - where lot of users send http request), and you don't think you involve saleability take RDBMS (Postgres have some good functions and structures which you can use, like array column type).
- 如果您要使用更多集群,则机器采用 NoSQL
- 如果您的数据模型很复杂 - 需要高效的结构采用 NoSQL(列类型没有限制)
- 如果您适合几台没有秤的机器,并且您不需要多请求的超强性能(例如在社交网络中 - 很多用户发送 http 请求),并且您认为您不涉及可销售性,请使用 RDBMS( Postgres 有一些很好的函数和结构你可以使用,比如数组列类型)。
Cassandra should work better with large scales of data, multi purpose. neo4j - would be better for special structures, graphs.
Cassandra 应该能更好地处理大量数据、多用途。neo4j - 更适合特殊结构、图形。
回答by Mark
Cassandra and other NoSQL stores are being used for social based sites because of their need for massive write based operations. Not that MySQL and Postgres can't achieve this but NoSQL requires far less time and money, generally speaking.
Cassandra 和其他 NoSQL 存储正在用于基于社交的站点,因为它们需要大量基于写入的操作。并不是说 MySQL 和 Postgres 无法实现这一点,但一般来说,NoSQL 需要的时间和金钱要少得多。
Sounds like you may want to look at Neo4J though, just in terms of your object model needs.
听起来你可能想看看 Neo4J,只是根据你的对象模型需求。
回答by Frank Heikens
All different products and they all have their pro's and conn's. What kind of problem do you have to solve?
所有不同的产品,它们都有自己的优点和缺点。你需要解决什么样的问题?
Huge, as in TB's?
巨大的,就像在结核病中一样?