Clone VM from the first node and clear it down
Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. With that said whats the point in only having one node, we need to create a “Cluster” .
I will now show you how to clone and prepare a second node which can then be repeated any number of times to create multiple nodes, that’s when the real learning starts.
1. Here we see “cass-node-1” in our list of VM’s
2. On the left-hand menu, we have the following options, right now we are interested in the “snapshot” menu. Click on Snapshot.
3. Click Create snapshot.
4. Name the snapshot something meaningful and set the Source disk to the VM you want to clone, in our case we want to clone cass-node-01. Click create.
5. The snapshot starts to create.
6. This is what you will see once the snapshot is finished creating. Click on the <Snapshot Name>.
7. Inside the snapshot we want to create a new instance based on the snapshot, click on “Create Instance”
8. Name the new instance something relevant and set the region and zone to be the same as your first node. Make sure that the Boot Disk is set to your snapshot otherwise it won’t work and you will just be creating an instance based on an OS with nothing on it.
9. The new instance will start creating. Once it is created click on SSH and log in. All passwords should be the same as cass-node-1.
10. As we can see, all the software has been cloned along with all server parameters etc that we changed when we created the first node.
11. Now we need to clear down and clean the VM by doing the following:
cd /opt/cass rm -Rf apache-cassandra-3.11.3
12. Verify that the following directories are empty, if not delete all files.
[cassandra@cass-node-2 cassandra]$ ls -l /data/cassandra/saved_caches/ total 0 [cassandra@cass-node-2 cassandra]$ ls -l /data/cassandra/data/ total 8 drwxrwxr-x. 26 cassandra cassandra 4096 Aug 14 11:08 system drwxrwxr-x. 6 cassandra cassandra 233 Aug 14 11:21 system_auth drwxrwxr-x. 5 cassandra cassandra 181 Aug 14 11:20 system_distributed drwxrwxr-x. 12 cassandra cassandra 4096 Aug 14 11:08 system_schema drwxrwxr-x. 4 cassandra cassandra 102 Aug 14 11:20 system_traces
I need to clear down everything in the /data/cassandra/data directory.
[cassandra@cass-node-2 data]$ cd /data/cassandra/data/ [cassandra@cass-node-2 data]$ rm -Rf system_auth system_distributed system_schema system_traces system [cassandra@cass-node-2 data]$ ll total 0
13. Now we need to remove commitlogs from the commitlog direcotry
[cassandra@cass-node-2 cassandra]$ cd /commitlog1/cassandra/commitlog [cassandra@cass-node-2 commitlog]$ ll total 1272 -rw-rw-r--. 1 cassandra cassandra 33554432 Aug 14 12:04 CommitLog-6-1534246386154.log -rw-rw-r--. 1 cassandra cassandra 33554432 Aug 14 11:33 CommitLog-6-1534246386155.log [cassandra@cass-node-2 commitlog]$ rm -f * [cassandra@cass-node-2 commitlog]$ ll total 0
The node should now be clear and ready for us to send over the binary Cassandra software from the first node cass-node-1.
The next step is for us to setup ssh between the nodes.