Cassandra - 事务支持 [英] Cassandra - transaction support

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

问题描述

我正在使用 apache cassandra 并从事样本数据插入、检索等工作.

I am going through apache cassandra and working on sample data insertion, retrieving etc.

文档非常有限.

我有兴趣了解

  • 我们可以用cassandra完全替换像mysql/oracle这样的关系数据库吗?
  • cassandra 是否支持回滚/提交?
  • cassandra 客户端(thrift/hector)是否支持获取关联对象(我们将一个超级列的键保存在另一个超级列族中的对象)?

这对我继续前进有很大帮助.

This will help me a lot to proceed further.

先谢谢你.

推荐答案

简短回答:否.

在设计上,Cassandra 重视可用性和分区容错性而不是一致性1.基本上,在保持所有三种品质的同时获得可接受的延迟是不可能的:必须牺牲一种品质.这就是所谓的CAP定理.

By design, Cassandra values availability and partition tolerance over consistency1. Basically, it's not possible to get acceptable latency while maintaining all three of qualities: one has to be sacrificed. This is called CAP theorem.

使用一致性级别在 Cassandra 中可以配置一致性量,但不存在任何回滚语义.即使第一次写入成功,也无法保证您能够回滚更改.

The amount of consistency is configurable in Cassandra using consistency levels, but there doesn't exist any semantics for rollback. There's no guarantee that you'll be able to roll back your changes even if the first write succeeds.

如果您想在 Cassandra 之上构建带有事务或锁的应用程序,您可能需要查看 Zookeeper,它可用于提供分布式同步.

If you want to build application with transactions or locks on top of Cassandra, you probably want to look at Zookeeper, which can be used to provide distributed synchronization.

您可能已经猜到了,但是 Cassandra 没有外键或类似的东西.这必须手动处理.我对 Hector 不太熟悉,但更高级别的客户可以半自动地做到这一点.

You might've already guessed this, but Cassandra doesn't have foreign keys or anything like that. This has to be handled manually. I'm not that familiar with Hector, but a higher-level client could be able to do this semi-automatically.

是否可以使用 Cassandra 轻松替换 RDBMS 取决于您的特定用例.在您的用例中(根据您的问题),这样做可能很困难.

Whether or not you can use Cassandra to easily replace a RDBMS depends on your specific use case. In your use case (based on your questions), it might be hard to do so.

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

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