没有足够的副本可用于一致性 ONE 查询(需要 1 个,但只有 0 个活着) [英] Not enough replica available for query at consistency ONE (1 required but only 0 alive)

查看:17
本文介绍了没有足够的副本可用于一致性 ONE 查询(需要 1 个,但只有 0 个活着)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三个节点的 Cassandra 集群,其中两个已启动.他们都在同一个DC.当我的 Java 应用程序写入集群时,我的应用程序出现错误,这似乎是由 Cassandra 的某些问题引起的:

I have a Cassandra cluster with three nodes, two of which are up. They are all in the same DC. When my Java application goes to write to the cluster, I get an error in my application that seems to be caused by some problem with Cassandra:

引起:com.datastax.driver.core.exceptions.UnavailableException:没有足够的副本可用于一致性 ONE 查询(需要 1 但只有 0 个活动)在 com.datastax.driver.core.exceptions.UnavailableException.copy(UnavailableException.java:79)

Caused by: com.datastax.driver.core.exceptions.UnavailableException: Not enough replica available for query at consistency ONE (1 required but only 0 alive) at com.datastax.driver.core.exceptions.UnavailableException.copy(UnavailableException.java:79)

没有意义的部分是1 required but only 0 alive"语句.有两个节点向上,这意味着其中一个应该是活着"的以进行复制.

The part that doesn't make sense is that "1 required but only 0 alive" statement. There are two nodes up, which means that one should be "alive" for replication.

还是我误解了错误信息?

Or am I misunderstanding the error message?

谢谢.

推荐答案

您收到此错误很可能是因为您查询的表所属的键空间的复制因子的复制因子为 1,对吗?

You are likely getting this error because the Replication Factor of the keyspace the table you are querying belongs to has a Replication Factor of one, is that correct?

>

如果您正在读取/更新的分区没有足够的可用副本(具有该数据的节点)来满足一致性级别,您将收到此错误.

If the partition you are reading / updating does not have enough available replicas (nodes with that data) to meet the consistency level, you will get this error.

如果您希望能够处理 1 个以上的节点不可用,您可以做的是查看 改变您的密钥空间 以设置更高的复制因子,在这种情况下最好是三个,然后运行 ​​nodetool repair 在每个节点上获取所有节点上的所有数据.通过此更改,您将能够在丢失 2 个节点的情况下以 1 的一致性级别进行读取.

If you want to be able to handle more than 1 node being unavailable, what you could do is look into altering your keyspace to set a higher replication factor, preferably three in this case, and then running a nodetool repair on each node to get all of your data on all nodes. With this change, you would be able to survive the loss of 2 nodes to read at a consistency level of one.

这个 cassandra 参数计算器是理解节点数、复制因子、和一致性水平.

This cassandra parameters calculator is a good reference for understanding the considerations of node count, replication factor, and consistency levels.

这篇关于没有足够的副本可用于一致性 ONE 查询(需要 1 个,但只有 0 个活着)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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