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:
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 -yIf 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 -versionThe 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.debInstall the package.
$ dpkg -i multiarch-support_2.27-3ubuntu1.6_amd64.debNow 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.debRun this command to install it.
$ dpkg -i cassandra-cpp-driver_2.16.0-1_amd64.debRedHat-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.rpmInstall the package.
$ rpm -i libuv-1.35.0-1.el7.x86_64.rpmNow 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.rpmRun this command to install it.
$ rpm -i cassandra-cpp-driver-2.16.0-1.el7.x86_64.rpm3. Cassandra driver for TestRail
Download the driver for Linux from here.
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_dirCopy 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:
a151c2a7146d56c16236baa8cc1e9134It should return something similar to this:
$ /usr/lib/php/20210902# md5sum cassandra.so
a151c2a7146d56c16236baa8cc1e9134 cassandra.soEnable the extension inside the php.ini by adding the following line to the file.
extension=cassandraYou can confirm the extension is available by writing the following command.
$ php -mHere 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.soHere 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.
Before you install, some Linux distributions may not have the directory /etc/apt/keyrings/ by default. Verify if you have this directory, but if you do not, create it with the following command: mkdir /etc/apt/keyrings/.
This should enable the repository and let you install Cassandra.
Install the required dependencies with the following command:
$ apt-get install apt-transport-https gnupg2 -yDownload and add the GPG key with the following command:
$ curl -o /etc/apt/keyrings/apache-cassandra.asc https://downloads.apache.org/cassandra/KEYSTo verify if the previous command worked, use this next one:
$ cat /etc/apt/keyrings/apache-cassandra.ascWait 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 [signed-by=/etc/apt/keyrings/apache-cassandra.asc] https://debian.cassandra.apache.org 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list'Update the repository cache:
$ apt-get update -yInstall Apache Cassandra.
$ apt-get install cassandra -yMake 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.jarCopy the file to the Home lib directory.
$ cp cassandra-lucene-index-plugin-3.11.3.0.jar /usr/share/cassandra/libEnable Authentication and Authorization in Cassandra
- Open Cassandra config file cassandra.yaml
- Replace AllowAllAuthenticator with PasswordAuthenticator and AllowAllAuthorizer with CassandraAuthorizer
Restart Cassandra.
$ service cassandra restartNow you are ready to connect to Cassandra for the first time. Type:
cqlsh <host> -u <user> -p <password>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.PasswordAuthenticatorNext comment on the line authorizer: “AllowAllAuthorizer” and add the following line so it looks like this:
#authorizer: AllowAllAuthorizer
authorizer: org.apache.cassandra.auth.CassandraAuthorizerThen, restart Cassandra.
$ service cassandra restartConnect to Cassandra using the default user and password.
$ cqlsh -u cassandra -p cassandraThen, 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.