Moving a node to a specific ring location
Fire up a 3 node Cassandra cluster
mkdir -p /home/hadoop/AdithyaJ/Cassandra
cd /home/hadoop/AdithyaJ/Cassandra
git clone https://github.com/riptano/ccm.git
cd ccm
./setup.py install
ccm create test -v 3.0.16 -n 3 -s
Write data to the cluster
cassandra-stress write n=100000 -rate threads=500 -node 127.0.0.1,127.0.0.2,127.0.0.3
nodetool ring
/root/.ccm/repository/3.0.16/bin/nodetool -h 127.0.0.1 -p 7200 ring
Datacenter: datacenter1
==========
Address Rack Status State Load Owns Token
3074457345618258602
127.0.0.1 rack1 Up Normal 88.49 KB 33.33% -9223372036854775808
127.0.0.2 rack1 Up Normal 88.49 KB 33.33% -3074457345618258603
127.0.0.3 rack1 Up Normal 70.23 KB 33.33% 3074457345618258602
nodetool move
/root/.ccm/repository/3.0.16/bin/nodetool -h 127.0.0.1 -p 7100 move 0
Moving large amounts of data can take a long time
nodetool ring
/root/.ccm/repository/3.0.16/bin/nodetool -h 127.0.0.1 -p 7200 ring
Datacenter: datacenter1
==========
Address Rack Status State Load Owns Token
3074457345618258602
127.0.0.2 rack1 Up Normal 7.97 MB 66.67% -3074457345618258603
127.0.0.1 rack1 Up Normal 11.93 MB 16.67% 0
127.0.0.3 rack1 Up Normal 7.97 MB 16.67% 3074457345618258602
/root/.ccm/repository/3.0.16/bin/nodetool -h 127.0.0.1 -p 7100 move -92233720368547758080
error: For input string: "-92233720368547758080"
-- StackTrace --
java.io.IOException: For input string: "-92233720368547758080"
at org.apache.cassandra.service.StorageService.move(StorageService.java:3718)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Nodetool Move is a one-step way to accomplish the two-part process of removing and adding a node. It combines a Nodetool Decomission with an AutoBootstrap startup.
Behind the scenes, nodetool move causes the node to move data to other nodes before leaving the cluster. The node then re-joins at the location specified by the user. Other nodes compute data that belongs on the rejoined node and transmit that data back to it.