In a previous post, I showed you how to clone your Google Cloud VM and prepare it for the Cassandra software, here.  In this post, I will show you how to transfer your Cassandra software over to your new node and add it to the cluster.

1. On cass-node-2 check to make sure there is nothing in /opt/cass/

[cassandra@cass-node-2 ~]$ cd /opt/cass
[cassandra@cass-node-2 cass]$ pwd
/opt/cass
[cassandra@cass-node-2 cass]$ ll
total 0

2. On cass-node-1 run the following to transfer the software over to cass-node-2

[cassandra@cass-node-1 cass]$ scp -r /opt/cass/ apache-cassandra-3.11.3/ cass-node-2:/opt/cass

3. On cass-node-2 check that the software is there.

[cassandra@cass-node-2 cass]$ cd /opt/cass/apache-cassandra-3.11.3/
[cassandra@cass-node-2 apache-cassandra-3.11.3]$ ll
total 508
drwxr-xr-x. 2 cassandra cassandra   4096 Aug 14 14:50 bin
-rw-r--r--. 1 cassandra cassandra   4832 Aug 14 14:50 CASSANDRA-14092.txt
-rw-r--r--. 1 cassandra cassandra 363293 Aug 14 14:50 CHANGES.txt
drwxr-xr-x. 3 cassandra cassandra   4096 Aug 14 14:50 conf
drwxrwxr-x. 3 cassandra cassandra     19 Aug 14 14:50 data
drwxr-xr-x. 3 cassandra cassandra     33 Aug 14 14:50 doc
drwxr-xr-x. 2 cassandra cassandra     30 Aug 14 14:50 interface
drwxr-xr-x. 3 cassandra cassandra   4096 Aug 14 14:50 javadoc
drwxr-xr-x. 4 cassandra cassandra   4096 Aug 14 14:50 lib
-rw-r--r--. 1 cassandra cassandra  11609 Aug 14 14:50 LICENSE.txt
drwxrwxr-x. 2 cassandra cassandra     65 Aug 14 14:50 logs
-rw-r--r--. 1 cassandra cassandra 112101 Aug 14 14:50 NEWS.txt
-rw-r--r--. 1 cassandra cassandra   2811 Aug 14 14:50 NOTICE.txt
drwxr-xr-x. 3 cassandra cassandra     38 Aug 14 14:50 pylib
drwxr-xr-x. 4 cassandra cassandra    135 Aug 14 14:50 tools

4. On cass-node-2 we need to change the configuration of Cassandra before we start it up.

[cassandra@cass-node-2 ~]$ cd /opt/cass/apache-cassandra-3.11.3/conf
[cassandra@cass-node-2 conf]$ vi cassandra.yaml

We only need to change 2 config values:

listen_address: cass-node-2
rpc_address: cass-node-2

5. On cass-node-2 we issue the startup command

[cassandra@cass-node-2 conf]$ cassandra

6. On cass-node-1 we can see cass-node-2 joining the cluster with a status of UJ(up/joining)

[cassandra@cass-node-1 cass]$ nodetool status
Datacenter: EU_WEST_2A
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens       Owns (effective)  Host ID                               Rack
UJ  10.154.0.2  64.45 KiB  256          ?                 0e9e684f-9877-4adf-ae96-9679bbf058fd  RAC1
UN  10.154.0.4  223.08 KiB  256         100.0%            26a4b9b8-54e6-49f3-9068-a1f37b4979fc  RAC1

Once the node joins the cluster is will have a status of UN (up/normal)

[cassandra@cass-node-1 cass]$ nodetool status
Datacenter: EU_WEST_2A
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens       Owns (effective)  Host ID                               Rack
UN  10.154.0.2  69.91 KiB  256          100.0%            0e9e684f-9877-4adf-ae96-9679bbf058fd  RAC1
UN  10.154.0.4  223.08 KiB  256         100.0%            26a4b9b8-54e6-49f3-9068-a1f37b4979fc  RAC1

Conclusion

We now have a 2 node Cassandra cluster to play with.  Please make sure and shut the VM’s down when you go to bed for the night 🙂 otherwise you will fly through your free credit.  Who knows, but the time you read this Google might not even be offering free credits.

LEAVE A REPLY

Please enter your comment!
Please enter your name here