最近有很多关于卡桑德拉的话题。
Twitter, Digg, Facebook等都在使用它。
什么时候有意义:
使用卡桑德拉, 不用卡桑德拉,还有 使用RDMS而不是Cassandra。
最近有很多关于卡桑德拉的话题。
Twitter, Digg, Facebook等都在使用它。
什么时候有意义:
使用卡桑德拉, 不用卡桑德拉,还有 使用RDMS而不是Cassandra。
当前回答
你应该问自己以下问题:
(Volume, Velocity) Will you be writing and reading TONS of information , so much information that no one computer could handle the writes. (Global) Will you need this writing and reading capability around the world so that the writes in one part of the world are accessible in another part of the world? (Reliability) Do you need this database to be up and running all the time and never go down regardless of which Cloud, which country, whether it's VM , Container, or Bare metal? (Scale-ability) Do you need this database to be able to continue to grow easily and scale linearly (Consistency) Do you need TUNABLE consistency where some writes can happen asynchronously where as others need to be certified? (Skill) Are you willing to do what it takes to learn this technology and the data modeling that goes with creating a globally distributed database that can be fast for everyone, everywhere?
如果在这些问题中,你认为“可能”或“不”,你应该用别的词。如果你对所有问题的答案都是“当然”,那么你应该用卡桑德拉。
当你可以在一个盒子上做所有事情时,使用RDBMS。它可能比大多数方法都简单,任何人都可以使用它。
其他回答
没有什么是银弹,任何东西都是为了解决特定的问题而构建的,有自己的优点和缺点。这取决于你,你有什么问题陈述,什么是该问题的最佳解决方案。
我会按照你问的顺序一个一个地回答你的问题。因为Cassandra是基于NoSQL数据库家族的,所以在我回答你的问题之前,理解为什么使用NoSQL数据库是很重要的。
为什么使用NoSQL
In the case of RDBMS, making a choice is quite easy because all the databases like MySQL, Oracle, MS SQL, PostgreSQL in this category offer almost the same kind of solutions oriented toward ACID properties. When it comes to NoSQL, the decision becomes difficult because every NoSQL database offers different solutions and you have to understand which one is best suited for your app/system requirements. For example, MongoDB is fit for use cases where your system demands a schema-less document store. HBase might be fit for search engines, analyzing log data, or 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 trees, queues, linked lists, etc and can be a good fit for making real-time leaderboards, pub-sub kind of system. Similarly there are other databases in this category (Including Cassandra) which are fit for different problem statements. Now lets move to the original questions, and answer them one by one.
何时使用卡桑德拉
Being a part of the NoSQL family, Cassandra offers a solution for problems where one of your requirements is to have a very heavy write system and you want to have a quite responsive reporting system on top of that stored data. Consider the use case of Web analytics where log data is stored for each request and you want to built an analytical platform around it to count hits per hour, by browser, by IP, etc in a real time manner. You can refer to this blog post to understand more about the use cases where Cassandra fits in.
什么时候使用RDMS而不是Cassandra
Cassandra基于NoSQL数据库,不提供ACID和关系数据属性。如果您对ACID属性有强烈的需求(例如财务数据),Cassandra将不适合这种情况。显然,您可以为此制定一个变通方案,但是您最终将编写大量的应用程序代码来模拟ACID属性,并将严重延误上市时间。同时,使用Cassandra管理这种系统对您来说也是复杂而乏味的。
什么时候不用卡桑德拉
我认为上面的解释是否有意义不需要回答。
Cassandra是一个特定问题的答案:当您有太多数据,以至于无法在一台服务器上存储时,您该怎么办?如何将所有数据存储在多个服务器上,同时不破坏银行账户,不让开发人员抓狂?Facebook每天都会收到4tb的压缩数据。这个数字很可能在一年内增长两倍以上。
如果您没有这么多数据,或者您有数百万美元来支付企业Oracle/DB2集群安装费用,以及安装和维护它所需的专家,那么您可以使用SQL数据库。
然而,Facebook不再使用cassandra,现在几乎只使用MySQL,在应用程序堆栈中移动分区,以获得更快的性能和更好的控制。
它不支持跨 表。 不支持二级索引。 二级索引必须依赖Elastic search /Solr,并且必须编写自定义同步组件。 非ACID兼容系统。 查询支持有限。
根据DataStax,当需要Cassandra时,它并不是最好的用例
1-高端硬件设备。 2- ACID兼容,无回滚(银行交易)
another situation that makes the choice easier is when you want to use aggregate function like sum, min, max, etcetera and complex queries (like in the financial system mentioned above) then a relational database is probably more convenient then a nosql database since both are not possible on a nosql databse unless you use really a lot of Inverted indexes. When you do use nosql you would have to do the aggregate functions in code or store them seperatly in its own columnfamily but this makes it all quite complex and reduces the performance that you gained by using nosql.