March 12, 2024

Install and Configure Apache Cassandra on Windows

 


1. Introduction

      Cassandra is a free and open-source, distributed, wide-column store, NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers support for clusters spanning multiple data centers,with asynchronous masterless replication allowing low latency operations for all clients. Cassandra was designed to implement a combination of Amazon's Dynamo distributed storage and replication techniques combined with Google's Bigtable data and storage engine model.

       Avinash Lakshman, one of the authors of Amazon's Dynamo, and Prashant Malik initially developed Cassandra at Facebook to power the Facebook inbox search feature. Facebook released Cassandra as an open-source project on Google code in July 2008.In March 2009, it became an Apache Incubator project. On February 17, 2010, it graduated to a top-level project.

      Facebook developers named their database after the Trojan mythological prophet Cassandra, with classical allusions to a curse on an oracle.

 2           Installation and Configuration:

2.1          Installing Cassandra

https://phoenixnap.com/kb/install-cassandra-on-windows

Dependencies

---------Apache Cassandra requires Java 8 to run on a Windows system.

---------Cassandra command-line shell (cqlsh) is dependent on Python 2.7 to work correctly.

To be able to install Cassandra on Windows, first you need to:

  1. Download and Install Java 8 and set environment variables.
  2. Download and install Python 2.7 and set environment variables.

If you already have these dependencies installed, check your version of Python and Java. If you have Java 8 and Python 2.7. feel free to move on to the third section of this guide.

Step 1: Install Java 8 on Windows

-------Download Oracle JDK 8 (Java Development Kit)( Visit the official Oracle download page and download the Oracle JDK 8 software package)

--------Scroll down and locate the Java SE Development Kit 8u251 for Windows x64 download link. The Java 8 download starts automatically after signup.

 

Note: If you do not have an Oracle account, the website guides you through a quick signup process. Alternatively, you can download Java from a third-party website of your choosing. Always make sure to confirm the source of the download.

3. Once the download is complete, double-click the downloaded executable file. Select Next on the initial installation screen.

 4. The following section allows you to select optional features and define the location of the installation folder. Accept the default settings and take note of the full path to the installation folder, C: Program FilesJavajdk1.8.0_251. Once you are ready to proceed with the installation, click Next.

5. The installation process can take several minutes. Select Close once the process is completed.

 Configure Environment Variables for Java 8

--------It is vital to configure the environment variables in Windows and define the correct path to the Java 8 installation folder.

1. Navigate to This PC > Properties.

 2. Select Advanced system settings.

3. Click the Environment Variables

 4. Select New in the System Variable section.

 5. Enter JAVA_HOME for the new variable name. Select the Variable value field and then the Browse Directory option.

 6. Navigate to This PC > Local Disk C: > Program Files > Java > jdk1.8.0_251 and select OK.

7. Once the correct path to the JDK 8 installation folder has been added to the JAVA_HOME system variable, click OK.

 

8. You have successfully added the JAVA_HOME system variable with the correct JDK 8 path to the variable list. Select OK in the main Environment Variables window to complete the process.

 Step 2: Install and Configure Python 2.7 on Windows

-------Users interact with the Cassandra database by utilizing the cqlsh bash shell.

-------- We need to install Python 2.7 for cqlsh to handle user requests properly.

-------Install Python 2.7 on Windows

1. Visit the Python official download page and select the Windows x64 version link.

 2. Define if you would like Python to be available to all users on this machine or just for your user account and select Next.

 3. Specify and take note of the Python installation folder location. Feel free to leave the default location C:Python27 by clicking Next.

 4. The following step allows you to customize the Python installation package. Select Next to continue the installation using the default settings.

5. The installation process takes a few moments. Once it is complete, select Finish to conclude the installation process.

 Edit Environment Variable for Python 2.7

1. Navigate to This PC > Properties.

 2. Select the Advanced system settings option.

 3. Click Environment Variables…

 4. Double-click on the existing Path system variable.

 5. Select New and then Browse to locate the Python installation folder quickly. Once you have confirmed that the path is correct, click OK.

 6. Add the Python 2.7 path to the Path system variable by selecting OK.

 

----------------Step 3: Download and Set Up Apache Cassandra

----------------Download and Extract Cassandra tar.gz Folder

----------------1. Visit the official Apache Cassandra Download page and select the version you would prefer to download. Currently, the latest available version is 3.11.6.

 2. Click the suggested Mirror download link to start the download process.


Note: It is always recommended to verify downloads originating from mirror sites. The instructions for using GPG or SHA-512 for verification are usually available on the official download page.

 4. Unzip the compressed tar.gz folder using a compression tool such as 7-Zip or WinZip. In this example, the compressed folder was unzipped, and the content placed in the C:Cassandraapache-cassandra-3.11.6 folder.

 Configure Environment Variables for Cassandra

Set up the environment variables for Cassandra to enable the database to interact with other applications and operate on Windows.

1. Go to This PC > Properties.

 2. Go to Advanced system settings.

 3. Click the Environment Variables

 4. Add a completely new entry by selecting the New option.

 5. Type CASSANDRA_HOME for Variable name, then for theVariable value column select the location of the unzipped Apache Cassandra folder.

Based on the previous steps, the location is C:Cassandraapache-cassandra-3.11.6. Once you have confirmed that the location is correct, click OK.

 

6. Double click on the Path variable.

 7. Select New and then Browse. In this instance, you need to add the full path to the bin folder located within the Apache Cassandra folder, C:Cassandraapache-cassandra-3.11.6bin.

 8. Hit the OK button and then again OK to save the edited variables.

 Step 4: Start Cassandra from Windows CMD

Navigate to the Cassandra bin folder. Start the Windows Command Prompt directly from within the bin folder by typing cmd in the address bar and pressing Enter.

 Type the following command to start the Cassandra server:

cassandra

The system proceeds to start the Cassandra Server.

 

Do not close the current cmd session.

Step 5: Access Cassandra cqlsh from Windows CMD

While the initial command prompt is still running open a new command line prompt from the same bin folder. Enter the following command to access the Cassandra cqlsh bash shell:

cqlsh

You now have access to the Cassandra shell and can proceed to issue basic database commands to your Cassandra server.


You have successfully installed Cassandra on Windows.

 


No comments:

Secure a Microsoft Fabric data warehouse

  Data warehouse in Microsoft Fabric is a comprehensive platform for data and analytics, featuring advanced query processing and full transa...