Skip to main content

How to Install Apache Cassandra 3.11.x on Ubuntu 16.04 LTS

How to Install Apache Cassandra 3.11.x on Ubuntu 16.04 LTS

Apache Cassandra is a free and open source NoSQL database management system that is designed to provide scalability, high availability, and uncompromised performance.
In this article will guide you through installing the latest stable release of Apache Cassandra, Apache Cassandra 3.11.2, on a Ubuntu 16.04 LTS server instance.

Step 1: Install OpenJDK JRE 8

Apache Cassandra requires the latest release of Java 8. For that you can choose to install the latest release of OpenJDK JRE 1.8 as below:
sudo apt install openjdk-8-jre -y
Having OpenJDK JRE 1.8 installed, you can confirm the installation result:
java -version
The output will be similar to the following:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
Optionally, you can create the JAVA_HOME environment variable as follows:
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
echo $JAVA_HOME

Step 2: Install Python 2.7, if it's missing on your system

Apache Cassandra requires Python 2.7 rather than Python 3. If you operate Apache Cassandra in a Python 3 environment, you may have trouble launching the cqlsh shell of Apache Cassandra.
First, determine the existence and version of Python on your machine:
python -V
On Ubuntu 16.04 LTS, the output can be slightly confusing:
The program 'python' can be found in the following packages:
* python-minimal
* python3
Ask your administrator to install one of them
That actually means you need to install Python 2.7 by yourself:
sudo apt install python -y
Re-run the python -V command, and the output will become:
Python 2.7.12

Step 3: Install the latest stable release of Apache Cassandra

Create the Apache Cassandra 3.11.x apt repo:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
If you encounter a GPG public key error, run the following commands to add the mentioned Apache Cassandra public key, which is A278B781FE4B2BDA in this case:
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
sudo apt-get update
Use the newly added apt repo to install Apache Cassandra:
sudo apt-get install cassandra

Step 4: Test the installation of Apache Cassandra

Start the Apache Cassandra daemon:
sudo service cassandra start
If you want to make Apache Cassandra automatically start at system boot, run the following command:
sudo update-rc.d cassandra defaults
Next, use the nodetool program to show the status of Apache Cassandra on current node:
nodetool status
The output will resemble the following:
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  102.66 KiB  256          100.0%            23916cfd-892d-4898-857c-aff9efe2354a  rack1
You can use the cqlsh shell to interact with Apache Cassandra:
cqlsh localhost
The output will be similar to the following:
Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>
For now, just type exit and then press ENTER to quit the cqlsh shell.
If you want to stop Apache Cassandra, execute the following command:
sudo service cassandra stop

Comments

Popular posts from this blog

How to Install MongoDB on Ubuntu 16.04

How to Install MongoDB on Ubuntu 16.04                                         MongoDB is an open source database management system (DBMS)  that uses a  document-oriented database model which supports various forms of data. Step 1: Adding the MongoDB Repository       MongoDB is already included in Ubuntu package repositories, but the official MongoDB repository  provides most up-to-date version and is the recommended way of installing the software. In this step,  we will add this official repository to our server. Ubuntu ensures the authenticity of software packages by verifying that they are signed with GPG keys,  so we first have to import they key for the official MongoDB repository. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 After successfully importing the key, you will see: gpg: ...

Loopback - Create datasource and model for Cassandra

Loopback 3.0- Create datasource and model for Cassandra Pre-Installed:-                           Loopback 3.0 and cassandra  Step 1: Creating a Keyspace using Cqlsh cqlsh.> CREATE KEYSPACE test WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3}; cqlsh> DESCRIBE keyspaces; test system system_traces Step 2: Creating a table using Cqlsh cqlsh> USE test; cqlsh:test>; CREATE TABLE pullcassandra( id text PRIMARY KEY emp_id text, emp_name text, emp_city text, emp_sal text, emp_phone text, ); "id" - for store the object key which is generated by loopback  Step 3: Creating a datasouce In your application root directory, enter this command to install the connector: npm install loopback-connector-cassandra --save $ lb datasource ? Enter the data-source name: mycass ? Select the connector for mycass: Cassandra (s...

Hbase installation on ubuntu

Hbase installation on ubuntu In this tutorial we will see how to install Hbase on ubuntu 16.04 by doing the following steps Step 1: Before installing Hbase, you need to First ensure that java8 is installed: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Verify that java is correctly installed: java -version       Configuring Java Environment sudo apt-get install oracle-java8-set-default    Step 2: Ensure that you successfully installed hadoop on your machine  Check this link if you need to know how to install it.  Step 3: Download Apache Hbase Go to downloads page Choose hbase file: hbase-1.2.5-bin.tar.gz Step 4: Complete the installation process Move the downloaded file “ hbase-1.2.5-bin.tar.gz ” to your home (~) Compress it :  tar -zxvf hbase-1.2.5-bin.tar.gz Edit hbase-env.sh using this co...