2

I cannot seem to find a way to do this. There is nothing in the documentation (except for CQL examples or thrift examples). Has anyone done this before? I want to set the consistency for read and write. Or even if you could tell me how do I pass the consistency level for each individual read / write, that would be great.

There exists a way to set the consistency level when the keyspace is created. But what about the case where the keyspace already exists and you want to update the consistency level for it. If it can't be done, then why is it so, since it should normally be available.

4

4 回答 4

2

Zanson 是正确的 - 一致性级别是在逐个查询的基础上确定的。因此,您执行的每个读取和写入查询都将指定其自己的一致性级别。我相信默认情况下这设置为 QUORUM。QUORUM 是根据 Keyspace 的复制因子计算的。

-> 复制因子在键空间级别定义。

-> 读/写一致性级别在查询点定义。

于 2013-04-02T10:52:23.303 回答
1

这个问题在这里描述了https://issues.apache.org/jira/browse/CASSANDRA-4734 他们删除了可用于设置每个请求的一致性级别(CL)(即在 CQL 中)。并决定将此设置在 Column Famaly (CF) 级别。

不幸的是:(

但是如果使用 php pro_cassandra - 你可以这样做:https ://github.com/Orange-OpenSource/YACassandraPDO/issues/13

于 2014-04-18T07:49:46.883 回答
0

您想要更新复制因子。一致性级别是指单个查询。要从 cassandra-cli 更新复制因子,您需要使用“更新键空间”命令并更改策略选项。

UPDATE KEYSPACE demo WITH strategy_options = {replication_factor:1}
于 2013-04-01T19:12:35.447 回答
0

您正在混淆一致性级别(指单个查询)和复制因子(在创建键空间时设置)。

要更改现有键空间的复制因子,请使用“alter keyspace”命令:

ALTER KEYSPACE demo WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};

资料来源:

于 2016-01-21T10:15:46.687 回答