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

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

问题描述



这篇文章非常有限。



我有兴趣了解




  • 我们可以用cassandra完全替换mysql / oracle等关系数据库吗?
  • $
  • cassandra客户端(thrift / hector)支持获取关联对象(我们在另一个超级列中保存一个超级列的键家庭)?



这将帮助我进一步进行。






解决方案

>根据设计,Cassandra根据一致性 1 评估可用性和分区容限。基本上,不可能获得可接受的延迟,同时保持所有三个品质:一个必须牺牲。这称为CAP定理。



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



如果您无法使用事务或锁定构建应用程序的Cassandra,你可能想看看Zookeeper,它可以用来提供分布式同步。



你可能已经猜到了,但Cassandra没有外部键或任何类似的东西。这必须手动处理。我不熟悉Hector,但是更高级别的客户端可以半自动地执行此操作。



是否可以使用Cassandra轻松替换一个RDBMS取决于你的具体用例。在您的使用案例中(根据您的问题),可能很难这样做。


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

The documentation is very limited.

I am interested in knowing

  • can we completely replace relation db like mysql/ oracle with cassandra?
  • does cassandra support rollback/ commit?
  • does cassandra clients (thrift/ hector) support fetching associated object (objects where we save one super columns' key in another super column family)?

This will help me a lot to proceed further.

thank you in advance.

解决方案

Short answer: No.

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.

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

If you wan't 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.

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.

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天全站免登陆