You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Bill Au <bi...@gmail.com> on 2012/05/09 16:08:23 UTC

how to re-distribute replicas after changing rack assignment

I am running 1.0.8 with NetworkTopologyStrategy and need to change the rack
assignment of my nodes.  How do I get Cassandra to re-distribute the
existing replica according to the new rack assignment?  Will nodetool
repair do the trick?

Bill

Re: how to re-distribute replicas after changing rack assignment

Posted by Bill Au <bi...@gmail.com>.
Thanks, Aaron.  Moving one node at a time and running repair does seem to
do the trick.

Bill

On Thu, May 10, 2012 at 7:03 AM, aaron morton <aa...@thelastpickle.com>wrote:

> That's a bit tricky. How many nodes, what is the replication and what is
> the current rack assignment ?
>
> NTS stripes data over the racks in a DC, looping around until the RF is
> reached. If you change the rack assignments there is a chance data will be
> lost. Or at least go missing until a repair or reap repair puts it in the
> right place.
>
> The logic is something like:
> 1) For each DC get all the nodes.
> 2) Order the nodes in the DC by token.
> 3) For each node in the DC get the rack, if the rack has not been seen
> before make the node a replica. Stop when the RF is reached.
> 4) If the RF for the DC is not reached, iterate over the sorted nodes in
> the DC and make them replicas if they have not been seen before. (Does not
> check rack again.)
>
> You should be able to move one node at a time and run repair. Also ensure
> reads are at QUOURM.
>
> hope that helps.
>
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 10/05/2012, at 2:08 AM, Bill Au wrote:
>
> I am running 1.0.8 with NetworkTopologyStrategy and need to change the
> rack assignment of my nodes.  How do I get Cassandra to re-distribute the
> existing replica according to the new rack assignment?  Will nodetool
> repair do the trick?
>
> Bill
>
>
>

Re: how to re-distribute replicas after changing rack assignment

Posted by aaron morton <aa...@thelastpickle.com>.
That's a bit tricky. How many nodes, what is the replication and what is the current rack assignment ?

NTS stripes data over the racks in a DC, looping around until the RF is reached. If you change the rack assignments there is a chance data will be lost. Or at least go missing until a repair or reap repair puts it in the right place. 

The logic is something like:
1) For each DC get all the nodes. 
2) Order the nodes in the DC by token. 
3) For each node in the DC get the rack, if the rack has not been seen before make the node a replica. Stop when the RF is reached.
4) If the RF for the DC is not reached, iterate over the sorted nodes in the DC and make them replicas if they have not been seen before. (Does not check rack again.) 

You should be able to move one node at a time and run repair. Also ensure reads are at QUOURM. 

hope that helps. 

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 10/05/2012, at 2:08 AM, Bill Au wrote:

> I am running 1.0.8 with NetworkTopologyStrategy and need to change the rack assignment of my nodes.  How do I get Cassandra to re-distribute the existing replica according to the new rack assignment?  Will nodetool repair do the trick?
> 
> Bill