Use this method for generating tokens when you are not using virtual nodes (vnodes) and using the Murmur3Partitioner (default). This partitioner uses a maximum possible range of hash values from -2 63 to +2 63 -1. To calculate tokens for this partitioner:
python -c 'print [str(((2**64 / number_of_tokens) * i) - 2**63) for i in range(number_of_tokens)]'
For example, to generate tokens for 6 nodes:
python -c 'print [str(((2**64 / 6) * i) - 2**63) for i in range(6)]'
The command displays the token for each node:
[ '-9223372036854775808', '-6148914691236517206', '-3074457345618258604', '-2' , '3074457345618258600', '6148914691236517202' ]
What I'm struggling to do is to come up with a way to express this idea in puppet terms that I can use in a puppet template so that I can have the template automatically generate an answer to the initial_token question such that it will turn up the the cassandra.yaml file like so:
intial_token: -9223372036854775808
I am definitely up for any suggestions anyone may have for this rather fascinating problem!
Thanks
Tim
Generate the number of tokens that's the maximum number of nodes you expect in your cassandra clusters (for example 15), put them into array, and let the module use them, for example:
$tokens = [ '-9223372036854775808', '-6148914691236517206', '-3074457345618258604', '-2' , '3074457345618258600', '6148914691236517202' ]
Then in your erb use something like:
<%= @token[@node_number] %>
So, basically, either you write puppet function that generates tokes or you generate static tokens yourself.
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53822C08.5020700%40gmail.com.
For more options, visit https://groups.google.com/d/optout.