退役后如何重用cassandra节点?

How to reuse a cassandra node after decommission?

我有一个包含 2 个节点(节点 1 和节点 2)的集群。

停用节点 2 后,我想将服务器用作新的 Cassandra 数据库以用于其他目的,但是一旦我重新启动,就会出现此消息:

org.apache.cassandra.exceptions.ConfigurationException: This node was decommissioned and will not rejoin the ring unless cassandra.override_decommission=true has been set, or all existing data is removed and the node is bootstrapped again

所以我删除了所有现有数据。

但我不想再次引导节点(既不重新加入之前的环),而是要使用全新的纯 Cassandra 数据库。

旧节点不在种子列表中。

卡桑德拉版本:3.9

编辑:我想我被误解了,对此感到抱歉。退役后我想要:

两个没有关联的不同数据库,完全分开。那是因为我们想再次重用托管node2的机器在另一个环境中部署Cassandra DB。

使用选项 cassandra.override_decommission: 真

使用该选项,cassandra.override_decommission=true。另外,请注意 cluster_name 的定义是 cassandra.yaml:

The name of the cluster. This setting prevents nodes in one logical cluster from joining another. All nodes in a cluster must have the same value.

因此,可以肯定的是,还可以为 cassandra.yaml 中的 cluster_name 选项使用另一个值。

试试这些步骤:

  • 运行 在 cqlsh 中:更新 system.local 设置 cluster_name = 'new_name' 其中键='local';
  • nodetool flush 以持久化数据
  • nodetool 停用
  • 停止节点
  • 在 cassandra.yaml
  • 中更改名称
  • clean node sudo rm -rf /var/lib/cassandra/* /var/log/cassandra/* 但我只是将这些文件移动到其他地方,直到获得所需的状态
  • 开始节点

请检查1,

不要使用 override_decommission。该标志仅用于重新加入同一集群。

您应该删除节点上的所有数据文件(Cassandra 将在启动时重新创建系统表)。最重要的是,您需要更改 cassandra.yaml 中的种子。我怀疑还是节点1的ip,所以需要改成节点2(自己)。