Single node Cassandra on Ubuntu 18.10

Nutanix uses Cassandra as it’s metadata store. But what if we needed a Cassandra node locally – on our local machine – Cassandra, essentially, is an OpenSource project, so technically, it should be possible to install Cassandra locally, right?

Well let’s try a Cassandra installation on my local machine running Ubuntu!

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.10
Release:	18.10
Codename:	cosmic

Cassandra actually needs Java as a pre-requisite. So the workflow is pretty simple

  • Install Java
  • Get the repos for Cassandra going
  • Install Cassandra
  • Ensure we can bring up a single node
  • Connect to the Cassandra DB and ensure you are able to connect

So let’s go about installing and see how far we get. I am running Ubuntu 18.x

Check if Java is installed – skip if there is Java installed already

$ java version

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless
sudo apt install default-jre            
sudo apt install openjdk-8-jre-headless 

So we don’t have Java installed on this machine. Let’s go about installing Java 8.x. For that, let’s first add the repos. As the message below says, you will need to choose the appropriate repo for the version of Java you need. For this example, we are going with Java 8x

$ sudo add-apt-repository ppa:webupd8team/java
 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK8). There are no actual Java files in this PPA.

Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

Update: Oracle Java 9 has reached end of life: http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html

The PPA supports Ubuntu 18.10, 18.04, 16.04, 14.04 and 12.04.

More info (and Ubuntu installation instructions):
- http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Debian installation instructions:
- Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

