>
> 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.

That's a really great idea! I'll give it a shot. Thank you!

Tim


On Sun, May 25, 2014 at 1:44 PM, Jakov Sosic <jso...@gmail.com> wrote:

> On 05/25/2014 05:38 AM, Tim Dunphy wrote:
>
>> Hey all,
>>
>> I'm trying to write a puppet module to deploy the cassandra database
>> automatically. I'm using puppet templates to provide the IP address to
>> the listen_address parameter of the cassandra.yaml file like so:
>>
>> listen_address: <%= ipaddress %>
>>
>> So far that part's working beautifully! However in cassandra there is
>> the concept of the 'initial_token' which is based on another concept
>> called 'partition type' which is used to dictate what data goes where in
>> a cassandra cluster.
>>
>> Now in determining the 'inital_token' you generally use a mathematical
>> formula which you can read some more about here if I've managed to pique
>> anyone's curiosity:
>>
>> http://www.datastax.com/documentation/cassandra/1.2/
>> cassandra/configuration/configGenTokens_c.html
>>
>> The type of data partition I'm using is called 'murmur3' and it uses
>> this algorithm to determine a nodes' initial_token it uses to join a
>> cassandra cluster.
>>
>> The murmur3 token generation process is described like this:
>>
>> Use this method for generating tokens when you are *not* using virtual
>>
>> nodes (vnodes) and using the Murmur3Partitioner
>> <http://www.datastax.com/documentation/cassandra/1.2/
>> cassandra/architecture/architecturePartitionerM3P_c.
>> html#concept_ds_ns5_spf_fk> (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!
>>
>
> If I understand it correctly, initial_tokens are always the same - meaning
> consecutive runs of the same function will generate same tokens.
>
> You can then write function that will be run on puppet master and will
> generate tokens.
>
>
> If the function is always the same - meaning it doesn't have some
> randomizing parameter like cluster name or something that would generate
> different tokens for different clusters, you can even generate the numbers
> beforehand and put them in an array:
> '-9223372036854775808'
> '-6148914691236517206'
> '-3074457345618258604'
> '-2'
> '3074457345618258600'
> '6148914691236517202'
>
> 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+unsubscr...@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.
>



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOZy0enxo4L9XwLGvBUH9F%2BSSaDN9-8SMuUkSsAB%3DV5m%3D5Ejew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to