SlideShare a Scribd company logo
1 of 19
By: Muralidharan Deenathayalan
Technical Lead, www.quanticate.com
Apache, Apache Cassandra, and Cassandra are trademarks of the Apache Software Foundation. Terms & Conditions
My Bio data
• 7+ years of experience in Microsoft technologies like Asp.net, C#, SQL server and SharePoint
• 2+ years of experience in open source technologies like Java, Alfresco and Apache Cassandra
• Csharpcorner MVP
Why I love Cassandra
• It runs on Windows machines 
• Easy to install
• Easy to configure
• Easy to develop
Agenda
• What is Apache Cassandra ?
• Birth
• Architecture
• Key Features
• Key Components
• Apache Cassandra Connectivity
• What is CQL and CQL Drivers
• Apache Cassandra – CRUD Demo
What is Apache Cassandra
• Distributed
• High Performance
• Scalable
• No Single Point of Failure database
Apache Cassandra - Birth
2008
Apache Cassandra - Architecture
• The ring represents a cyclic range of
token values (i.e., the token space).
• Each node is assigned a position on the
ring based on its token.
• Each node communicates with each
other node using Gossip protocol.
• First data written into commit log for
data durability
• Later data pushed from commit log to
memtable, once memtable is full then
the data written into sstable (disk).
Open Source
Column
Oriented
High PerformanceHigh Availability
& Fault Tolerance
Peer – Peer
Architecture
CQL
Tunable
Consistency
Apache Cassandra - Features
Flexible
Schema
Apache Cassandra – Key Components
Keyword Description
Schema / Keyspace A collection of column families
Table/ Column Family A set of rows
Row An ordered set of columns
Partitioning Keys are mapped into the token space by a Partitioner.
Replication Cassandra provides high availability and fault tolerance
through data replication. The replication uses the ring to
determine nodes used for replication.
Consistency Levels Clients can specify the consistency level on both read and
write operations trading off between high availability,
consistency, and perform
CQL Cassandra provides an SQL-like query language called the
Cassandra Query Language
Apache Cassandra connectivity
• Apache Thrift (RPC)
• Scalable cross-language services development
• C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js,
Smalltalk, OCaml and Delphi
• thrift --gen <language> <Thrift filename>
• http://thrift.apache.org/
• Cassandra Query Language (CQL)
• SQL like statements
• Supports Triggers
• Does not support Sub-queries and joins
• http://www.datastax.com/documentation/cql/3.1/cql/cql_using/about_cql_c.html
Apache Cassandra - CQL Client Drivers
Language /
Framework
Client driver
Name
Description URI
PHP Cassandra -
PDO
A CQL (Cassandra Query
Language) driver for PHP
http://code.google.com/a/apache-
/
Python Pycassa Pycassa is the most well
known Python library for
Cassandra
https://
github.com/pycassa/pycassa
Ruby Ruby Gem Ruby has support for
Cassandra via a gem.
http://
rubygems.org/gems/cassandra
.NET Cassandra-
Sharp
.NET client for Cassandra https://
github.com/datastax/csharp
-driver
Node.Js Cassandra-
Node
Cassandra/ CQL driver
for Node.js
https://github.com/racker/node-ca
Step 1: Install Apache Cassandra.
http://cassandra.apache.org/download/
Step 2: Install Python.
http://www.python.org/download/releases/2.7.3/
Step 3: Add the Python executable path in the windows path variable,
otherwise configure in the environment variable.
Open command prompt :
C:> path =%path%;<python exe path>
Step 4: In the command prompt, navigate to Cassandrabin folder.
For ex C:cassandrabin>
Apache Cassandra - Installation
Apache Cassandra – Starting CLI
Step 1:
Start the Apache Cassandra Server by running <Cassandra>binCassandra.bat.
Step 2:
Start Command Line Interface from <Cassandra>bincassandra-cli.bat
Step 3:
Connect you Cassandra CLI with Cassandra Server..
Command: connect localhost/9160;
Apache Cassandra – Using CLI
Demo
Connect Cassandra Server - connect localhost/9160;
Displaying existing Keyspaces - show keyspaces;
Creating new keyspace - CREATE KEYSPACE testkeyspace with
placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};
Use existing keyspace - use testkeyspace ;
Creating column family - create column family users with comparator =
UTF8Type and key_validation_class=UTF8Type and column_metadata =
[{column_name: userName, validation_class:UTF8Type}, {column_name:
email, validation_class:UTF8Type}];
Apache Cassandra – Using CLI
Demo
Insert records into Columnfamily
- set users['student01']['userName']='Student1';
- set users['student01']['email']='Student1@example.com';
Read existing record in a Columnfamily
- get users['student01']['userName'];
- get users['student01'];
Update records in Columnfamily
- set users['student01']['email']='Student1@example.co.in';
Deleting records in Columnfamily
- del users['student01']['email'];
- del users['student01'];
Apache Cassandra – Using CQL
Demo
Connect Cassandra Server and execute CQLSh.bat file
Create Keyspace
- CREATE KEYSPACE CassandraCQLDemo
WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
Use existing keyspace
- use CassandraCQLDemo;
Creating tables
- CREATE TABLE users( user_id varchar, age int, email varchar, city
varchar,PRIMARY KEY (user_id));
Apache Cassandra – Using CQL
Demo
Insert records into table
- INSERT INTO users(user_id, age, email, city)VALUES
('jsmith',32,'john.smith@example.com','Dallas');
- INSERT INTO users(user_id, city) VALUES ('pscott','New Jersey');
Read records from table
- SELECT * FROM users;
- SELECT * FROM users WHERE user_id='jsmith';
Update existing record in a table
- update users set email = ‘muralidharan@example.com’ where
user_id=‘'jsmith’;
Deleting records in table
- DELETE email FROM users WHERE user_id = 'jsmith ';
- DELETE FROM users WHERE user_id = 'pscott';
Q & A
Follow me
Twitter
www.Twitter.com/muralidharand
Coding-Freaks.Net
www.codingfreaks.net
Thank you

