lightweight
lightweight

Reputation: 3327

cannot change number of tokens from 256 to 1

I have a 3 node cassandra cluster and on my seed, the num_tokens is set to 256. I'm trying to set it to 1 or comment it out...but every time when i start cassandra, I get this error:

    ERROR 21:28:08 Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Cannot change the number of tokens from 256 to 1

I also did a rm -rf /var/lib/cassandra/*

I also tried to go into system.local in cql and delete everything in the tokens field but I wasn't able to. How do I change this property?

Upvotes: 1

Views: 4897

Answers (1)

shobull
shobull

Reputation: 4100

Follow these steps to resolve this issue:

Step 1 - Calculate the token for the node (replace all occurences of "number_of_tokens" with valid value):

python -c 'print [str(((2**64 / number_of_tokens) * i) - 2**63) for i in range(number_of_tokens)]'

Step 2 - Reconfigure the token properties in cassandra.yaml:

  • comment out num_tokens
  • set the token assignment initial_token
  • leave auto_bootstrap: true

Step 3 - Delete the following directories. This will ensure that all their contents are cleaned out completely.

  • data_file_directories (path is in cassandra.yaml config file)
  • commitlog
  • saved_caches

Step 4 - Recreate the directories above and make sure Cassandra has full permissions.

Step 5 - Bootstrap the node again by starting DSE.

Original post here

Upvotes: 2

Related Questions