NoSQL

What is Cassandra?

Simple Way to Install Cassandra In Windows 10


The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data. Cassandra's support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive regional outages.


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  .
  • 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  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:








No comments:

Post a Comment