Cassandra NoSQL database installation

This article describes the process for installing a Cassandra NoSQL database on a Windows server where you plan to install TestRail Server 7.4 or later.

Prerequisites

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

  1. Oracle JDK 8
  2. Python 2.7
  3. Cassandra driver for TestRail

1. Install JDK 8

Download the installer using the appropriate link: 

After installation, verify the Java version installed by entering java -version on your cmd.

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

openjdk version "1.8.0_312"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (Temurin)(build 25.312-b07, mixed mode)

Next, add the JDK 8 path to system Environment Variables. 

Go to Advanced system settings and select Environment Variables.

 

Create a new variable under System variables.

 

Write the name of the variable (JAVA_HOME) and browse the directory where the jdk is installed. Usually: C:\\Program Files\\Java\\jdk1.8.0_251

2. Install Python 2.7 

Download the Python 2.7 installer following this link:

Run the installer and follow the instructions. 

After completing the installation, extend your PATH for Python as well. Once again, go to the Environment Variables screen and double-click on the existing Path system variable.

Select New and then Browse for the installation path of Python. Click Ok to finish.

 

3. Cassandra driver for TestRail 

Download the driver here according to your PHP version (TS or NTS). You can verify the version you have by running php -v on the cmd.

Copy the driver to your PHP’s ext directory (usually C:\\Program Files (x86)\\PHPv7.3\\ext or similar). Next, activate the extension by adding the following line to your PHP.ini file. You can find the PHP.ini file in your PHP installation directory (usually C:\\Program Files (x86)\\PHP7.3 or similar):

extension=php_cassandra.dll

Install Cassandra

 

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

  1. Download Cassandra 3.11 from https://cassandra.apache.org/_/download.html
  2. Extract the downloaded file to a path you prefer. 
  3. Configure the environment variables for Cassandra.

  4. Create a new system variable named CASSANDRA_HOME and point the Variable Value to the location of the unzipped Apache Cassandra folder. For example, C:\\Cassandra\\apache-cassandra-3.11.11

  5. Extend your PATH for the bin folder for Cassandra engine. Double click on the existing Path system variable.
  6. Select New and then Browse for the full path to the bin folder located within the Apache Cassandra folder. For example, C:\\Cassandra\\apache-cassandra-3.11.11\\bin. Click Ok to finish.

  7. Make sure you have a cassandra-lucene-index-plugin-*.jar installed in your Cassandra Home lib directory (Usually \\apache-cassandra-3.11.11\\lib). If you don’t, you can download the .jar file from the official maven repository here. We suggest you use cassandra-lucene-index-plugin-3.11.1.0.jar for Cassandra 3.11.11.and then copy the file to the directory.

Now you are ready to start the Cassandra database for the first time. Open a Windows Command Prompt and type `cassandra`.

Once Cassandra is running, open another Windows Command Prompt and type:

cqlsh

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 found inside the conf folder (usually \\apache-cassandra-3.11.11\\conf).

Then, 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 the line authorizer: AllowAllAuthorizer and add the following line so it looks like this:

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

Finally, restart Cassandra.

Connect to Cassandra using the default username 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?
4 out of 5 found this helpful