Cassandra NoSQL Database Installation (Unix / Linux) - 8.0.6.1019 version

Below you will find the process for installing a Cassandra NoSQL database for TestRail Server installations on Unix or Linux servers that use TestRail 7.4 or later.

Prerequisites

In order to install the Cassandra database, you have to install some required components:

  1. Open JDK 8
  2. C++ driver
  3. Cassandra driver for TestRail installation operating system

The following steps are an example of an Ubuntu 20.04 installation:

1. Install JDK 8

Install Java version 8 using the following command:

$ apt-get install openjdk-8-jdk -y

 

If you are installing on a RedHat-based distribution, the package is called java-1.8.0-openjdk

Once the installation is completed, verify the installed version of Java with the following command:

$ java -version

The JDK is successfully installed if java -version outputs something like this:

Openjdk version “1.8.0_312”
OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
OpenJDK 64-bit Server VM (build 25.312-b07, mixed mode)

2. Install C++ driver

C++ driver is needed for Linux TestRail platforms since the Cassandra driver won’t run without it.

Ubuntu Distribution

Download the multiarch-support package:

$ wget http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.6_amd64.deb

Install the package.

$ dpkg -i multiarch-support_2.27-3ubuntu1.6_amd64.deb

Now download the C++ driver.

$ wget https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver_2.16.0-1_amd64.deb

Run this command to install it.

$ dpkg -i cassandra-cpp-driver_2.16.0-1_amd64.deb

RedHat-based Distribution

Download the multiarch-support package.

$ wget https://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.35.0/libuv-1.35.0-1.el7.x86_64.rpm

Install the package.

$ rpm -i libuv-1.35.0-1.el7.x86_64.rpm

Now download the C++ driver.

$ wget https://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.16.0/cassandra-cpp-driver-2.16.0-1.el7.x86_64.rpm

Run this command to install it.

$ rpm -i cassandra-cpp-driver-2.16.0-1.el7.x86_64.rpm

3. Cassandra driver for TestRail

Download the driver for Linux from https://idera.egnyte.com/dl/itHrjRWrSG.

Make sure the file is in the php extension directory. You can find the location of the 'extension_dir' folder by entering the following command.

$ php -i | grep ^extension_dir

Copy the file cassandra.so to the extension_dir folder.

$ cp cassandra.so /usr/lib/php/20210902/

Using an MD5 tool such as md5sum, verify that the MD5 checksum of this file is:

a151c2a7146d56c16236baa8cc1e9134

It should return something similar to this:

$ /usr/lib/php/20210902# md5sum cassandra.so
a151c2a7146d56c16236baa8cc1e9134 cassandra.so

Enable the extension inside the php.ini by adding the following line to the file.

extension=cassandra

You can confirm the extension is available by writing the following command.

$ php -m

Here is a typical phpinfo page that lists all the required php extensions including cassandra.

If cassandra does not load correctly, you can verify that the driver has all of its dependencies available by running the following command from the extension directory, or use the full path of 'cassandra.so' file.

ldd cassandra.so

Here is an example of a correct output:

linux-vdso.so.1 (0x00007ffe7fdf8000)
libcassandra.so.2 => /lib/x86_64-linux-gnu/libcassandra.so.2 (0x00007f037a800000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f037ad2e000)
libuv.so.1 => /lib/x86_64-linux-gnu/libuv.so.1 (0x00007f037acfc000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f037a77e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f037a556000)
libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f037a200000)
libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f0379c00000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f037acde000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f03799d6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f037acbe000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f037acb9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f037ae9a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f037acb2000)

In case the C++ Driver is missing, you will get an incorrect output. For example:

linux-vdso.so.1 (0x00007ffcc7ffd000)
libcassandra.so.2 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0574a3e000)
libuv.so.1 => /lib/x86_64-linux-gnu/libuv.so.1 (0x00007f0574a0c000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f057498a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0574762000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0574ba9000)

Install Apache Cassandra

The following steps are an example of an Ubuntu 22.04 installation, if you are installing on a RedHat-based distribution, follow the instructions in DataStax Documentation.

 

Currently, Cassandra 3.11 is the ONLY supported Cassandra version for Server installations.

Install the required dependencies with the following command:

$ apt-get install apt-transport-https gnupg2 -y

Download and add the GPG key with the following command:

$ curl -fsSL https://www.apache.org/dist/cassandra/KEYS | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/cassandra.gpg > /dev/null

Wait for the OK response, it may take a few seconds. Next, add the Cassandra repository to the APT with the following command:

$ sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'

Update the repository cache:

$ apt-get update -y

Install Apache Cassandra.

$ apt-get install cassandra -y

Make sure you have a cassandra-lucene-index-plugin-*.jar installed in your Cassandra Home lib directory. (Usually the path is /usr/share/cassandra/lib). This .jar file should have the version number of your Cassandra installation.

If you don’t, you can download the .jar file from the official maven repository.

$ wget https://repo1.maven.org/maven2/com/stratio/cassandra/cassandra-lucene-index-plugin/3.11.3.0/cassandra-lucene-index-plugin-3.11.3.0.jar

Copy the file to the Home lib directory.

$ cp cassandra-lucene-index-plugin-3.11.3.0.jar /usr/share/cassandra/lib

Restart Cassandra.

$ service cassandra restart

Now you are ready to connect to Cassandra for the first time. Type:

cqlsh

Or, if the previous command does not work for you, you can type: 

cqlsh -u cassandra -p cassandra

You should get the following output:

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.11 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

To install TestRail, it is necessary to create a Cassandra keyspace. Create one running the following CQL query:

CREATE KEYSPACE IF NOT EXISTS testrail WITH REPLICATION={'class': 'SimpleStrategy', 'replication_factor': 1};

This installation of Cassandra uses ‘cassandra’ as user and ‘cassandra’ as password. If you want to create a new user, you must edit the cassandra.yaml file on your terminal:

Edit the file by making changes to the authenticator and authorizer directives. Comment the line “authenticator: AllowAllAuthenticator” and add the following line, so it looks like this:

#authenticator: AllowAllAuthenticator
authenticator: org.apache.cassandra.auth.PasswordAuthenticator

Next comment on the line authorizer: “AllowAllAuthorizer” and add the following line so it looks like this:

#authorizer: AllowAllAuthorizer
authorizer: org.apache.cassandra.auth.CassandraAuthorizer

Then, restart Cassandra.

$ service cassandra restart

Connect to Cassandra using the default user and password.

$ cqlsh -u cassandra -p cassandra

Then, create a Cassandra TestRail user and password.

cassandra@cqlsh> create user 'username' with password 'password';

Grant all privileges to the TestRail user.

cassandra@cqlsh> GRANT ALL ON KEYSPACE testrail to 'testrail';

You can then exit Cassandra.

Was this article helpful?
0 out of 0 found this helpful