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.
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.
- If you got above error then Edit “cassandra.bat” Add JAVA_HOME as:
- 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
- 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.
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
cqlshby 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,
For Verification: cqlsh:test> select * from emp;
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: