Cassandra 查询特定节点

标签 cassandra cql3

我正在使用具有 4 个节点的 cassandra 1.2.15 集群,并且在简单网络拓扑中具有具有 2 个复制的 key 空间。我正在使用 Murmur3Partitioner。我使用了 yaml 文件中提供的默认配置。第一个节点是种子节点,其他 3 个节点将第一个节点指向种子节点。

第一个节点yaml配置是

initial_token: left empty
num_tokens: 256
auto_bootstrap: false

其他3个节点yaml配置为

initial_token: left empty
num_tokens: 256
auto_bootstrap: true

我有三个问题,我的主要问题是问题1,

问题1:

  • 我需要查询集群上的特定节点。 (即)在一个四节点集群中,我需要进行查询以仅选择节点 2 的列族中的所有行。这可能吗?如果是,如何进行?

问题2:

  • 对于上述方法,我的 yaml 配置是否正确?

问题3:

  • 如果我在集群中添加两个节点,此配置是否会在将来造成任何麻烦?

最佳答案

Q1 I need to query a specific node on the cluster. (ie) In a four node cluster I need to make a query to select all the rows in a column family for the node 2 alone.Is it possible? If yes how to proceed?

不,不可能。您可以做的是使用 LOCAL_QUORUMEACH_QUORUM consistency levels 查询特定数据中心。 。或者,您可以连接到特定节点并查询特定于每个节点的system KS(通过在 cqlsh 或驱动程序中指定地址)。有时这可能很有用,但这不是您想要的。

Q2 Whether my yaml configuration is correct or not for the above approach? In 1.2 I think it might be a better idea to populate the tokens on your own for your initial nodes rather than leaving that to C*. As for auto_bootstrap, false is the right choice for a fresh cluster node:

此设置已从默认配置中删除。它产生新的(非种子)
节点会自动将正确的数据迁移到自身。初始化
时 没有数据的新集群,添加 auto_bootstrap: false。

Q3 Whether this configuration will make any trouble in future, if I add two nodes in the cluster?

我建议您放弃简单的网络拓扑,因为它会使扩展到多个数据中心的过程变得复杂。另一件需要记住的事情是为新节点启用自动引导,它应该可以很好地与 v 节点配合使用。

关于Cassandra 查询特定节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26422516/

相关文章:

java - 使用 Hector 向/从 Cassandra 存储和检索 float[]

Cassandra 选择性复制

Cassandra 自定义二级索引

queue - 是否可以使用 cassandra 表作为基本队列

java - Kafka与Cassandra数据库连接

cassandra - 即使使用 Quorum 配置,Cassandra 中的数据也不一致

php - 时间序列数据的 Cassandra 分区键

node.js - 无法将嵌套 json 插入 cassandra

Cassandra CQL - 具有多个聚类列的聚类顺序

java - 使用 Astyanax 突变批处理将 Map 插入 Cassandra CQL3 列族