• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How Install Apache Cassandra on Ubuntu (Single Cloud Server Instance)

By Abhishek Ghosh July 27, 2018 9:52 am Updated on July 27, 2018

How Install Apache Cassandra on Ubuntu (Single Cloud Server Instance)

Advertisement

Apache Cassandra is a wide column store NoSQL database management system. Cassandra provides high availability with no single point of failure, robust support for clusters spanning multiple datacenters. Facebook released Cassandra for Facebook inbox search feature. Main features of Apache Cassandra is it is – Distributed, Replication strategies are configurable, Scalable, Fault-tolerant, Has tunable consistency, Provides MapReduce support. Cassandra is a Java-based which can be managed and monitored via Java Management Extensions (JMX). Cassandra uses the Cassandra Query Language (CQL). Which is a simple interface for accessing Cassandra, alternative to the traditional Structured Query Language (SQL). Cassandra Query Language (CQL) provides an abstraction layer and provides native syntax. Example usage :

Vim
1
2
3
4
5
6
7
USE ExampleKeySpace;
 
CREATE COLUMNFAMILY ExampleColumns (id text, Last text, First text, PRIMARY KEY(id));
 
INSERT INTO ExampleColumns (id, Last, First) VALUES ('1', 'Doe', 'John');
 
SELECT * FROM ExampleColumns;

Here Are the Steps on How Install Apache Cassandra on Ubuntu Single Cloud Server Instance. In this guide, we are helping you to go through installing Apache Cassandra, Apache Cassandra on a Ubuntu 16.04 LTS server instance. Commands for Ubuntu 18.04 LTS will be similar. You need a server instance with at least 4GB of memory. Insufficient memory will cause Apache Cassandra to exit. We will install Java on Ubuntu 16.04, then install Apache Cassandra and test Apache Cassandra installation.

How Install Apache Cassandra on Ubuntu

 

Steps on How Install Apache Cassandra on Ubuntu

 

We will install Java 8 from the PPA repository. We have to install python-software-properties package :

Advertisement

---

Vim
1
2
3
4
5
apt update -y && apt upgrade -y
apt install python-software-properties -y
add-apt-repository -y ppa:webupd8team/java
## accept the prompt
apt update -y && apt upgrade -y

You have two options for Java.

Option 1 for Java : Oracle Java from repository

Now you can install Java 8 :

Vim
1
apt install oracle-java8-installer -y

Accept the ‘Oracle license terms’ prompt. Verify that Java is now installed :

Vim
1
java -version

Option 2 for Java : OpenJDK JRE (easy)

Optionally, you could install OpenJDK JRE :

Vim
1
apt install openjdk-8-jre -y

Common Steps

You can create the JAVA_HOME environment variable with the following commands, $JAVA_HOME path must match :

Vim
1
2
3
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
echo $JAVA_HOME

Python

Apache Cassandra may requires Python 2.7 (rather than Python 3). Check the existence and version of Python on your machine:

Vim
1
python -v

You probably need to install Python 2.7 by running :

Vim
1
sudo apt install python -y

Installing Apache Cassandra

From official site, you’ll get the latest binary of Apache Cassandra as tar ball:

Vim
1
http://cassandra.apache.org/download/

Current is Apache Cassandra 3.11 release. For 3.11, we can install from repository :

Vim
1
2
3
4
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 -
apt update -y && apt upgrade -y
apt install cassandra -y

Apache Cassandra’s Debian releases are these :

Vim
1
http://dl.bintray.com/apache/cassandra/

You can change our command shown above :

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

…to latest one, with presently imaginary version 3.12 :

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

If you get GPG public key error, run the following commands (for 311x in our example) :

Vim
1
2
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
sudo apt-get update

Then run the commands :

Vim
1
2
3
4
apt update -y && apt upgrade -y
apt install cassandra -y
## install ntp for correct time of sync in future with other nodes
apt install ntp -y

Start the Apache Cassandra daemon:

Vim
1
sudo service cassandra start

Make Apache Cassandra automatically start at system boot:

Vim
1
2
sudo update-rc.d cassandra defaults
# systemctl enable cassandra

Get the status of Apache Cassandra on current node:

Vim
1
nodetool status

You can use the cqlsh shell to interact with Apache Cassandra:

Vim
1
cqlsh localhost

The cqlsh is the command-line tool written in Python for executing the Cassandra Query Language (CQL) command.
Simply running the cqlsh command launches it :

Vim
1
cqlsh

Make a backup of the Cassandra configuration file cassandra.yaml. Find the file on Ubuntu with (taing that locate program is installed) :

Vim
1
2
sudo updatedb
locate cassandra.yaml

If it is located at /etc/cassandra/cassandra.yaml, then run :

