How to Install Cassandra on Windows 10

Introduction

Apache Cassandra is a well-established wide-column NoSQL database. It uses a column-based storage model to capture large amounts of unstructured data.

Cassandra focuses on operating in a distributed cluster of commodity servers and boasts high-availability and flexible horizontal scaling.

This detailed tutorial shows you how to install Apache Cassandra on Windows.

Cassandra and Windows 10 tutorial on installing and setting up

Note: Guide on how to install Cassandra on Ubuntu is also available.

Dependencies

Apache Cassandra requires Java 8 to run on a Windows system. Additionally, the 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

The Java development kit contains all the tools and software you need to run applications written in Java. It is a prerequisite for software solutions such as Apache Cassandra.

Download Oracle JDK 8 (Java Development Kit)

1. Visit the official Oracle download page and download the Oracle JDK 8 software package.

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

Location of the Java 8 download link on the official Oracle download page.

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.

screenshot of the first step to Java 8 installation on Windows

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.

Define Java 8 installation folder on Windows

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

Java 8 was successfully installed on Windows 10

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.

Location of teh Properties option on This PC screen.

2. Select Advanced system settings.

Advanced System Settings option in Windows properties.

3. Click the Environment Variables… button.

Location of the Environment Variables tab in system properties.

4. Select New in the System Variable section.

The New tab allows you to add a new system variable for Java 8.

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

Add JAVA_HOME variable and append installation folder path.

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.

example of New Java system variable created

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.

JAVA_HOME variable succesfully added

Step 2: Install and Configure Python 2.7 on Windows

Users interact with the Cassandra database by utilizing the cqlsh bash shell. You 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.

Select the correct Python version to download.

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.

Install Python 2.7 for all users.

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

Define Python installation folder on Windows.

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

Customize Python installlation package.

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

Conclude Python 2.7 installation on Windows.

Edit Environment Variable for Python 2.7

1. Navigate to This PC > Properties.

Location of the Properties option on This PC screen.

2. Select the Advanced system settings option.

Advanced System Settings option in Windows properties.

3. Click Environment Variables…

Location of the Environment Variables tab in Windows' system properties.

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

Location of the 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.

Instruction on how to add a new Python 2.7 path to the existing Path variable.

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

Check if the new Python path is appended to the list.

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.

Official Cassandra download page with windows 10 for download

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.

The URL used to download the latest available Cassandra version.

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.

Content of unzipped Apache Cassandra tar.gz file.

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.

Location of the Properties option on This PC screen.

2. Go to Advanced system settings.

Advanced System Settings option in Windows properties.

3. Click the Environment Variables… button.

Location of the Environment Variables tab in Windows' system properties.

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

The New tab allows you to add a new system variable for Cassandra..

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.

Add new variable for Cassandra by appending installation folder location.

6. Double click on the Path variable.

Location of the Path System 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.

Add Cassandra bin folder path to Path system variable.

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

Note: Check out our article to learn more about the difference between MongoDB and Cassandra.

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.

How to open Windows CMD directly from Cassandra bin folder.

Type the following command to start the Cassandra server:

cassandra

The system proceeds to start the Cassandra Server.

Starting the Cassandra Server from Windows cmd.

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.

Accessing the Cassandra cql shell from windows cmd.

Conclusion

You have successfully installed Cassandra on Windows.

Large volumes of unstructured data can be an issue for traditional relational databases. This popular NoSQL database solution is going to allow you to capture and store a lot more of increasingly valuable data.

Learn more about how to use Cassandra in our guide on how to create, drop, alter and truncate Cassandra tables.

原创文章,作者:745907710,如若转载,请注明出处:https://blog.ytso.com/226186.html

(0)
上一篇 2022年1月9日
下一篇 2022年1月9日

相关推荐

发表回复

登录后才能评论