用 replace_address 标志替换 Cassandra 节点 returns "Cannot replace address with a node that is already bootstrapped"

Replacing a Cassandra node with replace_address flag returns "Cannot replace address with a node that is already bootstrapped"

我正在使用 Cassandra 3.9,其中一个节点上的数据已损坏,因此必须将其完全擦除。我想重新启动它并从其他节点取回所有数据。

使用 JVM_OPTS="$JVM_OPTS -Dcassandra.replace_address=xx.xx.xx.xx 给我错误 Node already bootstrapped 因为 IP 地址相同。我对这里的必要步骤感到困惑。

不需要 replace_address

当然,它会重新加入空的并尝试为请求提供服务。这将失败,直到 nodetool rebuildnodetool repair 完成。

如果你想重新bootstrap它,我会运行一个“好”节点之一的nodetool removenode。然后在擦除的节点上重新启动 Cassandra,它应该重新 bootstrap 自己,同时在完成之前也不会服务请求。

您遇到此异常 replace_address:

Cannot replace address with a node that is already bootstrapped

因为您没有完全清除 data/ 目录。

system.local table 中的 bootstrapped 列设置为 COMPLETED 时,节点被标记为“bootstrapped”。如果 data/ 目录在启动时为空,则 system.local table 将为空,因此节点将 bootstrap 正常。例外情况是:

  1. 节点本身列在 cassandra.yamlseeds 列表中。
  2. auto_bootstrap属性在cassandra.yaml中设置为false