Sunday, April 17, 2016

How To Install Cassandra and Run a Single-Node Cluster on Ubuntu 14.04

Prerequisite

To complete this tutorial, you will need the following:


Step 1 — Installing the Oracle Java Virtual Machine
Cassandra requires that the Oracle Java SE Runtime Environment (JRE) be installed. So, in this step, you'll install and verify that it's the default JRE.

To make the Oracle JRE package available, you'll have to add a Personal Package Archives (PPA) using this command:

$sudo add-apt-repository ppa:webupd8team/java
 

Update the package database:

$sudo apt-get update

Then install the Oracle JRE. Installing this particular package not only installs it but also makes it the default JRE. When prompted, accept the license agreement:

$sudo apt-get install oracle-java8-set-default
 

After installing it, verify that it's now the default JRE:

java -version
You should see output similar to the following:

Output
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


Step 2 — Installing Cassandra
$echo "deb http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
The add the repo's source:

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

To avoid package signature warnings during package updates, we need to add three public keys from the Apache Software Foundation associated with the package repositories.

Add the first one using this pair of commands, which must be run one after the other:

$gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
$gpg --export --armor F758CE318D77295D | sudo apt-key add -


Then add the second key:

$gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
$gpg --export --armor 2B5C1B00 | sudo apt-key add -

Then add the third:

$gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
$gpg --export --armor 0353B12C | sudo apt-key add -


Update the package database once again:

$sudo apt-get update


Finally, install Cassandra:

$sudo apt-get install cassandra

Step 3 — Troubleshooting and Starting Cassandra

$sudo service cassandra status


Output
* could not access pidfile for Cassandra



$sudo nano +60 /etc/init.d/cassandra


That line should read:

/etc/init.d/cassandra
 

CMD_PATT="cassandra.+CassandraDaemon"
 

Change it to:

/etc/init.d/cassandra

CMD_PATT="cassandra"
 

Close and save the file, then reboot the server:

$sudo reboot
 

Or:

$sudo shutdown -r now
 

After logging back in, Cassandra should now be running. Verify:

$sudo service cassandra status
 

If you are successful, you will see:

Output
* Cassandra is running


Step 4 — Connecting to the Cluster

$sudo nodetool status


Output
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns    Host ID                               Rack
UN  127.0.0.1  142.02 KB  256          ?       2053956d-7461-41e6-8dd2-0af59436f736  rack1

Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless


Then connect to it using its interactive command line interface cqlsh.

$cqlsh

You will see it connect:

Output
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.2 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh>
Type exit to quit:

cqlsh>exit

             

Reference From "DigitalOcean"

 

                                      Thanks&Regards,

                                      Bhargava Batchu.

 

1 comment:

  1. You are doing a great job by sharing useful information about Apache Spark course. It is one of the post to read and improve my knowledge in Apache Spark.You can check our Cassandra installation prerequisites, tutorial for more information about Cassandra cluster ubuntu setup.

    ReplyDelete

Update GitLab (Omnibus based installations)

Welcome To My Blog Cash Back Shopping. Get Deals & Save Money Shop AT Ebates Try for Free!!!!                                      ...