How to Install Apache Cassandra on Linux Mint 18.3
To Install Apache Cassandra on Linux Mint 18.3
Cassandra is one of the most popular distributed NoSQL databases from Apache which is known for its scalability, performance and its high availability with no single point of failure. It is so simple to install Apache Cassandra on Linux Mint 18.3 and this tutorial covers the ground on the same process.
Installing Apache Cassandra
Installing java
To install Cassandra on Linux Mint we must install Java first. Since Java might not be installed by default, verify it by using the following command.
linuxhelp ~ # java -version
The program ' java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: apt install < selected package>
If Java is not installed in your system, you can do it easily, but first you need to add repository.
linuxhelp ~ # add-apt-repository ppa:webupd8team/java
You are about to add the following PPA:
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). 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
Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.
.
.
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: public key " Launchpad VLC" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Once it is done, you need to update the system repo package by making use of the following command.
linuxhelp ~ # apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Get:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17.5 kB]
Ign:3 http://packages.linuxmint.com sylvia InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:5 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main Sources [1,408 B]
.
.
Get:27 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6,624 B]
Get:28 http://archive.ubuntu.com/ubuntu xenial-backports/universe i386 Packages [6,616 B]
Get:29 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [121 kB]
Fetched 5,322 kB in 8s (664 kB/s)
Reading package lists... Done
And then, you need to install the Oracle Java8 installer using the following command.
linuxhelp ~ # apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho
ttf-arphic-uming
Recommended packages:
gsfonts-x11 oracle-java8-set-default
The following NEW packages will be installed:
.
.
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
Installing Cassandra
Now, that Java has been installed, we shall proceed with the installation of Cassandra. So, for Cassandra, you need to add the repository to the Source list as follows.
linuxhelp ~ # 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 then add apache Cassandra repository keys as follows.
linuxhelp ~ # 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 48041 0 0:00:05 0:00:05 --:--:-- 71783
OK
Also, you need to update the repo list by making use of the following command.
linuxhelp ~ # apt-get update
Hit:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Hit:2 http://archive.canonical.com/ubuntu xenial InRelease
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
Ign:4 http://packages.linuxmint.com sylvia InRelease
Hit:6 http://packages.linuxmint.com sylvia Release
Get:5 http://dl.bintray.com/apache/cassandra 311x InRelease [3,169 B]
Get:8 http://dl.bintray.com/apache/cassandra 311x/main amd64 Packages [684 B]
Get:9 http://dl.bintray.com/apache/cassandra 311x/main i386 Packages [684 B]
Hit:10 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:11 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:12 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 4,537 B in 13s (326 B/s)
Reading package lists... Done
Finally install Cassandra by making use of the following.
linuxhelp ~ # apt-get install cassandra
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
cassandra-tools
The following NEW packages will be installed:
Cassandra
.
.
net.ipv4.tcp_keepalive_time = 300
update-rc.d: warning: start and stop actions are no longer supported falling back to defaults
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
We can now check if Cassandra is up and running on our machine
linuxhelp ~ # service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra bad vendor preset: enabled)
Active: active (running) since Tue 2018-03-06 22:14:29 IST 29s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/cassandra.service
└─9007 java -Xloggc:/var/log/cassandra/gc.log -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -XX:+HeapDumpOnOutOfMemoryErro
Mar 06 22:14:29 linuxhelp systemd[1]: Starting LSB: distributed storage system for structured data...
Mar 06 22:14:29 linuxhelp systemd[1]: Started LSB: distributed storage system for structured data.
Connecting to Cassandra cluster
Cassandra will start automatically once the installation process is complete. It is a distributed database and so, it doesn’ t work as a single system but instead, it works in a cluster which can consist of virtually any number of nodes. When Cassandra starts on our machine, it set up a cluster automatically with a single node as part of it. We can check if the cluster is up using this command:
linuxhelp ~ # 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.7 KiB 256 100.0% 4400685f-8f62-4bbb-89f5-cba8b2db9f1b rack1
If we see UN in our output, this means that Cluster is Up and Running:
linuxhelp ~ # cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>
Once you run this, we will see that we can now execute Cassandra commands on our machine and create related data.
Comments ( 0 )
No comments available