$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
Install Cassandra 4 on Ubuntu 20.04
Upasana | July 27, 2020 | 3 min read | 118 views
Apache Cassandra 4 beta came out just few days ago. In this article we wil explore how to install Cassandra on Ubuntu 20 server.
Prerequisites
-
Ubuntu 18+ with sudo permissions
-
Java 11 or latest version of Java 8
-
Python 3.6+ for cqlsh
Installing the Debian packages
-
Check you have the correct version of Java installed on your system using below command:
-
Add the Apache repository of Cassandra to the file cassandra.sources.list. The latest major version is 4.0 and the corresponding distribution name is 40x (with an “x” as the suffix)
echo "deb http://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
-
Add the Apache Cassandra repository keys to the list of trusted keys on the server:
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
-
Update the packages index using below command
sudo apt-get update
-
Install Apache Cassandra with APT
sudo apt-get install cassandra
This will install cassandra and run it using a new linux user
cassandra
. -
Check Status using nodetool
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 72.57 KiB 256 ? 016c0c52-be2f-4f45-9956-be699db50701 rack1
-
Install location:
Installation directorycd /etc/cassandra
Check logstail -f /var/log/cassandra/system.log
-
cqlsh client
$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 4.0 | CQL spec 3.4.5 | Native protocol v4] Use HELP for help. cqlsh>
Installing from binary tarball
-
Check you have the correct version of Java installed on your system using below command:
$ java -version openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04) OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
-
Download the latest version of Apache Cassandra
$ curl -OL http://apachemirror.wuchna.com/cassandra/4.0-beta1/apache-cassandra-4.0-beta1-bin.tar.gz
-
Extract the tarball
$ tar xzvf apache-cassandra-4.0-beta1-bin.tar.gz
The files will be extracted to the
apache-cassandra-4.0-beta1
directory. This is the tarball installation location. -
Start the server
$ cd apache-cassandra-4.0-beta1 $ bin/cassandra
This will start Cassandra with the default configuration using the authenticated linux user.
-
Check logs
$ tail -200f logs/system.log
-
Check status of Cassandra
$ bin/nodetool status
-
Configuration
Tune memory configuration:
$ vi conf/jvm-server.options
conf/jvm-server.options# It is recommended to set min (-Xms) and max (-Xmx) heap sizes to # the same value to avoid stop-the-world GC pauses during resize, and # so that we can lock the heap in memory on startup to prevent any # of it from being swapped out. -Xms1G -Xmx1G
Uncomment and modify Xms and Xmx to appropriate value.
Top articles in this category:
- Install ElasticSearch 7 on Ubuntu 20.04
- Install & configure Redis on Ubuntu
- Upgrade Jenkins on Ubuntu 18.04 LTS
- Install OpenJDK 11 on Ubuntu 18.04 LTS
- Install RabbitMQ and Erlang 23 on Ubuntu 20
- MySql 8 installation on Ubuntu 20
- Upgrade MySQL from 5.7 to 8 on Ubuntu 18.04