You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by mcasandra <mo...@gmail.com> on 2011/02/14 22:13:13 UTC

RandomPartitioner

I am trying to understand atleast to some level of detail about how random
partitioner works. With the text I have seen on the website I am not able to
clearly understand. Is there a place where it's described with an example,
for eg how nodes are assigned random tokens? Is the range picked randomly
and assigned to nodes in circular fashion, for eg: hash ABC to FGH goes to
node A and then hash IJKLM-OPQR goes to node B?
-- 
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/RandomPartitioner-tp6025203p6025203.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.

Re: RandomPartitioner

Posted by Matthew Dennis <md...@datastax.com>.
nodes contain data for (prevTokenInRing, nodesOwnToken] (i.e. exclusive from
previous token to inclusive of the nodes token).  So .179 will contain
things that hash in the range (152896308109140433971537345591636551711,0]
and .12 will contain things that hash in range
(0,152896308109140433971537345591636551711].  You can see this "visually" by
noticing that .179 has 10% and .12 has 90% of the ring (~
152896308109140433971537345591636551711 / 2^127).

On Mon, Feb 14, 2011 at 5:28 PM, mcasandra <mo...@gmail.com> wrote:

>
> I installed cassandra and started it in multi-node. I set the InitialToken
> to
> 0. I ran nodetool and see:
>
> $ nodetool -h localhost ring
> Address         Status State   Load            Owns    Token
>
> 152896308109140433971537345591636551711
> 172.16.20.179  Up     Normal  7.52 KB         10.14%  0
> 172.16.20.12   Up     Normal  12.5 KB         89.86%
> 152896308109140433971537345591636551711
>
> --
> Does it mean any keys between 0 - 152896308109140433971537345591636551711
> will go in Node 1
> and anything > 152896308109140433971537345591636551711 will go in Node 2?
> --
> View this message in context:
> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/RandomPartitioner-tp6025203p6025659.html
> Sent from the cassandra-user@incubator.apache.org mailing list archive at
> Nabble.com.
>

Re: RandomPartitioner

Posted by mcasandra <mo...@gmail.com>.
I installed cassandra and started it in multi-node. I set the InitialToken to
0. I ran nodetool and see:

$ nodetool -h localhost ring
Address         Status State   Load            Owns    Token
                                                      
152896308109140433971537345591636551711
172.16.20.179  Up     Normal  7.52 KB         10.14%  0
172.16.20.12   Up     Normal  12.5 KB         89.86% 
152896308109140433971537345591636551711

--
Does it mean any keys between 0 - 152896308109140433971537345591636551711
will go in Node 1
and anything > 152896308109140433971537345591636551711 will go in Node 2?
-- 
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/RandomPartitioner-tp6025203p6025659.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.

Re: RandomPartitioner

Posted by mcasandra <mo...@gmail.com>.

Dan Kuebrich wrote:
> 
> You may find this part of the wiki helpful:
> http://wiki.apache.org/cassandra/Operations#Range_changes
> 
> "If you explicitly specify an InitialToken in the configuration, the new
> node will bootstrap to that position on the ring. Otherwise, it will pick
> a
> Token that will give it half the keys from the node with the most disk
> space
> used, that does not already have another node bootstrapping into its
> Range."
> 
> 
So if I am starting with only one node and I specify InitialToken as 0 then
what does it mean?



> It is circular, and token selection (after first node) is determined by
> key
> distribution.
> 
> 

Didn't quite understand this statement. What do you mean by key
distribution? I don't have any keyspace or CF at this point.


One more question, how can I remove or change token to 0 if I started with
IntitialToken as default (unset).
-- 
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/RandomPartitioner-tp6025203p6025380.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.

Re: RandomPartitioner

Posted by Dan Kuebrich <da...@gmail.com>.
You may find this part of the wiki helpful:
http://wiki.apache.org/cassandra/Operations#Range_changes

"If you explicitly specify an InitialToken in the configuration, the new
node will bootstrap to that position on the ring. Otherwise, it will pick a
Token that will give it half the keys from the node with the most disk space
used, that does not already have another node bootstrapping into its Range."

It is circular, and token selection (after first node) is determined by key
distribution.

Sent from my iPhone

On Feb 14, 2011, at 4:13 PM, mcasandra <mo...@gmail.com> wrote:


I am trying to understand atleast to some level of detail about how random
partitioner works. With the text I have seen on the website I am not able to
clearly understand. Is there a place where it's described with an example,
for eg how nodes are assigned random tokens? Is the range picked randomly
and assigned to nodes in circular fashion, for eg: hash ABC to FGH goes to
node A and then hash IJKLM-OPQR goes to node B?
-- 
View this message in context:
http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/RandomPartitioner-tp6025203p6025203.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at
Nabble.com.