Geroba Data Technologies: Make the better decisions

Cassandra Token Calculator

Cassandra Token Calculator
Token Calculator (Screenshot)

A handy Apache Cassandra token calculator for online initial token calculation with RandomPartitioner and Murmur3Partitioner

When creating a Cassandra cluster and not using virtual nodes that were introduced in version 1.2 (and are not fully supported by OpsCenter yet), you need to define the token range each individual cluster node is responsible for. If you set up Cassandra Clusters from time to time (like I do), this online calculator can be quite handy for you.

Just enter the amount of nodes you want to have initially and the partitioner (either RandomPartitioner or Murmur3Partitioner which is default in Cassandra 1.2+):

Cassandra Token Calculator

Partitioner
Number of nodes
Result
Calculate Tokens

Note: This implementation uses the BigInteger JavaScript Library by Silent Matt.

Explanation of token calculation

The token calculation is basically a function that divides the whole token range into equally sized subparts. For the RandomPartitioner, Cassandra offers a tool to calculate the partitions, for Murmur3, a Python script is provided:

The following two tabs change content below.
Gernot R. Bauer is the founder of Geroba Data Technologies. With a strong technological background in informatics, mathematics, machine learning and algorithm design, Gernot knows that the base for good business and risk management decisions resides in the quality of the underlying data.
 
Comments

Everything is very open with a clear clarification of the challenges.
It was definitely informative. Your website is very helpful.
Thank you for sharing!

Leave a Reply