如何在cqlsh中将CONSISTENCYCY设置为SERIAL? [英] How do I set CONSISTENCY to SERIAL in cqlsh?

查看:95
本文介绍了如何在cqlsh中将CONSISTENCYCY设置为SERIAL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用 SERIAL 一致性在Cassandra中尝试轻量级事务.但是,尝试在cqlsh中设置一致性级别会导致错误:

I am trying to experiment with lightweight transactions in Cassandra by using SERIAL consistency. However, trying to set the consistency level in cqlsh results in an error:

cqlsh:learning> CONSISTENCY SERIAL;
Improper CONSISTENCY command.

具有一致性语句已从CQL中删除,因此我不能使用它.有没有办法从cqlsh启用串行一致性?还是我必须使用驱动程序?

The WITH CONSISTENCY statement has been removed from CQL and so I cannot use that. Is there a way to enable serial consistency from cqlsh? Or do I have to do it using a driver?

推荐答案

CONSISTENCY 命令仍应在cqlsh中起作用.但是此设置的有效值是:

The CONSISTENCY command should still work in cqlsh. But valid values for this setting are:

  • 任何
  • 一个
  • 两个
  • 三个
  • QUORUM
  • 全部
  • LOCAL_QUORUM
  • EACH_QUORUM

SERIAL不在该列表中,因此您看到的错误.有一个开放的吉拉票可以解决这个问题: CASSANDRA-8051

SERIAL is not in that list, hence the error you are seeing. There is an open Jira ticket to address this: CASSANDRA-8051

这似乎是一个一致性级别,周围有一些限制,因此很难实现.一致性级别说明表示:

This appears to be a consistency level that has some restrictions around it, thus making this difficult to implement. The Consistency Level descriptions indicate that:

您不能将此级别配置为常规一致性级别,使用一致性级别字段在驱动程序级别进行配置.

You cannot configure this level as a normal consistency level, configured at the driver level using the consistency level field.

The Java Driver apparently has a specific method to set this consistency level:

查询的串行一致性级别,设置为Statement.setSerialConsistencyLevel(),类似于一致性级别,但仅用于具有条件更新的查询.那是,它仅用于与IF等效的查询中CQL中的状态.

The serial consistency level of the query, set with Statement.setSerialConsistencyLevel(), is similar to the consistency level, but only used in queries that have conditional updates. That is, it is only used in queries that have the equivalent of the IF condition in CQL.

这篇关于如何在cqlsh中将CONSISTENCYCY设置为SERIAL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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