For Oracle Java 11, see a different PPA -> https://www.linuxuprising.com/2018/10/how-to-install-oracle-java-11-in-ubuntu.html
 More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic InRelease [15.4 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu cosmic InRelease                     
Get:3 http://security.ubuntu.com/ubuntu cosmic-security InRelease [83.2 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu cosmic-updates InRelease [83.2 kB]       
Get:5 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic/main amd64 Packages [1556 B]     
Get:6 http://in.archive.ubuntu.com/ubuntu cosmic-backports InRelease [74.6 kB]                                                                
Get:7 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic/main i386 Packages [1556 B]           
Get:8 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic/main Translation-en [928 B]            
Fetched 260 kB in 2s (156 kB/s)                                  
Reading package lists... Done

Done. Update

~$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu cosmic InRelease
Get:3 http://security.ubuntu.com/ubuntu cosmic-security InRelease [83.2 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu cosmic-updates InRelease [83.2 kB]       
Get:5 http://in.archive.ubuntu.com/ubuntu cosmic-backports InRelease [74.6 kB]                  
Fetched 241 kB in 1s (166 kB/s)                               
Reading package lists... Done

Now install Java using the apt install

$ sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libtinfo5
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  gsfonts-x11 oracle-java8-set-default
Suggested packages:
  binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
  gsfonts-x11 oracle-java8-installer oracle-java8-set-default
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.6 kB of archives.
After this operation, 236 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic/main amd64 oracle-java8-installer all 8u201-1~webupd8~1 [32.5 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu cosmic/universe amd64 gsfonts-x11 all 0.26 [7140 B]
Get:3 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic/main amd64 oracle-java8-set-default all 8u201-1~webupd8~1 [6984 B]
Fetched 46.6 kB in 1s (62.7 kB/s)                   
Preconfiguring packages ...
Selecting previously unselected package oracle-java8-installer.
(Reading database ... 185671 files and directories currently installed.)
Preparing to unpack .../oracle-java8-installer_8u201-1~webupd8~1_all.deb ...
Unpacking oracle-java8-installer (8u201-1~webupd8~1) ...
Setting up oracle-java8-installer (8u201-1~webupd8~1) ...
No /var/cache/oracle-jdk8-installer/wgetrc file found.
Creating /var/cache/oracle-jdk8-installer/wgetrc and
using default oracle-java8-installer wgetrc settings for it.
Downloading Oracle Java 8...
--2019-01-20 19:03:34--  http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 106.51.144.109
Connecting to download.oracle.com (download.oracle.com)|106.51.144.109|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz [following]
--2019-01-20 19:03:34--  https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.121.252.87, 2600:140f:c000:186::366, 2600:140f:c000:190::366
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.121.252.87|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1547991334_b1204cdea400ee98c30c9af43e421ad6 [following]
--2019-01-20 19:03:35--  http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1547991334_b1204cdea400ee98c30c9af43e421ad6
Connecting to download.oracle.com (download.oracle.com)|106.51.144.109|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1547991334_b1204cdea400ee98c30c9af43e421ad6 [following]
--2019-01-20 19:03:35--  https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1547991334_b1204cdea400ee98c30c9af43e421ad6
Connecting to download.oracle.com (download.oracle.com)|106.51.144.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 191817140 (183M) [application/x-gzip]
Saving to: ‘jdk-8u201-linux-x64.tar.gz’

     0K ........ ........ ........ ........ ........ ........  1% 4.00M 45s
  3072K ........ ........ ........ ........ ........ ........  3% 4.99M 40s
  6144K ........ ........ ........ ........ ........ ........  4% 4.18M 40s
  9216K ........ ........ ........ ........ ........ ........  6% 4.27M 39s
 12288K ........ ........ ........ ........ ........ ........  8% 3.07M 42s
 15360K ........ ........ ........ ........ ........ ........  9% 2.60M 45s
 18432K ........ ........ ........ ........ ........ ........ 11% 3.06M 45s
 21504K ........ ........ ........ ........ ........ ........ 13% 3.07M 45s
 24576K ........ ........ ........ ........ ........ ........ 14% 4.56M 43s
 27648K ........ ........ ........ ........ ........ ........ 16% 4.62M 42s
 30720K ........ ........ ........ ........ ........ ........ 18% 4.89M 40s
 33792K ........ ........ ........ ........ ........ ........ 19% 5.20M 38s
 36864K ........ ........ ........ ........ ........ ........ 21% 5.22M 37s
 39936K ........ ........ ........ ........ ........ ........ 22% 5.23M 35s
 43008K ........ ........ ........ ........ ........ ........ 24% 5.04M 34s
 46080K ........ ........ ........ ........ ........ ........ 26% 4.93M 33s
 49152K ........ ........ ........ ........ ........ ........ 27% 5.25M 32s
 52224K ........ ........ ........ ........ ........ ........ 29% 5.20M 31s
 55296K ........ ........ ........ ........ ........ ........ 31% 4.46M 30s
 58368K ........ ........ ........ ........ ........ ........ 32% 4.51M 29s
 61440K ........ ........ ........ ........ ........ ........ 34% 4.73M 28s
 64512K ........ ........ ........ ........ ........ ........ 36% 5.08M 27s
 67584K ........ ........ ........ ........ ........ ........ 37% 4.54M 27s
 70656K ........ ........ ........ ........ ........ ........ 39% 4.97M 26s
 73728K ........ ........ ........ ........ ........ ........ 40% 4.55M 25s
 76800K ........ ........ ........ ........ ........ ........ 42% 5.14M 24s
 79872K ........ ........ ........ ........ ........ ........ 44% 4.82M 23s
 82944K ........ ........ ........ ........ ........ ........ 45% 3.84M 23s
 86016K ........ ........ ........ ........ ........ ........ 47% 4.04M 22s
 89088K ........ ........ ........ ........ ........ ........ 49% 4.08M 21s
 92160K ........ ........ ........ ........ ........ ........ 50% 4.52M 21s
 95232K ........ ........ ........ ........ ........ ........ 52% 4.30M 20s
 98304K ........ ........ ........ ........ ........ ........ 54% 4.71M 19s
101376K ........ ........ ........ ........ ........ ........ 55% 4.47M 19s
104448K ........ ........ ........ ........ ........ ........ 57% 4.85M 18s
107520K ........ ........ ........ ........ ........ ........ 59% 4.60M 17s
110592K ........ ........ ........ ........ ........ ........ 60% 4.37M 16s
113664K ........ ........ ........ ........ ........ ........ 62% 4.48M 16s
116736K ........ ........ ........ ........ ........ ........ 63% 4.94M 15s
119808K ........ ........ ........ ........ ........ ........ 65% 4.29M 14s
122880K ........ ........ ........ ........ ........ ........ 67% 4.53M 14s
125952K ........ ........ ........ ........ ........ ........ 68% 4.09M 13s
129024K ........ ........ ........ ........ ........ ........ 70% 4.02M 12s
132096K ........ ........ ........ ........ ........ ........ 72% 4.61M 12s
135168K ........ ........ ........ ........ ........ ........ 73% 5.11M 11s
138240K ........ ........ ........ ........ ........ ........ 75% 3.35M 10s
141312K ........ ........ ........ ........ ........ ........ 77% 4.12M 10s
144384K ........ ........ ........ ........ ........ ........ 78% 4.33M 9s
147456K ........ ........ ........ ........ ........ ........ 80% 4.60M 8s
150528K ........ ........ ........ ........ ........ ........ 81% 4.46M 8s
153600K ........ ........ ........ ........ ........ ........ 83% 5.01M 7s
156672K ........ ........ ........ ........ ........ ........ 85% 4.80M 6s
159744K ........ ........ ........ ........ ........ ........ 86% 4.71M 5s
162816K ........ ........ ........ ........ ........ ........ 88% 4.31M 5s
165888K ........ ........ ........ ........ ........ ........ 90% 4.65M 4s
168960K ........ ........ ........ ........ ........ ........ 91% 4.54M 3s
172032K ........ ........ ........ ........ ........ ........ 93% 4.95M 3s
175104K ........ ........ ........ ........ ........ ........ 95% 4.78M 2s
178176K ........ ........ ........ ........ ........ ........ 96% 4.68M 1s
181248K ........ ........ ........ ........ ........ ........ 98% 4.91M 1s
184320K ........ ........ ........ ........ ........ ......  100% 5.11M=41s

2019-01-20 19:04:16 (4.42 MB/s) - ‘jdk-8u201-linux-x64.tar.gz’ saved [191817140/191817140]

Download done.
Removing outdated cached downloads...
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javafxpackager to provide /usr/bin/javafxpackager (javafxpackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javah to provide /usr/bin/javah (javah) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javapackager to provide /usr/bin/javapackager (javapackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmc to provide /usr/bin/jmc (jmc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jvisualvm to provide /usr/bin/jvisualvm (jvisualvm) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
Oracle JDK 8 installed

#####Important########
To set Oracle JDK8 as default, install the "oracle-java8-set-default" package.
E.g.: sudo apt install oracle-java8-set-default
On Ubuntu systems, oracle-java8-set-default is most probably installed
automatically with this package.
######################

Selecting previously unselected package oracle-java8-set-default.
(Reading database ... 185699 files and directories currently installed.)
Preparing to unpack .../oracle-java8-set-default_8u201-1~webupd8~1_all.deb ...
Unpacking oracle-java8-set-default (8u201-1~webupd8~1) ...
Selecting previously unselected package gsfonts-x11.
Preparing to unpack .../gsfonts-x11_0.26_all.deb ...
Unpacking gsfonts-x11 (0.26) ...
Setting up gsfonts-x11 (0.26) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-3ubuntu3) ...
Setting up oracle-java8-set-default (8u201-1~webupd8~1) ...
Processing triggers for shared-mime-info (1.10-1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for fontconfig (2.13.0-5ubuntu3) ...

Perfect! Now let’s add the repos for Cassandra and the keys as well

$ echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
deb http://www.apache.org/dist/cassandra/debian 311x main

and

$ curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  244k  100  244k    0     0   129k      0  0:00:01  0:00:01 --:--:--  129k
OK

Now let’s do an apt-get

$ sudo apt-get update
0% [Working]
Hit:1 http://in.archive.ubuntu.com/ubuntu cosmic InRelease
Get:3 http://in.archive.ubuntu.com/ubuntu cosmic-updates InRelease [83.2 kB]                                                                                                
Hit:4 http://ppa.launchpad.net/webupd8team/java/ubuntu cosmic InRelease                                                                                 
Get:5 http://security.ubuntu.com/ubuntu cosmic-security InRelease [83.2 kB]                                                                             
Get:2 http://dl.bintray.com/apache/cassandra 311x InRelease [3183 B]                                                                           
Get:6 http://in.archive.ubuntu.com/ubuntu cosmic-backports InRelease [74.6 kB]                                        
Get:7 http://dl.bintray.com/apache/cassandra 311x/main amd64 Packages [686 B]                   
Get:8 http://dl.bintray.com/apache/cassandra 311x/main i386 Packages [686 B]
Fetched 246 kB in 2s (124 kB/s)   
Reading package lists... Done

At this point, we should be able to use apt to install Cassandra

$ sudo apt-get install cassandra
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libtinfo5
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libevent-core-2.1-6 libevent-pthreads-2.1-6 libopts25 ntp sntp
Suggested packages:
  cassandra-tools ntp-doc
The following NEW packages will be installed:
  cassandra libevent-core-2.1-6 libevent-pthreads-2.1-6 libopts25 ntp sntp
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 30.7 MB of archives.
After this operation, 42.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 libevent-core-2.1-6 amd64 2.1.8-stable-4build1 [85.9 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 libevent-pthreads-2.1-6 amd64 2.1.8-stable-4build1 [5228 B]
Get:4 http://in.archive.ubuntu.com/ubuntu cosmic/universe amd64 libopts25 amd64 1:5.18.12-4 [58.2 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu cosmic/universe amd64 ntp amd64 1:4.2.8p11+dfsg-1ubuntu1 [662 kB]
Get:2 http://dl.bintray.com/apache/cassandra 311x/main amd64 cassandra all 3.11.3 [29.8 MB]
Get:6 http://in.archive.ubuntu.com/ubuntu cosmic/universe amd64 sntp amd64 1:4.2.8p11+dfsg-1ubuntu1 [64.0 kB]
Fetched 30.7 MB in 15s (2021 kB/s)                                                                                                                                                             
Selecting previously unselected package libevent-core-2.1-6:amd64.
(Reading database ... 185745 files and directories currently installed.)
Preparing to unpack .../0-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb ...
Unpacking libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Selecting previously unselected package libevent-pthreads-2.1-6:amd64.
Preparing to unpack .../1-libevent-pthreads-2.1-6_2.1.8-stable-4build1_amd64.deb ...
Unpacking libevent-pthreads-2.1-6:amd64 (2.1.8-stable-4build1) ...
Selecting previously unselected package libopts25:amd64.
Preparing to unpack .../2-libopts25_1%3a5.18.12-4_amd64.deb ...
Unpacking libopts25:amd64 (1:5.18.12-4) ...
Selecting previously unselected package ntp.
Preparing to unpack .../3-ntp_1%3a4.2.8p11+dfsg-1ubuntu1_amd64.deb ...
Unpacking ntp (1:4.2.8p11+dfsg-1ubuntu1) ...
Selecting previously unselected package sntp.
Preparing to unpack .../4-sntp_1%3a4.2.8p11+dfsg-1ubuntu1_amd64.deb ...
Unpacking sntp (1:4.2.8p11+dfsg-1ubuntu1) ...
Selecting previously unselected package cassandra.
Preparing to unpack .../5-cassandra_3.11.3_all.deb ...
Unpacking cassandra (3.11.3) ...
Setting up cassandra (3.11.3) ...
Adding group `cassandra' (GID 133) ...
Done.
vm.max_map_count = 1048575
net.ipv4.tcp_keepalive_time = 300
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Setting up libevent-pthreads-2.1-6:amd64 (2.1.8-stable-4build1) ...
Processing triggers for libc-bin (2.28-0ubuntu1) ...
Processing triggers for systemd (239-7ubuntu10.6) ...
Setting up libopts25:amd64 (1:5.18.12-4) ...
Processing triggers for man-db (2.8.4-2) ...
Setting up sntp (1:4.2.8p11+dfsg-1ubuntu1) ...
Setting up ntp (1:4.2.8p11+dfsg-1ubuntu1) ...
Created symlink /etc/systemd/system/network-pre.target.wants/ntp-systemd-netif.path → /lib/systemd/system/ntp-systemd-netif.path.
Created symlink /etc/systemd/system/multi-user.target.wants/ntp.service → /lib/systemd/system/ntp.service.
ntp-systemd-netif.service is a disabled or a static unit, not starting it.
Processing triggers for libc-bin (2.28-0ubuntu1) ...
Processing triggers for systemd (239-7ubuntu10.6) ...

Cool! No errors. Let’s check the status of Cassandra

$ sudo service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/init.d/cassandra; generated)
   Active: active (running) since Sun 2019-01-20 19:07:14 IST; 26s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 68 (limit: 4915)
   Memory: 6.2G
   CGroup: /system.slice/cassandra.service
           └─8089 java -Xloggc:/var/log/cassandra/gc.log -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+Alwa

Jan 20 19:07:14 server systemd[1]: Starting LSB: distributed storage system for structured data...
Jan 20 19:07:14 server systemd[1]: Started LSB: distributed storage system for structured data.

Nodetool

$ sudo nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  103.67 KiB  256          100.0%            b40d3433-237e-4412-817e-f1d404aeedfc  rack1

Now, let’s try connecting to the DB

$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.3 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> ?

Documented shell commands:
===========================
CAPTURE  CLS          COPY  DESCRIBE  EXPAND  LOGIN   SERIAL  SOURCE   UNICODE
CLEAR    CONSISTENCY  DESC  EXIT      HELP    PAGING  SHOW    TRACING

CQL help topics:
================
AGGREGATES               CREATE_KEYSPACE           DROP_TRIGGER      TEXT     
ALTER_KEYSPACE           CREATE_MATERIALIZED_VIEW  DROP_TYPE         TIME     
ALTER_MATERIALIZED_VIEW  CREATE_ROLE               DROP_USER         TIMESTAMP
ALTER_TABLE              CREATE_TABLE              FUNCTIONS         TRUNCATE 
ALTER_TYPE               CREATE_TRIGGER            GRANT             TYPES    
ALTER_USER               CREATE_TYPE               INSERT            UPDATE   
APPLY                    CREATE_USER               INSERT_JSON       USE      
ASCII                    DATE                      INT               UUID     
BATCH                    DELETE                    JSON            
BEGIN                    DROP_AGGREGATE            KEYWORDS        
BLOB                     DROP_COLUMNFAMILY         LIST_PERMISSIONS
BOOLEAN                  DROP_FUNCTION             LIST_ROLES      
COUNTER                  DROP_INDEX                LIST_USERS      
CREATE_AGGREGATE         DROP_KEYSPACE             PERMISSIONS     
CREATE_COLUMNFAMILY      DROP_MATERIALIZED_VIEW    REVOKE          
CREATE_FUNCTION          DROP_ROLE                 SELECT          
CREATE_INDEX             DROP_TABLE                SELECT_JSON     

cqlsh> exit

So we now have a local Cassandra running – we are able to connect, read tables and also check the nodetool status!

Let’s create a cluster – in the next post and see if we can get a three node cluster up and running and read/write some data off the tables

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous post Blockchain
Next post List of DevOps Tools