Search code examples
amazon-ec2cassandradatastax-enterprise

Unable to add another node to existing node to form a cluster. Couldn't change num_tokens to vnodes


i have installed cassandra on two individual nodes both on Amazon.when i am trying to configure nodes to form a cluster the nodes. I am receiving the following error.

ERROR [main] 2016-05-12 11:01:26,402 CassandraDaemon.java:381 - Fatal configuration error org.apache.cassandra.exceptions.ConfigurationException: Cannot change the number of tokens from 1 to 256.

I using these setting in cassandra.yaml file

listen_address and rpc_address to : private Ip address

seeds : Public Ip [Elastic Ip address]

num_tokens: 256


Solution

  • This message usually appears when num_tokens is changed after the node has been bootstrapped.

    The solution is:

    1. Stop Cassandra on all nodes
    2. Delete the data directory (inc. datafiles, commitlog and saved_caches)
    3. Double check that num_tokens is set to 256, initial_token is commented out and auto_bootstrap is set to true in cassandra.yaml
    4. Start Cassandra on all nodes

    This will wipe your existing cluster and cause the nodes to bootstrap from scratch again.

    Cassandra doesn't support changing between vnodes and static tokens after a datacenter is bootstrapped. If you need to change from vnodes to static tokens or vice versa in an already running cluster, you'll need to create a second datacenter using the new configuration, stream your data across, and then decomission the original nodes.