问题描述
我安装了 Cassandra 集群和 Zookeeper 服务器.现在我想使用zookeeper支持cassandra中的事务.我怎么做.
I have a Cassandra cluster and Zookeeper server installed. Now I want to support transactions in cassandra using zookeeper. How do i do that.
Zookeeper 创建 znode 来执行读写操作,数据在 Zookeeper 中来回通过 znode.我想知道如何使用 Zookeeper 在 cassandra 中支持回滚和提交功能.有什么办法可以在zookeeper中指定cassandra配置,或者在cassandra中指定zookeeper配置.
Zookeeper creates znodes to perform read and write operations and data to and fro goes through znodes in Zookeeper. I want to know that how to support rollback and commit feature in cassandra using Zookeeper. Is there any way by which we can specify cassandra configurations in zookeeper or zookeeper configurations in cassandra.
我分别了解 cassandra 和 zookeeper 如何读取和写入数据,但我不知道如何使用 Java 集成它们.
I know cassandra and zookeeper individually how data is read and written but I dont know how to integrate both of them using Java.
我们如何使用 Zookeeper 在 Cassandra 中进行交易.
how can we do transactions in Cassandra using Zookeeper.
谢谢.
推荐答案
困难重重.Cassandra 作为一个事务系统不能很好地工作.多行写入不是原子性的,有些写入失败无法回滚写入,也无法保证读者读取时读取到一致的视图.
With great difficulty. Cassandra does not work well as a transactional system. Writes to multiple rows are not atomic, there is no way to rollback writes if some writes fail, and there is no way to ensure readers read a consistent view when reading.
我想知道如何使用 Zookeeper 在 cassandra 中支持回滚和提交功能.
Zookeeper 不会帮你解决这个问题,尤其是提交功能.您可能可以向zookeeper写入足够的信息以在失败时回滚,但如果您这样做,您不妨将回滚信息存储在cassandra中.
Zookeeper won't help you with this, especially the commit feature. You may be able to write enough information to zookeeper to roll back in case of failure, but if you are doing that, you might as well store the rollback info in cassandra.
当您将 Zookeeper 用作锁定服务时,Zookeeper 和 Cassandra 可以很好地协同工作.查看 Cages 库.使用 zookeeper 协调对 cassandra 的读/写.
Zookeeper and Cassandra work well together when you use Zookeeper as a locking service. Look at the Cages library. Use zookeeper to co-ordinate read/writes to cassandra.
尝试将 cassandra 用作事务系统,对多行进行原子提交和回滚将非常令人沮丧.
Trying to use cassandra as a transactional system with atomic commits to multiple rows and rollbacks is going to be very frustrating.
这篇关于如何将 cassandra 与 zookeeper 集成以支持事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!