More Related Content

What's hot

Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Application
supertom
 
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
DataStax
 
Scaling Twitter with Cassandra
Scaling Twitter with CassandraScaling Twitter with Cassandra
Scaling Twitter with Cassandra
Ryan King
 

What's hot (20)

Cassandra training
Cassandra trainingCassandra training
Cassandra training
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Application
 
Cassandra Distributions and Variants
Cassandra Distributions and VariantsCassandra Distributions and Variants
Cassandra Distributions and Variants
 
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
 
Scaling Twitter with Cassandra
Scaling Twitter with CassandraScaling Twitter with Cassandra
Scaling Twitter with Cassandra
 
cassandra@Netflix
cassandra@Netflixcassandra@Netflix
cassandra@Netflix
 
An Overview of Apache Cassandra
An Overview of Apache CassandraAn Overview of Apache Cassandra
An Overview of Apache Cassandra
 
Cassandra Lunch #92: Securing Apache Cassandra - Managing Roles and Permissions
Cassandra Lunch #92: Securing Apache Cassandra - Managing Roles and PermissionsCassandra Lunch #92: Securing Apache Cassandra - Managing Roles and Permissions
Cassandra Lunch #92: Securing Apache Cassandra - Managing Roles and Permissions
 
An Introduction to Distributed Search with Datastax Enterprise Search
An Introduction to Distributed Search with Datastax Enterprise SearchAn Introduction to Distributed Search with Datastax Enterprise Search
An Introduction to Distributed Search with Datastax Enterprise Search
 
FireEye & Scylla: Intel Threat Analysis Using a Graph Database
FireEye & Scylla: Intel Threat Analysis Using a Graph DatabaseFireEye & Scylla: Intel Threat Analysis Using a Graph Database
FireEye & Scylla: Intel Threat Analysis Using a Graph Database
 
Big Data Day LA 2015 - Sparking up your Cassandra Cluster- Analytics made Awe...
Big Data Day LA 2015 - Sparking up your Cassandra Cluster- Analytics made Awe...Big Data Day LA 2015 - Sparking up your Cassandra Cluster- Analytics made Awe...
Big Data Day LA 2015 - Sparking up your Cassandra Cluster- Analytics made Awe...
 
Webinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache CassandraWebinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache Cassandra
 
How to Monitor and Size Workloads on AWS i3 instances
How to Monitor and Size Workloads on AWS i3 instancesHow to Monitor and Size Workloads on AWS i3 instances
How to Monitor and Size Workloads on AWS i3 instances
 
Feeding Cassandra with Spark-Streaming and Kafka
Feeding Cassandra with Spark-Streaming and KafkaFeeding Cassandra with Spark-Streaming and Kafka
Feeding Cassandra with Spark-Streaming and Kafka
 
Everyday I’m scaling... Cassandra
Everyday I’m scaling... CassandraEveryday I’m scaling... Cassandra
Everyday I’m scaling... Cassandra
 
Cassandra + Spark + Elk
Cassandra + Spark + ElkCassandra + Spark + Elk
Cassandra + Spark + Elk
 
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag JambhekarC* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
 
Cassandra NoSQL Tutorial
Cassandra NoSQL TutorialCassandra NoSQL Tutorial
Cassandra NoSQL Tutorial
 
Cassandra ppt 2
Cassandra ppt 2Cassandra ppt 2
Cassandra ppt 2
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra
 

Similar to Apache cassandra

Application Development with Apache Cassandra as a Service
Application Development with Apache Cassandra as a ServiceApplication Development with Apache Cassandra as a Service
Application Development with Apache Cassandra as a Service
WSO2
 

Similar to Apache cassandra (20)

Cassandra - A decentralized storage system
Cassandra - A decentralized storage systemCassandra - A decentralized storage system
Cassandra - A decentralized storage system
 
Lambda Architecture with Spark Streaming, Kafka, Cassandra, Akka, Scala
Lambda Architecture with Spark Streaming, Kafka, Cassandra, Akka, ScalaLambda Architecture with Spark Streaming, Kafka, Cassandra, Akka, Scala
Lambda Architecture with Spark Streaming, Kafka, Cassandra, Akka, Scala
 
Kafka connect 101
Kafka connect 101Kafka connect 101
Kafka connect 101
 
Lambda Architecture with Spark, Spark Streaming, Kafka, Cassandra, Akka and S...
Lambda Architecture with Spark, Spark Streaming, Kafka, Cassandra, Akka and S...Lambda Architecture with Spark, Spark Streaming, Kafka, Cassandra, Akka and S...
Lambda Architecture with Spark, Spark Streaming, Kafka, Cassandra, Akka and S...
 
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
 
Using the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data ProductUsing the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data Product
 
Application Development with Apache Cassandra as a Service
Application Development with Apache Cassandra as a ServiceApplication Development with Apache Cassandra as a Service
Application Development with Apache Cassandra as a Service
 
Apache cassandra lunch #82 instaclustr managed cassandra and next.js
Apache cassandra lunch #82  instaclustr managed cassandra and next.jsApache cassandra lunch #82  instaclustr managed cassandra and next.js
Apache cassandra lunch #82 instaclustr managed cassandra and next.js
 
Apache Cassandra Lunch #82: Instaclustr Managed Cassandra and Next.js
Apache Cassandra Lunch #82: Instaclustr Managed Cassandra and Next.jsApache Cassandra Lunch #82: Instaclustr Managed Cassandra and Next.js
Apache Cassandra Lunch #82: Instaclustr Managed Cassandra and Next.js
 
Kafka Summit SF 2017 - Kafka Stream Processing for Everyone with KSQL
Kafka Summit SF 2017 - Kafka Stream Processing for Everyone with KSQLKafka Summit SF 2017 - Kafka Stream Processing for Everyone with KSQL
Kafka Summit SF 2017 - Kafka Stream Processing for Everyone with KSQL
 
EclipseCon - Building an IDE for Apache Cassandra
EclipseCon - Building an IDE for Apache CassandraEclipseCon - Building an IDE for Apache Cassandra
EclipseCon - Building an IDE for Apache Cassandra
 
Chicago Kafka Meetup
Chicago Kafka MeetupChicago Kafka Meetup
Chicago Kafka Meetup
 
