Here in this tutorial will see a simple method to install Apache Cassandra on Windows 10/8/7 or Windows Server 2008/2012 without using Datastax community edition setup.
What is Apache Cassandra?
Apache Cassandra is a free and open source distributed NoSQL database system. Originally developed by Facebook, it is used to store simple format data such as inboxes. It combines Google BigTable’s data model with Amazon Dynamo’s fully distributed architecture. Facebook has opened Cassandra in 2008. Since then, Cassandra has good scalability that’s Digg, Twitter, GitHub, GoDaddy, Hulu, Instagram and other well-known sites or companies have adopted it and become a popular distributed structured data storage solutions.
Apache Cassandra is a hybrid, non-relational database similar to Google’s BigTable. Its main function is richer than Dynamo (distributed Key-Value storage system ), but its support is not as good as document storage MongoDB (an open source product between a relational database and non-relational database). It is the most abundant and non-relational database. Like a relational database, the supported data structure is very loose and is similar to JSON format, so it can store more complex data types.
Note: We are not using DataStax here to install Apache Cassandra because DataStax no longer provides the DataStax Community version of Apache Cassandra. You can read the official dictum here.
- The latest version of Java 8
- Python 2.7
- Apache Cassandra
How to Install Cassandra on Windows 10/8/7 without datastax
Step 1: Download Java 8 (Java SE Development Kit 8u211)
First thing first which is Java 8 installation and setting up of System variables for it on Windows 10/8/7 system. Thus, here is the link to download Java SE Development Kit 8u211.
After downloading, double click on the Java setup file to run and install it.
Step 2: Set $Java_Home variable on Windows
To set the system variables on your Windows system for Java 8; right click on My Computer or This PC icon and select properties option.
From the properties of your system on the left side, you will see an option called Advanced system settings. Click on that.
From the Environmental Variables screen, click on the New button given under System variables. Now in New System Variables window for Variable name type: JAVA_HOME and then click on Variable Value column after that select Browse Directory button.
From browse directory go to My computer or This PC->C: Drive->Programe Files->Java and select JDK 1.8
After adding the path of JAVA 8 to System variable it will look like something below screenshot. To save the settings click on the OK button.
Step 3: Download and Install Python 2.7 on Windows 10/8/7
We have tried the latest version of Python for Apache Cassandra but it gave an error while running Cassandra commands CQLSH. The error was:
"File "cqlsh", line 95 except ImportError, e: ^ SyntaxError: invalid syntax"
Hence, we had to install the downgrade version which is 2.7 and compatible with Apache Cassandra.
Here is the link to download Python 2.7 for Windows. On the download page click on the Windows x86-64 MSI installer.
After downloading the Python setup just run it like any other normal Windows.exe application.
Step 4: Set System environment variables for Python
Once the installation is done, the next thing which needs to be done is to let our command shells know about its commands by setting the environment variables.
Just like we have done above for JAVA, again go to Advance settings to access the environment variables and under the system variables you will see Path variable double click on that.
Click on New and then Browse. From directory browser go to My computer or This PC- C: Drive->select Python 27.
Hit the OK button to save the changes.
Step 5: Download Apache Cassandra on Windows 10/7
Two things have been successfully set that we needed to up and run a Cassandra server. Now finally, go to Apache Cassandra website and download its latest version. Here is the link.
While writing this Apache Cassandra setup tutorial for Windows, the latest version was 3.11 which might be different in your case.
Step 6: Extract Apache Cassandra Tar folder
The downloaded folder of Apache Cassandra will be in Tar compressed form. You can use Winrar or 7zip to extract it. After extracting open the folder and copy the folder to C: Drive.
Step 7: Set Cassandra HOME Environmental variables
As we set system variables above for Java and Python, we do the same for Cassandra. Under the system, variable click on the NEW button and type CASSANDRA_HOME for Variable name. And then click on Variable value column and browse the directory to select the folder of Apache Cassandra we copied to C: drive in the above step.
Now double click on the Path Variable of System Variables and Click New then Browse the Apache Cassandra folder resided in C: drive and inside that select the bin folder. Click the OK button and then again the OK button to save the variables.
Step 8: Run and up Cassandra on Windows 10/ server
Open the Command prompt or PowerShell under administrative rights and type the below command to start the Cassandra.
When you see Node started on Localhost/127.0.0.1 then just leave the command prompt window running Apache Cassandra open as it is.
Note: If you are running the above command in Powershell then you can close it.
Step 9: Run Cassandra commands on Windows
Now, open new Command Prompt Window and run:
Now you can start using Cassandra commands…
If you want to make the Cassandra service as Windows service so, that you don’t need to be run it again and again from the command prompt, see this tutorial: Start Cassandra as service in Windows 10/7/server…