cassandra -tokens and org.apache.cassandra.exceptions.ConfigurationException: For input string:

cassandra

Solution

These aren't valid Murmur3Partitioner tokens, they are RandomPartitioner tokens. Take a look at these DataStax docs on generating murmur3 tokens, or if you do want to use RandomPartitioner then edit your `partitioner` setting in cassandra.

Just for a clear comparison

Murmur3 Partitioner    | Random Partitioner
------------------------------------------------------------
-9223372036854775808   | 0
-4611686018427387904   | 42535295865117307932921825928971026432
-0                     | 85070591730234615865843651857942052864
-4611686018427387904   | 127605887595351923798765477786913079296

You can generate murmur3 tokens using python (n is the number of nodes in the dc):

python -c 'print [str(((2**64 / n) * i) - 2**63) for i in range(n)]'
# eg for 4 nodes...
python -c 'print [str(((2**64 / 4) * i) - 2**63) for i in range(4)]'

Problem

whats the deal with Cassandra? From the token tool with 2 nodes and on the second cluster I get the below error. ``` initial_token: 85070591730234615865843651857942052864 INFO [main] 2014-02-25 01:15:39,670 CassandraDaemon.java (line 130) Logging initialized INFO [main] 2014-02-25 01:15:39,716 YamlConfigurationLoader.java (line 76) Loading settings from file:/etc/cassandra/cassandra.yaml INFO [main] 2014-02-25 01:15:40,407 DatabaseDescriptor.java (line 141) Data files directories: [/var/lib/cassandra/data] INFO [main] 2014-02-25 01:15:40,408 DatabaseDescriptor.java (line 142) Commit log directory: /var/lib/cassandra/commitlog INFO [main] 2014-02-25 01:15:40,409 DatabaseDescriptor.java (line 182) DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap INFO [main] 2014-02-25 01:15:40,409 DatabaseDescriptor.java (line 196) disk_failure_policy is stop INFO [main] 2014-02-25 01:15:40,417 DatabaseDescriptor.java (line 266) Global memtable threshold is enabled at 122MB INFO [main] 2014-02-25 01:15:40,609 DatabaseDescriptor.java (line 399) Not using multi-threaded compaction ERROR [main] 2014-02-25 01:15:40,612 DatabaseDescriptor.java (line 115) Fatal configuration error org.apache.cassandra.exceptions.ConfigurationException: For input string: "85070591730234615865843651857942052864" at org.apache.cassandra.dht.Murmur3Partitioner$1.validate(Murmur3Partitioner.java:178) at org.apache.cassandra.config.DatabaseDescriptor.applyConfig(DatabaseDescriptor.java:438) at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:110) at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:151) at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:462) at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:552) ```

Original source