Tech-Spark: SQL Server on Linux
Tech-Spark: SQL Server on LinuxTech-Spark: SQL Server on Linux
Tech-Spark: SQL Server on Linux
 
Vitalii Bondarenko - “Azure real-time analytics and kappa architecture with K...
Vitalii Bondarenko - “Azure real-time analytics and kappa architecture with K...Vitalii Bondarenko - “Azure real-time analytics and kappa architecture with K...
Vitalii Bondarenko - “Azure real-time analytics and kappa architecture with K...
 
Jug - ecosystem
Jug -  ecosystemJug -  ecosystem
Jug - ecosystem
 
Chti jug - 2018-06-26
Chti jug - 2018-06-26Chti jug - 2018-06-26
Chti jug - 2018-06-26
 
Cassandra integrations
Cassandra integrationsCassandra integrations
Cassandra integrations
 
Changing landscapes in data integration - Kafka Connect for near real-time da...
Changing landscapes in data integration - Kafka Connect for near real-time da...Changing landscapes in data integration - Kafka Connect for near real-time da...
Changing landscapes in data integration - Kafka Connect for near real-time da...
 
Cassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideCassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction Guide
 
Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15
 

More from Muralidharan Deenathayalan

More from Muralidharan Deenathayalan (10)

What's new in C# 8.0 (beta)
What's new in C# 8.0 (beta)What's new in C# 8.0 (beta)
What's new in C# 8.0 (beta)
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Alfresco 5.0 features
Alfresco 5.0 featuresAlfresco 5.0 features
Alfresco 5.0 features
 
Test drive on driven development process
Test drive on driven development processTest drive on driven development process
Test drive on driven development process
 
Map Reduce introduction
Map Reduce introductionMap Reduce introduction
Map Reduce introduction
 
Apache Hive - Introduction
Apache Hive - IntroductionApache Hive - Introduction
Apache Hive - Introduction
 
Alfresco share 4.1 to 4.2 customisation
Alfresco share 4.1 to 4.2 customisationAlfresco share 4.1 to 4.2 customisation
Alfresco share 4.1 to 4.2 customisation
 
Introduction about Alfresco webscript
Introduction about Alfresco webscriptIntroduction about Alfresco webscript
Introduction about Alfresco webscript
 
Alfresco activiti workflows
Alfresco activiti workflowsAlfresco activiti workflows
Alfresco activiti workflows
 
Alfresco content model
Alfresco content modelAlfresco content model
Alfresco content model
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