Vim
1
2
cp /etc/cassandra/cassandra.yaml /etc/cassandra/cassandra.yaml.backup
nano /etc/cassandra/cassandra.yaml

Match the following variables in the file to the values shown below. Properties found in the cassandra.yaml config file should be set based on your project’s particular requirements :

Vim
1
2
3
4
5
6
7
...
authenticator: org.apache.cassandra.auth.PasswordAuthenticator
authorizer: org.apache.cassandra.auth.CassandraAuthorizer
role_manager: CassandraRoleManager
roles_validity_in_ms: 0
permissions_validity_in_ms: 0
...

Open the Cassandra command terminal by typing cqlsh :

Vim
1
cqlsh -u cassandra -p cassandra

Create a new superuser, change example [new_superuser], [secure_password] with real information :

Vim
1
CREATE ROLE [new_superuser] WITH PASSWORD = '[secure_password]' AND SUPERUSER = true AND LOGIN = true;

Log back as new superuser like MySQL and run:

Vim
1
ALTER ROLE cassandra WITH PASSWORD = 'cassandra' AND SUPERUSER = false AND LOGIN = false;

And…

Vim
1
REVOKE ALL PERMISSIONS ON ALL KEYSPACES FROM cassandra;

Grant all permissions to the new superuser account. Replace [superuser] with your real superuser account username:

Vim
1
GRANT ALL PERMISSIONS ON ALL KEYSPACES TO [superuser];

Create cqlshrc file. If the ~/.cassandra directory does not exist, create it:

Vim
1
2
sudo mkdir ~/.cassandra
sudo nano ~/.cassandra/cqlshrc

You’ll get information on cqlshrc here :

Vim
1
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlshUsingCqlshrc.html

This is sample cqlshrc from CentOS :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;; Options that are common to both COPY TO and COPY FROM
 
[copy]
;; The string placeholder for null values
nullval=null
;; For COPY TO, controls whether the first line in the CSV output file will
;; contain the column names.  For COPY FROM, specifies whether the first
;; line in the CSV file contains column names.
header=true
;; The string literal format for boolean values
boolstyle = True,False
;; Input login credentials here to automatically login to the Cassandra command line without entering them each time. When this
;; is enabled, just type "cqlsh" to start Cassandra.
[authentication]
username=[superuser]
password=[password]
 
;; Uncomment to automatically use a certain keyspace on login
;; keyspace=[keyspace]
 
[ui]
color=on
datetimeformat=%Y-%m-%d %H:%M:%S%z
completekey=tab
;; The number of digits displayed after the decimal point
;; (note that increasing this to large numbers can result in unusual values)
float_precision = 5
;; The encoding used for characters
encoding = utf8

Save and close the file. Change permissions:

Vim
1
2
sudo chmod 1700 ~/.cassandra/cqlshrc
sudo chmod 700 ~/.cassandra

Login to cqlsh. Replace [example_name] with your new cluster name:

Vim
1
UPDATE system.local SET cluster_name = '[example_name]' WHERE KEY = 'local';

Open the cassandra.yaml file and replace the value in the cluster_name variable with the new cluster name you just set with above command :

Vim
1
nano /etc/cassandra/cassandra.yaml

Save changes. Run this command and reboot the instance :

Vim
1
2
nodetool flush system
reboot

We guess, you have successfully installed Apache Cassandra. You understood that guides by many websites are weak at point of security even for testing purpose. Cassandra is like MySQL. Most of the DBMS are like MySQL. They needs to be tweaked, secured.

You’ll get detailed documents on official website :

Vim
1
http://cassandra.apache.org/doc/latest/

Tagged With apache cassandra , can i install casandra in cloud , install apache cassandra on ubuntu shell on windows
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How Install Apache Cassandra on Ubuntu (Single Cloud Server Instance)

  • Install Elastic Stack on Ubuntu 16.04, CentOS 7 Single Cloud Server

    Here is How to Install Elastic Stack on Ubuntu 16.04, CentOS 7 on Single Cloud Server Instance For Server Log Analysis, Big Data Processing.

  • Apache Cassandra vs Apache HBase

    Cassandra and HBase are similar at many things but Cassandra’s consistency model is like DynamoDB to provide eventual consistency.

  • Apache Cassandra Versus Apache Phoenix

    In our previous discussions, we have compared Apache Cassandra with Apache Hbase and Apache Cassandra with MongoDB. In one of those articles, we already mentioned that Apache Cassandra is more appropriate to compare with Apache Phoenix than Apache HBase. Also, it will make understand why commonly HBase is compared with Apache Cassandra, not Apache Phoenix. […]

  • How To Install Apache HBase : Ubuntu Single Cloud Server Instance

    Here is Step By Step Guide On How To Install Apache HBase On Ubuntu Single Cloud Server Instance. Hbase is column-oriented distributed datastore,

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy