Cassandra:无法截断 table

Cassandra: Cannot truncate table

我有一个名为 buddyme.chatarch 的 table。

尝试截断 table 时。

cqlsh:buddyme> TRUNCATE chatarch;

我遇到了这个错误。

TruncateError: <ErrorMessage code=1003 [Error during truncate] message="Error during truncate: Cannot achieve consistency level ALL">

可能的原因是什么? 我是 Cassandra 的新手。

谢谢

连我也遇到了同样的问题。我集群中的一个节点已关闭。通过启动所有节点解决了这个问题。

即使集群中的所有 3 个节点都已启动,但仍然面临同样的问题。按照以下方法解决

TRUNCATE 语句导致立即、不可逆地删除指定 table 中的所有数据。 注意:在执行 TRUNCATE 操作之前,必须将一致性级别设置为 ALL。所有副本都必须删除数据。

例子

首先将一致性级别设置为ALL。 TRUNCATE 或 TRUNCATE TABLE 可用于从命名的 table 中删除所有数据。 一致性; 截断 user_activity;

一致性; 截断 TABLE menu_item;

关注link:https://docs.datastax.com/en/cql/3.1/cql/cql_reference/truncate_r.html