Simple Way to Install Cassandra In Windows 10

1/12/2023
Reading time: 3 mins
cassandranosql

Simple Way to Install Cassandra In Windows 10

Figure out simple way to get installed and configure to run cassandra NoSQL database in Windows 10 PC in just 4 steps:

I am writing this tutorial since i face challenge to install cassandra in windows on self and i want to share what i figure out for the solution to other geeks.

What is cassandra and why to use it?

Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity (cheap) servers, providing high availability with no single point of failure. It is a type of NoSQL database that is considered a key-value store. It’s query much similar to SQL.

  • Outgrown your regular relational database i.e petabytes, zettabytes size
  • Need of fast insert/update/selection of data that is scalable and fault-tolerant.

Steps to setup Cassandra on Window Machine locally.

1. Cassandra need JDK to run. First need to install JDK on the PC.

  • Go To Oracle (SignUp required) or Filehippo to download JDK 1.8 from which you find suitable.
  • Run the Install as it is.
  • Configure JDK path As:
  • Copy the JDK where is installed it’s bin directory. Mine is 64-bit found inside “C:\Program Files\Java\jdk1.8.0_181\bin” and place on Environment Variable as new Env_name : “JAVA_HOME” later we use for cassandra.
  • Note: Progra~1 = ‘Program Files’ for 64-bit
    Progra~2 = ‘Program Files(x86)’ for 32-bit in Environment path.
Environment variable set in JAVA_HOME

2. Go to Apache Cassandra Download Page. And Download the latest version. The latest version at that time is cassandra-3.11.4

  • Unzip it and place all files inside sub folder into ……………….. “C:\Program Files\apache-cassandra-3.11.4”
  • Open CMD inside “C:\Program Files\apache-cassandra-3.11.4\bin” and type cassandra then the output as shown below.
JAVA_HOME should set error
  • If you got above error then Edit “cassandra.bat” Add JAVA_HOME as:
set JAVA_HOME=”C:\Progra~1\Java\jdk1.8.0_181"
  • Save the cassandra.bat then run “cassandra.bat -f” with CMD Run as Administrator. This time, error should resolve if your edit successful.

3. Need Python2.7 to run Cassandra Query shell cqlsh .

  • Download Python2.7 latest version and extract inside the “C:\Program Files\apache-cassandra-3.11.4\bin” during installing. Or simply copy after installing python2.7 all files inside “bin” directory of cassandra-3.11.4. This is a easy way to go.
Directory of cassandra-3.11.4\bin with python all files

4. Finally run the Cassandra Server as “cassandra.bat -f” with CMD Run as Administrator from the bin directory. Following screen should see on successful start.

  • Don’t close it, keep running.
  • Then, open other CMD go over the bin directory of cassandra installed. To run cqlsh by type cqlsh . Following output should get.

Let’s try to create the table in it:

First create the namespace where data holds.

cqlsh> create keyspace test

cqlsh> Use test;

cqlsh:test>CREATE TABLE emp(
emp_id int PRIMARY KEY,
emp_name text,
emp_city text,
emp_sal varint,
emp_phone varint
);
For Verification: cqlsh:test> select * from emp;

Output as:

Congratulations! You have your Cassandra installed. Now you can explore it.

If you find helpful this tutorial please click on green icon, share to others.

Find out my other tutorial as: