You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sasha Dolgy <sd...@gmail.com> on 2011/03/14 21:18:15 UTC

calculating initial_token

Sorry for being a bit daft ... Wanted a bit of validation or rejection ...

If I have a 6 node cluster, replication factor 2 (don't think this is
applicable to the token decision) is the following sufficient and
correct for determining the tokens:

#!/bin/bash
for nodes in {0..5};
do
    echo "$nodes*(2^127/5)" | bc;
done




Gives me a result of:

0
34028236692093846346337460743176821145
68056473384187692692674921486353642290
102084710076281539039012382229530463435
136112946768375385385349842972707284580
170141183460469231731687303715884105725

My ring right now is:


10.0.0.2  Up     Normal  225 KB          40.78%
24053088190195663439419935163232881936
10.0.0.3    Up     Normal  201.21 KB       19.17%
56667357399723182105247119364967854254
10.0.0.4   Up     Normal  213.15 KB       17.61%
86624712919272143003828971968762407027
10.0.0.5   Up     Normal  214.54 KB       11.22%
105714724128406151241468359303513100912
10.0.0.6  Up     Normal  206.39 KB       5.61%
115259729732973155360288052970888447854
10.0.0.7    Up     Normal  247.68 KB       5.61%
124804735337540159479107746638263794797

If my new tokens are correct:

1.  cassandra.yaml is updated on each node with new token
2.  node is restarted and a nodetool repair is run, or is a nodetool
loadbalance run

Thanks in advance ... been staring at
http://wiki.apache.org/cassandra/Operations#Token_selection for too
long

-- 
Sasha Dolgy
sasha.dolgy@gmail.com

Re: calculating initial_token

Posted by aaron morton <aa...@thelastpickle.com>.
Once the node has started once, it will not use the value for initial_token in cassandra.yaml.

Use nodetool move to assign a new token to the node. nodetool loadbalance is generally a bad idea www.spidertracks.com

 Aaron
On 15 Mar 2011, at 13:04, Narendra Sharma wrote:

> The %age (owns) is just the arc length in terms of %age of tokens a node owns out of the total token space. It doesn't reflect the actual data.
> 
> The size (load) is the real current load.
> 
> -Naren
> 
> 
> On Mon, Mar 14, 2011 at 2:59 PM, Sasha Dolgy <sd...@gmail.com> wrote:
> ah, you know ... i have been reading it wrong.  the output shows a
> nice fancy column called "Owns" but i've only ever seen the percentage
> ... the amount of data or "load" is even ... doh.  thanks for the
> reply.  cheers
> -sd
> 
> On Mon, Mar 14, 2011 at 10:47 PM, Narendra Sharma
> <na...@gmail.com> wrote:
> > On the same page there is a section on Load Balance that talks about python
> > script to compute tokens. I believe your question is more about assigning
> > new tokens and not compute tokens.
> >
> > 1. "nodetool loadbalance" will result in recomputation of tokens. It will
> > pick tokens based on the load and not the once assigned by you.
> > 2. You can either use decommission and bootstrap with new tokens OR Use
> > "nodetool move"
> >
> > Thanks,
> > Naren
> >
> > On Mon, Mar 14, 2011 at 1:18 PM, Sasha Dolgy <sd...@gmail.com> wrote:
> >>
> >> Sorry for being a bit daft ... Wanted a bit of validation or rejection ...
> >>
> >> If I have a 6 node cluster, replication factor 2 (don't think this is
> >> applicable to the token decision) is the following sufficient and
> >> correct for determining the tokens:
> >>
> >> #!/bin/bash
> >> for nodes in {0..5};
> >> do
> >>    echo "$nodes*(2^127/5)" | bc;
> >> done
> >>
> >>
> >>
> >>
> >> Gives me a result of:
> >>
> >> 0
> >> 34028236692093846346337460743176821145
> >> 68056473384187692692674921486353642290
> >> 102084710076281539039012382229530463435
> >> 136112946768375385385349842972707284580
> >> 170141183460469231731687303715884105725
> >>
> >> My ring right now is:
> >>
> >>
> >> 10.0.0.2  Up     Normal  225 KB          40.78%
> >> 24053088190195663439419935163232881936
> >> 10.0.0.3    Up     Normal  201.21 KB       19.17%
> >> 56667357399723182105247119364967854254
> >> 10.0.0.4   Up     Normal  213.15 KB       17.61%
> >> 86624712919272143003828971968762407027
> >> 10.0.0.5   Up     Normal  214.54 KB       11.22%
> >> 105714724128406151241468359303513100912
> >> 10.0.0.6  Up     Normal  206.39 KB       5.61%
> >> 115259729732973155360288052970888447854
> >> 10.0.0.7    Up     Normal  247.68 KB       5.61%
> >> 124804735337540159479107746638263794797
> >>
> >> If my new tokens are correct:
> >>
> >> 1.  cassandra.yaml is updated on each node with new token
> >> 2.  node is restarted and a nodetool repair is run, or is a nodetool
> >> loadbalance run
> >>
> >> Thanks in advance ... been staring at
> >> http://wiki.apache.org/cassandra/Operations#Token_selection for too
> >> long
> >>
> >> --
> >> Sasha Dolgy
> >> sasha.dolgy@gmail.com
> >
> >
> 
> 
> 
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
> 


Re: calculating initial_token

Posted by Narendra Sharma <na...@gmail.com>.
The %age (owns) is just the arc length in terms of %age of tokens a node
owns out of the total token space. It doesn't reflect the actual data.

The size (load) is the real current load.

-Naren


On Mon, Mar 14, 2011 at 2:59 PM, Sasha Dolgy <sd...@gmail.com> wrote:

> ah, you know ... i have been reading it wrong.  the output shows a
> nice fancy column called "Owns" but i've only ever seen the percentage
> ... the amount of data or "load" is even ... doh.  thanks for the
> reply.  cheers
> -sd
>
> On Mon, Mar 14, 2011 at 10:47 PM, Narendra Sharma
> <na...@gmail.com> wrote:
> > On the same page there is a section on Load Balance that talks about
> python
> > script to compute tokens. I believe your question is more about assigning
> > new tokens and not compute tokens.
> >
> > 1. "nodetool loadbalance" will result in recomputation of tokens. It will
> > pick tokens based on the load and not the once assigned by you.
> > 2. You can either use decommission and bootstrap with new tokens OR Use
> > "nodetool move"
> >
> > Thanks,
> > Naren
> >
> > On Mon, Mar 14, 2011 at 1:18 PM, Sasha Dolgy <sd...@gmail.com> wrote:
> >>
> >> Sorry for being a bit daft ... Wanted a bit of validation or rejection
> ...
> >>
> >> If I have a 6 node cluster, replication factor 2 (don't think this is
> >> applicable to the token decision) is the following sufficient and
> >> correct for determining the tokens:
> >>
> >> #!/bin/bash
> >> for nodes in {0..5};
> >> do
> >>    echo "$nodes*(2^127/5)" | bc;
> >> done
> >>
> >>
> >>
> >>
> >> Gives me a result of:
> >>
> >> 0
> >> 34028236692093846346337460743176821145
> >> 68056473384187692692674921486353642290
> >> 102084710076281539039012382229530463435
> >> 136112946768375385385349842972707284580
> >> 170141183460469231731687303715884105725
> >>
> >> My ring right now is:
> >>
> >>
> >> 10.0.0.2  Up     Normal  225 KB          40.78%
> >> 24053088190195663439419935163232881936
> >> 10.0.0.3    Up     Normal  201.21 KB       19.17%
> >> 56667357399723182105247119364967854254
> >> 10.0.0.4   Up     Normal  213.15 KB       17.61%
> >> 86624712919272143003828971968762407027
> >> 10.0.0.5   Up     Normal  214.54 KB       11.22%
> >> 105714724128406151241468359303513100912
> >> 10.0.0.6  Up     Normal  206.39 KB       5.61%
> >> 115259729732973155360288052970888447854
> >> 10.0.0.7    Up     Normal  247.68 KB       5.61%
> >> 124804735337540159479107746638263794797
> >>
> >> If my new tokens are correct:
> >>
> >> 1.  cassandra.yaml is updated on each node with new token
> >> 2.  node is restarted and a nodetool repair is run, or is a nodetool
> >> loadbalance run
> >>
> >> Thanks in advance ... been staring at
> >> http://wiki.apache.org/cassandra/Operations#Token_selection for too
> >> long
> >>
> >> --
> >> Sasha Dolgy
> >> sasha.dolgy@gmail.com
> >
> >
>
>
>
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
>

Re: calculating initial_token

Posted by Sasha Dolgy <sd...@gmail.com>.
ah, you know ... i have been reading it wrong.  the output shows a
nice fancy column called "Owns" but i've only ever seen the percentage
... the amount of data or "load" is even ... doh.  thanks for the
reply.  cheers
-sd

