gpt4 book ai didi

Cassandra - CQLSH 中发出的每个命令都会抛出错误

转载 作者:行者123 更新时间:2023-12-04 03:20:02 28 4
gpt4 key购买 nike

Cassandra 让我很头疼。昨天,一切都运行良好,然后我删除了一个表,运行了一个 CQLSSTableWriter,它以某种方式抛出了关于我的 Lucene index 的错误。 (因为不在类路径等上)好几次,现在,我在 cqlsh 中发出的每个命令都抛出错误。

CREATE KEYSPACE IF NOT EXISTS mydata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};

需要一段时间然后抛出:

Warning: schema version mismatch detected, which might be caused by DOWN nodes; 
if this is not the case, check the schema versions of your nodes in system.local and system.peers.
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20

之后我将创建一个新表,它也会抛出相同的错误。

cqlsh:mydata> create table test (id text PRIMARY KEY, id2 text);
Warning: schema version mismatch detected, which might be caused by DOWN nodes; if this is not the case, check the schema versions of your nodes in system.local and system.peers.
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20

last_host 始终显示我运行 cqlsh 的主机的 ip。我也在不同的节点上尝试过相同的命令。

然而,键空间和表仍在创建中!该错误说明了模式版本不匹配,所以我确定并运行了:

nodetool describecluster

它的输出显示我的所有节点都在同一个架构上。没有模式不匹配。我之前也发布过 nodetool resetlocalschema ,但没有任何运气。

当我继续往新创建的表中插入一些数据时,出现以下错误。请注意,插入语句不会返回错误。

cqlsh:mydata> insert into test(id, id2) values('test1', 'test2');
cqlsh:mydata> select * from mydata.test ;
Traceback (most recent call last):
File "/usr/bin/cqlsh.py", line 1314, in perform_simple_statement
result = future.result()
File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", line 3122, in result
raise self._final_exception
Unavailable: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'ONE'}

请注意,我有一个数据中心和五个节点。我不打算在未来使用多个数据中心。 [cqlsh 5.0.1 | Cassandra 3.0.8 | CQL 规范 3.4.0 | native 协议(protocol) v4]

我也多次重启了 Cassandra。 nodetool status 显示所有节点都已启动并正在运行。有谁知道发生了什么事?

最佳答案

我通过...解决了这个问题

  1. 删除键空间中的所有表

  2. 运行 alter keyspace mydata WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'}; 而不是 SimpleStrategy

  3. 在所有节点上重新启动 cassandra 服务

  4. 重新创建所有表

  5. 正在运行 nodetool repair

现在我可以再次插入数据和查询数据了。老实说,仍然不太确定这一切的原因是什么。

关于Cassandra - CQLSH 中发出的每个命令都会抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38891563/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com