Shelen
Shelen

Reputation: 169

How to reuse a cassandra node after decommission?

I had a cluster with 2 nodes (node 1 and node 2).

After decommissioning node 2 I wanted to use the server as a fresh Cassandra database for other purposes, but as soon as I restart this message appears:

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

So I removed all existing data.

But I don't want the node to be bootstrapped again (neither rejoin the previous ring) but to be a fresh new and pure Cassandra database to be used.

The old node is not on the seed list.

Cassandra version: 3.9

EDIT: I think I was missunderstood, sorry for that. After the decommission I want to have:

Two diferent databases with no correlation, totally separated. That's because we want to reuse the machine where node2 is hosted again to deploy a Cassandra DB in another enviroment.

Upvotes: 3

Views: 2923

Answers (3)

Simon Fontana Oscarsson
Simon Fontana Oscarsson

Reputation: 2124

Don't use override_decommission. That flag is only used for rejoining the same cluster.

You should remove all data files on the node (Cassandra will recreate system tables on start). Most importantly you need to change the seed in cassandra.yaml. I suspect that it is still the ip of node 1, so you need to change it to node 2 (itself).

Upvotes: 3

Horia
Horia

Reputation: 2982

Use that option, cassandra.override_decommission=true. Also, be aware what is the definition of cluster_name is 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.

So, to be sure, also use another value for cluster_name option in cassandra.yaml.

Try these steps:

  • run in cqlsh: UPDATE system.local SET cluster_name = 'new_name' where key='local';
  • nodetool flush in order to persist the data
  • nodetool decommission
  • stop node
  • change name in cassandra.yaml
  • clean node sudo rm -rf /var/lib/cassandra/* /var/log/cassandra/* but I would just move those file in some other place until you get the state that you want
  • start node

Please check 1, 2

Upvotes: 0

user6238251
user6238251

Reputation: 66

Use option cassandra.override_decommission: true

Upvotes: 0

Related Questions