Apache cassandra

  • 1. By: Muralidharan Deenathayalan Technical Lead, www.quanticate.com Apache, Apache Cassandra, and Cassandra are trademarks of the Apache Software Foundation. Terms & Conditions
  • 2. My Bio data • 7+ years of experience in Microsoft technologies like Asp.net, C#, SQL server and SharePoint • 2+ years of experience in open source technologies like Java, Alfresco and Apache Cassandra • Csharpcorner MVP Why I love Cassandra • It runs on Windows machines  • Easy to install • Easy to configure • Easy to develop
  • 3. Agenda • What is Apache Cassandra ? • Birth • Architecture • Key Features • Key Components • Apache Cassandra Connectivity • What is CQL and CQL Drivers • Apache Cassandra – CRUD Demo
  • 4. What is Apache Cassandra • Distributed • High Performance • Scalable • No Single Point of Failure database
  • 5. Apache Cassandra - Birth 2008
  • 6. Apache Cassandra - Architecture • The ring represents a cyclic range of token values (i.e., the token space). • Each node is assigned a position on the ring based on its token. • Each node communicates with each other node using Gossip protocol. • First data written into commit log for data durability • Later data pushed from commit log to memtable, once memtable is full then the data written into sstable (disk).
  • 7. Open Source Column Oriented High PerformanceHigh Availability & Fault Tolerance Peer – Peer Architecture CQL Tunable Consistency Apache Cassandra - Features Flexible Schema
  • 8. Apache Cassandra – Key Components Keyword Description Schema / Keyspace A collection of column families Table/ Column Family A set of rows Row An ordered set of columns Partitioning Keys are mapped into the token space by a Partitioner. Replication Cassandra provides high availability and fault tolerance through data replication. The replication uses the ring to determine nodes used for replication. Consistency Levels Clients can specify the consistency level on both read and write operations trading off between high availability, consistency, and perform CQL Cassandra provides an SQL-like query language called the Cassandra Query Language
  • 9. Apache Cassandra connectivity • Apache Thrift (RPC) • Scalable cross-language services development • C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi • thrift --gen <language> <Thrift filename> • http://thrift.apache.org/ • Cassandra Query Language (CQL) • SQL like statements • Supports Triggers • Does not support Sub-queries and joins • http://www.datastax.com/documentation/cql/3.1/cql/cql_using/about_cql_c.html
  • 10. Apache Cassandra - CQL Client Drivers Language / Framework Client driver Name Description URI PHP Cassandra - PDO A CQL (Cassandra Query Language) driver for PHP http://code.google.com/a/apache- / Python Pycassa Pycassa is the most well known Python library for Cassandra https:// github.com/pycassa/pycassa Ruby Ruby Gem Ruby has support for Cassandra via a gem. http:// rubygems.org/gems/cassandra .NET Cassandra- Sharp .NET client for Cassandra https:// github.com/datastax/csharp -driver Node.Js Cassandra- Node Cassandra/ CQL driver for Node.js https://github.com/racker/node-ca
  • 11. Step 1: Install Apache Cassandra. http://cassandra.apache.org/download/ Step 2: Install Python. http://www.python.org/download/releases/2.7.3/ Step 3: Add the Python executable path in the windows path variable, otherwise configure in the environment variable. Open command prompt : C:> path =%path%;<python exe path> Step 4: In the command prompt, navigate to Cassandrabin folder. For ex C:cassandrabin> Apache Cassandra - Installation
  • 12. Apache Cassandra – Starting CLI Step 1: Start the Apache Cassandra Server by running <Cassandra>binCassandra.bat. Step 2: Start Command Line Interface from <Cassandra>bincassandra-cli.bat Step 3: Connect you Cassandra CLI with Cassandra Server.. Command: connect localhost/9160;
  • 13. Apache Cassandra – Using CLI Demo Connect Cassandra Server - connect localhost/9160; Displaying existing Keyspaces - show keyspaces; Creating new keyspace - CREATE KEYSPACE testkeyspace with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = {replication_factor:1}; Use existing keyspace - use testkeyspace ; Creating column family - create column family users with comparator = UTF8Type and key_validation_class=UTF8Type and column_metadata = [{column_name: userName, validation_class:UTF8Type}, {column_name: email, validation_class:UTF8Type}];
  • 14. Apache Cassandra – Using CLI Demo Insert records into Columnfamily - set users['student01']['userName']='Student1'; - set users['student01']['email']='Student1@example.com'; Read existing record in a Columnfamily - get users['student01']['userName']; - get users['student01']; Update records in Columnfamily - set users['student01']['email']='Student1@example.co.in'; Deleting records in Columnfamily - del users['student01']['email']; - del users['student01'];
  • 15. Apache Cassandra – Using CQL Demo Connect Cassandra Server and execute CQLSh.bat file Create Keyspace - CREATE KEYSPACE CassandraCQLDemo WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 }; Use existing keyspace - use CassandraCQLDemo; Creating tables - CREATE TABLE users( user_id varchar, age int, email varchar, city varchar,PRIMARY KEY (user_id));
  • 16. Apache Cassandra – Using CQL Demo Insert records into table - INSERT INTO users(user_id, age, email, city)VALUES ('jsmith',32,'john.smith@example.com','Dallas'); - INSERT INTO users(user_id, city) VALUES ('pscott','New Jersey'); Read records from table - SELECT * FROM users; - SELECT * FROM users WHERE user_id='jsmith'; Update existing record in a table - update users set email = ‘muralidharan@example.com’ where user_id=‘'jsmith’; Deleting records in table - DELETE email FROM users WHERE user_id = 'jsmith '; - DELETE FROM users WHERE user_id = 'pscott';
  • 17. Q & A