• 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

This Article Has Been Shared 131 Times!

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 Apache SystemML Machine Learning System on Ubuntu

    Here is How To Install Apache SystemML Machine Learning System on Ubuntu 16.04. SystemML needs a minimum guidance to get started to use it.

  • Theoretical Foundations of Big Data : Part 2

    Theoretical Foundations of Big Data is second part of our series of articles. We have talked about data privacy & basics of data warehouse.

  • How To Process Healthcare Data in Hadoop, Pig (IBM Demo Cloud)

    Here is Basic Commends Showing How To Process Healthcare Data in Hadoop, Pig Using IBM Demo Cloud. Unlike server log, healthcare data lacks universal format.

  • How to Install Apache Tika on Ubuntu Server

    Apache Tika is a Content Analysis Framework Which Can Be Configure With Web Software Like WordPress For Metadata Extraction of PDF, doc. Here is How to Install Apache Tika on Ubuntu Server.

  • What is GPU Computing OR General Purpose Computing on GPU?

    What is GPU Computing OR General Purpose Computing on GPU? GPU is designed for 3D graphics computations but we can use the power in scientific fields.

Additionally, 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

  • What is an Automatic Ethanol Fireplace February 8, 2023
  • Disadvantages of Cloud-Native Computing February 7, 2023
  • Projector Screen Basics February 6, 2023
  • What is Configuration Management February 5, 2023
  • What is ChatGPT? February 3, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How Install Apache Cassandra on Ubuntu (Single Cloud Server Instance)," in The Customize Windows, July 27, 2018, February 8, 2023, https://thecustomizewindows.com/2018/07/how-install-apache-cassandra-on-ubuntu-single-cloud-server-instance/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT