- Installing Cassandra
- Prerequisites
- Choosing an installation method
- Installing the docker image
- Installing the binary tarball
- Installing the Debian packages
- Installing the RPM packages
- Further installation info
Installing Cassandra
These are the instructions for deploying the supported releases of Apache Cassandra on Linux servers. Cassandra runs on a wide array of Linux distributions including (but not limited to): - Ubuntu, most notably LTS releases 16.04 to 18.04
- CentOS & RedHat Enterprise Linux (RHEL) including 6.6 to 7.7
- Amazon Linux AMIs including 2016.09 through to Linux 2
- Debian versions 8 & 9
- SUSE Enterprise Linux 12
This is not an exhaustive list of operating system platforms, nor is it prescriptive. However, users will be well-advised to conduct exhaustive tests of their own particularly for less-popular distributions of Linux. Deploying on older versions is not recommended unless you have previous experience with the older distribution in a production environment.
Prerequisites
- Oracle Java Standard Edition 8 / Oracle Java Standard Edition 11 (Long Term Support) or OpenJDK 8 / OpenJDK 11. To verify that you have the correct version of java installed, type
java -version. - NOTE: Experimental support for Java 11 was added in Cassandra 4.0 (CASSANDRA-9608). Full support is effective Cassandra 4.0.2 version (CASSANDRA-16894) For more information, see NEWS.txt.
python --version.Choosing an installation method
There are three methods of installing Cassandra that are common:- Docker image
- Tarball binary file
- Package installation (RPM, YUM)
dockerinstalled on Linux. Pull the appropriate image and then start Cassandra with a run command.rootpermissions and can be installed on any Linux distribution.rootpermissions, and are most appropriate for production installs. Install the RPM build on CentOS and RHEL-based distributions if you want to install Cassandra using YUM. Install the Debian build on Ubuntu and other Debian-based distributions if you want to install Cassandra using APT. Note that both the YUM and APT methods requiredrootpermissions and will install the binaries and configuration files as thecassandraOS user.Installing the docker image
1.docker pull cassandra:latest
docker pullcommand will get the latest version of the ‘Docker Official’ Apache Cassandra image available from the Dockerhub.
docker runcommand:docker run --name cass_cluster cassandra:latest
--nameoption will be the name of the Cassandra cluster created.cqlshto interact with the Cassandra node created:docker exec -it cass_cluster cqlsh
Installing the binary tarball
1.
- Command
- Result
$ java -version
openjdk version "1.8.0_222"OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
- Apache Cassandra Download site. For example, to download Cassandra 4.0:
$ curl -OL http://apache.mirror.digitalpacific.com.au/cassandra/4.0.0/apache-cassandra-4.0.0-bin.tar.gz
- here. For example, to verify the hash of the downloaded file using GPG:
- Command
- Result
$ gpg --print-md SHA256 apache-cassandra-4.0.0-bin.tar.gz
Compare the signature with the SHA256 file from the Downloads site:apache-cassandra-4.0.0-bin.tar.gz: 28757DDE 589F7041 0F9A6A95 C39EE7E6 CDE63440 E2B06B91 AE6B2006 14FA364D
- Command
- Result
$ curl -L https://downloads.apache.org/cassandra/4.0.0/apache-cassandra-4.0.0-bin.tar.gz.sha256
1.28757dde589f70410f9a6a95c39ee7e6cde63440e2b06b91ae6b200614fa364d
$ tar xzvf apache-cassandra-4.0.0-bin.tar.gz
apache-cassandra-4.0.0/directory. This is the tarball installation location. 1.
Configuring Cassandra. 1.<tarball_installation>/ bin/ (1) conf/ (2) data/ (3) doc/ interface/ javadoc/ lib/ logs/ (4) pylib/ tools/ (5)
1.$ cd apache-cassandra-4.0.0/ && bin/cassandra
- Command
- Result
$ tail -f logs/system.log
system.log:
You can monitor the progress of the startup with:INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
- Command
- Result
$ tail -f logs/system.log
system.log:
1.INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
$ bin/nodetool status
UNwhich stands for “Up/Normal”. Alternatively, connect to the database with:$ bin/cqlsh
Installing the Debian packages
1. - Command
- Result
$ java -version
openjdk version "1.8.0_222"OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
cassandra.sources.list. The latest major version is {41_version} and the corresponding distribution name is41x(with an “x” as the suffix). For older releases use:
41xfor C* {41_version} series40xfor C* 4.0 series311xfor C* {311_version} series30xfor C* {30_version} series41x):
1.$ echo "deb [signed-by=/etc/apt/keyrings/apache-cassandra.asc] https://debian.cassandra.apache.org 41x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.listdeb https://debian.cassandra.apache.org 41x main
- Command
- Result
$ curl -o /etc/apt/keyrings/apache-cassandra.asc https://downloads.apache.org/cassandra/KEYS
1.% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 266k 100 266k 0 0 320k 0 --:--:-- --:--:-- --:--:-- 320kOK
1.$ sudo apt-get update
1.$ sudo apt-get install cassandra
- Command
- Result
$ tail -f logs/system.log
system.log:
1.INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
$ nodetool status
UNwhich stands for “Up/Normal”. Alternatively, connect to the database with:$ cqlsh
Installing the RPM packages
1. - Command
- Result
$ java -version
openjdk version "1.8.0_222"OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
/etc/yum.repos.d/cassandra.repo(as therootuser). The latest major version is {41_version} and the corresponding distribution name is41x(with an “x” as the suffix). For older releases use:
41xfor C* {41_version} series40xfor C* 4.0 series311xfor C* {311_version} series30xfor C* {30_version} series41x):
1.[cassandra]name=Apache Cassandrabaseurl=https://redhat.cassandra.apache.org/41x/gpgcheck=1repo_gpgcheck=1gpgkey=https://downloads.apache.org/cassandra/KEYS
1.$ sudo yum update
1.$ sudo yum install cassandra
1.$ sudo service cassandra start
- Command
- Result
$ tail -f logs/system.log
system.log:
1.INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
$ nodetool status
UNwhich stands for “Up/Normal”. Alternatively, connect to the database with:$ cqlsh
Further installation info
Troubleshooting section.