On Mon, Mar 14, 2011 at 10:47 PM, Narendra Sharma
<na...@gmail.com> wrote:
> On the same page there is a section on Load Balance that talks about python
> script to compute tokens. I believe your question is more about assigning
> new tokens and not compute tokens.
>
> 1. "nodetool loadbalance" will result in recomputation of tokens. It will
> pick tokens based on the load and not the once assigned by you.
> 2. You can either use decommission and bootstrap with new tokens OR Use
> "nodetool move"
>
> Thanks,
> Naren
>
> On Mon, Mar 14, 2011 at 1:18 PM, Sasha Dolgy <sd...@gmail.com> wrote:
>>
>> Sorry for being a bit daft ... Wanted a bit of validation or rejection ...
>>
>> If I have a 6 node cluster, replication factor 2 (don't think this is
>> applicable to the token decision) is the following sufficient and
>> correct for determining the tokens:
>>
>> #!/bin/bash
>> for nodes in {0..5};
>> do
>>    echo "$nodes*(2^127/5)" | bc;
>> done
>>
>>
>>
>>
>> Gives me a result of:
>>
>> 0
>> 34028236692093846346337460743176821145
>> 68056473384187692692674921486353642290
>> 102084710076281539039012382229530463435
>> 136112946768375385385349842972707284580
>> 170141183460469231731687303715884105725
>>
>> My ring right now is:
>>
>>
>> 10.0.0.2  Up     Normal  225 KB          40.78%
>> 24053088190195663439419935163232881936
>> 10.0.0.3    Up     Normal  201.21 KB       19.17%
>> 56667357399723182105247119364967854254
>> 10.0.0.4   Up     Normal  213.15 KB       17.61%
>> 86624712919272143003828971968762407027
>> 10.0.0.5   Up     Normal  214.54 KB       11.22%
>> 105714724128406151241468359303513100912
>> 10.0.0.6  Up     Normal  206.39 KB       5.61%
>> 115259729732973155360288052970888447854
>> 10.0.0.7    Up     Normal  247.68 KB       5.61%
>> 124804735337540159479107746638263794797
>>
>> If my new tokens are correct:
>>
>> 1.  cassandra.yaml is updated on each node with new token
>> 2.  node is restarted and a nodetool repair is run, or is a nodetool
>> loadbalance run
>>
>> Thanks in advance ... been staring at
>> http://wiki.apache.org/cassandra/Operations#Token_selection for too
>> long
>>
>> --
>> Sasha Dolgy
>> sasha.dolgy@gmail.com
>
>



-- 
Sasha Dolgy
sasha.dolgy@gmail.com

Re: calculating initial_token

Posted by Narendra Sharma <na...@gmail.com>.
On the same page there is a section on Load Balance that talks about python
script to compute tokens. I believe your question is more about assigning
new tokens and not compute tokens.

1. "nodetool loadbalance" will result in recomputation of tokens. It will
pick tokens based on the load and not the once assigned by you.
2. You can either use decommission and bootstrap with new tokens OR Use
"nodetool move"

Thanks,
Naren

On Mon, Mar 14, 2011 at 1:18 PM, Sasha Dolgy <sd...@gmail.com> wrote:

> Sorry for being a bit daft ... Wanted a bit of validation or rejection ...
>
> If I have a 6 node cluster, replication factor 2 (don't think this is
> applicable to the token decision) is the following sufficient and
> correct for determining the tokens:
>
> #!/bin/bash
> for nodes in {0..5};
> do
>    echo "$nodes*(2^127/5)" | bc;
> done
>
>
>
>
> Gives me a result of:
>
> 0
> 34028236692093846346337460743176821145
> 68056473384187692692674921486353642290
> 102084710076281539039012382229530463435
> 136112946768375385385349842972707284580
> 170141183460469231731687303715884105725
>
> My ring right now is:
>
>
> 10.0.0.2  Up     Normal  225 KB          40.78%
> 24053088190195663439419935163232881936
> 10.0.0.3    Up     Normal  201.21 KB       19.17%
> 56667357399723182105247119364967854254
> 10.0.0.4   Up     Normal  213.15 KB       17.61%
> 86624712919272143003828971968762407027
> 10.0.0.5   Up     Normal  214.54 KB       11.22%
> 105714724128406151241468359303513100912
> 10.0.0.6  Up     Normal  206.39 KB       5.61%
> 115259729732973155360288052970888447854
> 10.0.0.7    Up     Normal  247.68 KB       5.61%
> 124804735337540159479107746638263794797
>
> If my new tokens are correct:
>
> 1.  cassandra.yaml is updated on each node with new token
> 2.  node is restarted and a nodetool repair is run, or is a nodetool
> loadbalance run
>
> Thanks in advance ... been staring at
> http://wiki.apache.org/cassandra/Operations#Token_selection for too
> long
>
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
>