SET Cassandra DDL的一致性级别 [英] SET consistency level for Cassandra DDL

查看:137
本文介绍了SET Cassandra DDL的一致性级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序日志中,我已经看到,默认情况下,运行create / alter表语句后,cassandra驱动程序似乎会进行处理以使架构达成协议最多10秒钟。

In my application logs I've seen that, by default, after running create/alter table statements, cassandra driver seems to do processing to bring schema into agreement for up to 10 seconds.

在执行创建表..如果不存在等DDL语句以确保我的表时,我可以(也应该)设置一致性级别(例如仲裁)吗?是创建并传播到所有节点吗?

Can I (and should I) set a consistency level for example 'quorum' while executing DDL statements like 'Create Table .. IF NOT EXISTS' to make sure my table gets created and propagated to all nodes?

推荐答案

Cassandra中的模式更改(数据定义),因为1.1+是通过闲话。由于它使用的是Gossip,因此与典型的数据操作请求(SELECT,DELETE,INSERT等)相比,它是一条独立的读/写路径,因此,此类操作没有可调的一致性,因为八卦的操作不具有可调的一致性。从我链接的文章中,您可以看到集群中被动宣布了架构更改,此外,当您在进行架构更改时无法访问节点时,还会出现架构分歧/解决方案。

Schema changes (data definition) in Cassandra since 1.1+ are done via gossip. Since it uses Gossip, it is a separate read/write path than your typical data manipulation requests (SELECT, DELETE, INSERT, etc), and hence has no tunable consistency for such operations, since gossip doesn't operate with tunable consistency. From the article I linked, you can see that schema changes are passively announced in the cluster, and furthermore you can get schema disagreement/resolution when you have nodes that were unreachable when the schema change was made.

您多久修改一次架构?如您所见,架构更改虽然已从以前进行了很大改进,但仍然是一项非常昂贵的操作,因为每个节点必须保持一致。因此,应避免在Cassandra中进行频繁的架构更改(也称为动态列)。我很想知道更改架构的频率和原因,也许您可​​以进行重构以避免动态列/表,从而避免在Cassandra中进行昂贵的架构更改。

How often are you modifying your schema? As you can see schema changes, while vastly improved from what it used to be, is still a very expensive operation as every node has to become consistent. Frequent schema changes in Cassandra should be avoided (aka dynamic columns) for this reason. I would be curious to hear how often and why the schema is being change, perhaps you could remodel to avoid dynamic columns/tables to avoid expensive schema changes in Cassandra.

这篇关于SET Cassandra DDL的一致性级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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