SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Getting Started with Apache Cassandra! 
Rebecca Mills 
Junior Evangelist 
DataStax 
@rebccamills! 
©2013 DataStax Confidential. Do not distribute without consent.! 
1!
Don’t want to spend exorbitant amount of 
time and energy learning a new database? 
• Then you’ve come to the right place! 
• To learn some important basics of Cassandra without 
ever having to leave your couch 
• Just don’t get cheesy powder on your key board
What do I do? 
• Try to create awareness for open source Cassandra 
• Develop content to get people interested in trying 
• Identify problems newcomers might be encountering 
• Develop strategies and material to help with that first 
ease of initial use
Where can you download Cassandra? 
• The easiest way is to head straight to Planet 
Cassandra 
• http://planetcassandra.org/ 
• Go to the “Downloads” section, choose you operating 
system and the version of DSC that’ you’d like 
• Get crackin’!
Let’s get started
2 things you should do to get going 
1. Check your version of Java 
2. Edit your cassandra.yaml file to point your 
Cassandra instance towards your home directory
1. Check your version of Java 
• To check what version of java you are using, at the prompt type 
% java –version 
• Be sure to use the latest version (JDK 7) on all nodes
2. Change default location to save data 
• Don’t run Cassandra as root 
• Other wise we will not be able to start Cassandra or have 
access to the directories where our data is being saved. 
• Access the cassandra.yaml file though the cassandra 
conf directory
The 3 lines you should change in the 
cassandra.yaml file: 
Edit cassandra.yaml 
data_file_directories: 
- /var/lib/cassandra/data 
-$HOME/cassandra/data 
commitlog_directory: /var/lib/cassandra/commitlog 
$HOME/cassandra/commitlog 
saved_caches_directory: /var/lib/cassandra/saved_caches 
$HOME/cassandra/saved_caches
5 things you can do quickly 
1. Start up an instance 
2. Create a schema with CQL 
3. Inject some data into our instance 
4. Run a query against our database 
5. Make a change to your data
1. Start up an instance 
• It’s very simple! Just go to your install location and start it from the 
bin directory as such: 
$ cd install_location 
$ bin/cassandra
2. Create a schema with CQL 
• From within your installation directory, start up your CQL shell from 
within the bin directory 
$ cd install_directory 
$ bin/cqlsh 
• You should see the cqlsh command prompt as such 
Connected to Test Cluster at localhost:9160. 
[cqlsh 4.1.1 | Cassandra 2.0.8 | CQL spec 3.1.1 | Thrift protocol 19.39.0] 
Use HELP for help. 
cqlsh>
2. Create a schema with CQL 
• A keyspace is a container for our data. Here we are creating a demo 
keyspace and a users table within. A table consists of rows and 
columns. 
CREATE KEYSPACE demo WITH REPLICATION = 
{‘class’:’SimpleStrategy’,’replication_factor’:1}; 
USE demo; 
CREATE TABLE users ( 
firstname text, 
lastname text, 
age int, 
email text, 
city text, 
PRIMARY KEY (lastname) 
);
3. Inject some data into your instance 
• Nothing sadder than an empty database. Here we 
are populating our “users” table with rows of 
data using the INSERT command. 
INSERT INTO users (firstname, lastname, age, email, city) VALUES 
(‘John’,’Smith’, 46, ‘johnsmith@email.com’, ‘Sacramento’); 
INSERT INTO users (firstname, lastname, age, email, city) VALUES 
(‘Jane’,’Doe’, 36, ‘janedoe@email.com’, ‘Beverly Hills’); 
INSERT INTO users (firstname, lastname, age, email, city) VALUES 
(‘Rob’,’Byrne’, 24, ‘robbyrne@email.com’, ‘San Diego’);
4. Make a query against your database 
SELECT * FROM users; 
lastname | age | city | email | firstname 
----------+-----+---------------+---------------------+----------- 
Doe | 36 | Beverly Hills | janedoe@email.com | Jane 
Bryne | 24 | San Diego | robbyrne@email.com | Rob 
Smith | 46 | Sacramento | johnsmith@email.com | John 
SELECT * FROM users WHERE lastname=‘Doe’; 
lastname | age | city | email | firstname 
----------+-----+---------------+-------------------+----------- 
Doe | 36 | Beverly Hills | janedoe@email.com | Jane
5. Make a change to your data 
UPDATE users SET city=‘San Jose’ WHERE lastname=‘Doe’; 
SELECT * FROM users WHERE lastname= ‘Doe’; 
lastname | age | city | email | firstname 
----------+-----+----------+-------------------+------------- 
Doe | 36 | San Jose | janedoe@email.com | Jane 
SELECT * FROM users; 
DELETE FROM users WHERE lastname=‘Doe’; 
lastname | age | city | email | firstname 
----------+-----+---------------+---------------------+----------- 
Bryne | 24 | San Diego | robbyrne@email.com | Rob 
Smith | 46 | Sacramento | johnsmith@email.com | John
Two really neat tools: 
1. Opscenter 
2. DevCenter
Dev Center 
• Try out your CQL in an easy-to-use tool 
• Has most of the same functionality as cqlsh with a few 
exceptions 
• Quickly connect to your cluster and keyspace. GO!
Opscenter 
• Opscenter makes it easy to manage and configure your cluster!
Change configurations 
• Just a couple clicks and you can reconfigure an entire cluster.
Metrics 
• Diagnosis problems with your cluster
How about multi datacenter? 
Of course!
You can run an AWS AMI from Opscenter! 
• Run a Cassandra instance/cluster in the cloud! 
• Using Amazon Web Services EC2 Management Console 
• Quickly deploy a Cassandra cluster within a single availability zone through Opscenter 
• Check out 
http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installAMI.html
What about the drivers 
• Datastax provides drivers for Java, Python, C#, and C++ 
• There are also many open sources community drivers, 
including Closure, Go, Node.js and many many more.
Connect to your instance with Java 
• Create a new Java class, com.example.cassandra.SimpleClient for example 
• Add an instance field to hold cluster reference 
private Cluster cluster; 
• Add an instance method, connect, to your new class. Here you can add your contact point, 
the ip address of your node. 
public void connect(String node) { 
cluster = Cluster.builder() 
.addContactPoint(<ip_address>) 
.build(); 
} 
• Add an instance method, close, to shut down the cluster once you are finished 
public void close() { 
cluster.close(); 
}
Connect to your instance with Java 
• In your main class, create a SimpleClient object, call connect, and close it 
public static void main(String[] args) { 
SimpleClient client = new SimpleClient(); 
client .connect(<ip_address>); 
client.close(); 
} 
• Select some data 
session.execute (‘SELECT * FROM demo.users’);
Connect to your instance in Python 
• From cassandra.cluster import Cluster 
cluster = Cluster() 
• This will attempt to connect to a cluster on your local machine. 
You could also give it an ip address and it will connect to that. 
cluster = Cluster(<ip_address>) 
• To connect to a node and begin begin actually running queries against our instance, we 
need a session, which is created by calling Cluster.connect() 
cluster = Cluster() 
Session = cluster.connect() 
• You can even connect to a particular keyspace 
cluster = Cluster() 
Session = cluster.connect(‘demo’)
Connect to your instance in Python 
• Select some data 
results = session.execute (””” 
SELECT * FROM demo.users 
“““)
Get familiar 
• Visit http://planetcassandra.org 
• Your #1 destination for NoSQL Apache Cassandra 
resources 
• Downloads, webinars, presentations, blog posts, and 
much, much more! 
• Check out the Try Cassandra section – for beginners!!
Try Cassandra
Thank you!! 
Any Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized ViewsCarl Yeksigian
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingVassilis Bekiaris
 
Introduction to data modeling with apache cassandra
Introduction to data modeling with apache cassandraIntroduction to data modeling with apache cassandra
Introduction to data modeling with apache cassandraPatrick McFadin
 
Python and cassandra
Python and cassandraPython and cassandra
Python and cassandraJon Haddad
 
Cassandra 3.0 Awesomeness
Cassandra 3.0 AwesomenessCassandra 3.0 Awesomeness
Cassandra 3.0 AwesomenessJon Haddad
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflixnkorla1share
 
Cassandra 3.0 advanced preview
Cassandra 3.0 advanced previewCassandra 3.0 advanced preview
Cassandra 3.0 advanced previewPatrick McFadin
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strataPatrick McFadin
 
Cassandra 2.0 and timeseries
Cassandra 2.0 and timeseriesCassandra 2.0 and timeseries
Cassandra 2.0 and timeseriesPatrick McFadin
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseDataStax Academy
 
Cassandra for Python Developers
Cassandra for Python DevelopersCassandra for Python Developers
Cassandra for Python DevelopersTyler Hobbs
 
NoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went awayNoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went awayCodemotion
 
The data model is dead, long live the data model
The data model is dead, long live the data modelThe data model is dead, long live the data model
The data model is dead, long live the data modelPatrick McFadin
 
DataStax: An Introduction to DataStax Enterprise Search
DataStax: An Introduction to DataStax Enterprise SearchDataStax: An Introduction to DataStax Enterprise Search
DataStax: An Introduction to DataStax Enterprise SearchDataStax Academy
 
The world's next top data model
The world's next top data modelThe world's next top data model
The world's next top data modelPatrick McFadin
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingDataStax Academy
 
Enter the Snake Pit for Fast and Easy Spark
Enter the Snake Pit for Fast and Easy SparkEnter the Snake Pit for Fast and Easy Spark
Enter the Snake Pit for Fast and Easy SparkJon Haddad
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache CassandraPatrick McFadin
 
Time series with Apache Cassandra - Long version
Time series with Apache Cassandra - Long versionTime series with Apache Cassandra - Long version
Time series with Apache Cassandra - Long versionPatrick McFadin
 

Was ist angesagt? (20)

Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized Views
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series Modeling
 
Introduction to data modeling with apache cassandra
Introduction to data modeling with apache cassandraIntroduction to data modeling with apache cassandra
Introduction to data modeling with apache cassandra
 
Python and cassandra
Python and cassandraPython and cassandra
Python and cassandra
 
Cassandra 3.0 Awesomeness
Cassandra 3.0 AwesomenessCassandra 3.0 Awesomeness
Cassandra 3.0 Awesomeness
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflix
 
Cassandra 3.0 advanced preview
Cassandra 3.0 advanced previewCassandra 3.0 advanced preview
Cassandra 3.0 advanced preview
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strata
 
Cassandra 2.0 and timeseries
Cassandra 2.0 and timeseriesCassandra 2.0 and timeseries
Cassandra 2.0 and timeseries
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
 
Cassandra for Python Developers
Cassandra for Python DevelopersCassandra for Python Developers
Cassandra for Python Developers
 
NoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went awayNoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went away
 
The data model is dead, long live the data model
The data model is dead, long live the data modelThe data model is dead, long live the data model
The data model is dead, long live the data model
 
DataStax: An Introduction to DataStax Enterprise Search
DataStax: An Introduction to DataStax Enterprise SearchDataStax: An Introduction to DataStax Enterprise Search
DataStax: An Introduction to DataStax Enterprise Search
 
The world's next top data model
The world's next top data modelThe world's next top data model
The world's next top data model
 
Cassandra 3.0
Cassandra 3.0Cassandra 3.0
Cassandra 3.0
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
Enter the Snake Pit for Fast and Easy Spark
Enter the Snake Pit for Fast and Easy SparkEnter the Snake Pit for Fast and Easy Spark
Enter the Snake Pit for Fast and Easy Spark
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache Cassandra
 
Time series with Apache Cassandra - Long version
Time series with Apache Cassandra - Long versionTime series with Apache Cassandra - Long version
Time series with Apache Cassandra - Long version
 

Ähnlich wie Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills

Webinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache CassandraWebinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache CassandraDataStax
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into CassandraBrent Theisen
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptxNaveen Kumar
 
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis
 
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...DataStax Academy
 
DataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with JavaDataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with Javacarolinedatastax
 
Slide presentation pycassa_upload
Slide presentation pycassa_uploadSlide presentation pycassa_upload
Slide presentation pycassa_uploadRajini Ramesh
 
Cassandra - A decentralized storage system
Cassandra - A decentralized storage systemCassandra - A decentralized storage system
Cassandra - A decentralized storage systemArunit Gupta
 
Machine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossMachine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossAndrew Flatters
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
Cassandra
Cassandra Cassandra
Cassandra Pooja GV
 
Apache Cassandra introduction
Apache Cassandra introductionApache Cassandra introduction
Apache Cassandra introductionfardinjamshidi
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementLaurent Leturgez
 
My sql with java
My sql with javaMy sql with java
My sql with javaoly07104
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache CassandraCassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache CassandraDataStax Academy
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesMats Kindahl
 

Ähnlich wie Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills (20)

Webinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache CassandraWebinar: Getting Started with Apache Cassandra
Webinar: Getting Started with Apache Cassandra
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into Cassandra
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptx
 
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
 
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...
Cassandra Community Webinar | Getting Started with Apache Cassandra with Patr...
 
DataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with JavaDataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with Java
 
Slide presentation pycassa_upload
Slide presentation pycassa_uploadSlide presentation pycassa_upload
Slide presentation pycassa_upload
 
Cassandra - A decentralized storage system
Cassandra - A decentralized storage systemCassandra - A decentralized storage system
Cassandra - A decentralized storage system
 
Machine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossMachine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy Cross
 
Cassandra
CassandraCassandra
Cassandra
 
Cassandra
Cassandra Cassandra
Cassandra
 
Apache Cassandra introduction
Apache Cassandra introductionApache Cassandra introduction
Apache Cassandra introduction
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
 
My sql with java
My sql with javaMy sql with java
My sql with java
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache CassandraCassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
MSSQL SERVER
MSSQL SERVERMSSQL SERVER
MSSQL SERVER
 
02 beginning code first
02   beginning code first02   beginning code first
02 beginning code first
 

Mehr von DataStax Academy

Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftForrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftDataStax Academy
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseDataStax Academy
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraDataStax Academy
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsDataStax Academy
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackDataStax Academy
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache CassandraDataStax Academy
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready CassandraDataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonDataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1DataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2DataStax Academy
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First ClusterDataStax Academy
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with DseDataStax Academy
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraDataStax Academy
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraDataStax Academy
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and DriversDataStax Academy
 
Getting Started with Graph Databases
Getting Started with Graph DatabasesGetting Started with Graph Databases
Getting Started with Graph DatabasesDataStax Academy
 

Mehr von DataStax Academy (20)

Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftForrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph Database
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready Cassandra
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
 
Cassandra Core Concepts
Cassandra Core ConceptsCassandra Core Concepts
Cassandra Core Concepts
 
Bad Habits Die Hard
Bad Habits Die Hard Bad Habits Die Hard
Bad Habits Die Hard
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
Advanced Cassandra
Advanced CassandraAdvanced Cassandra
Advanced Cassandra
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and Drivers
 
Getting Started with Graph Databases
Getting Started with Graph DatabasesGetting Started with Graph Databases
Getting Started with Graph Databases
 

Kürzlich hochgeladen

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 TerraformAndrey Devyatkin
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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 WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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.pdfsudhanshuwaghmare1
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Kürzlich hochgeladen (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills

  • 1. Getting Started with Apache Cassandra! Rebecca Mills Junior Evangelist DataStax @rebccamills! ©2013 DataStax Confidential. Do not distribute without consent.! 1!
  • 2. Don’t want to spend exorbitant amount of time and energy learning a new database? • Then you’ve come to the right place! • To learn some important basics of Cassandra without ever having to leave your couch • Just don’t get cheesy powder on your key board
  • 3. What do I do? • Try to create awareness for open source Cassandra • Develop content to get people interested in trying • Identify problems newcomers might be encountering • Develop strategies and material to help with that first ease of initial use
  • 4. Where can you download Cassandra? • The easiest way is to head straight to Planet Cassandra • http://planetcassandra.org/ • Go to the “Downloads” section, choose you operating system and the version of DSC that’ you’d like • Get crackin’!
  • 6. 2 things you should do to get going 1. Check your version of Java 2. Edit your cassandra.yaml file to point your Cassandra instance towards your home directory
  • 7. 1. Check your version of Java • To check what version of java you are using, at the prompt type % java –version • Be sure to use the latest version (JDK 7) on all nodes
  • 8. 2. Change default location to save data • Don’t run Cassandra as root • Other wise we will not be able to start Cassandra or have access to the directories where our data is being saved. • Access the cassandra.yaml file though the cassandra conf directory
  • 9. The 3 lines you should change in the cassandra.yaml file: Edit cassandra.yaml data_file_directories: - /var/lib/cassandra/data -$HOME/cassandra/data commitlog_directory: /var/lib/cassandra/commitlog $HOME/cassandra/commitlog saved_caches_directory: /var/lib/cassandra/saved_caches $HOME/cassandra/saved_caches
  • 10. 5 things you can do quickly 1. Start up an instance 2. Create a schema with CQL 3. Inject some data into our instance 4. Run a query against our database 5. Make a change to your data
  • 11. 1. Start up an instance • It’s very simple! Just go to your install location and start it from the bin directory as such: $ cd install_location $ bin/cassandra
  • 12. 2. Create a schema with CQL • From within your installation directory, start up your CQL shell from within the bin directory $ cd install_directory $ bin/cqlsh • You should see the cqlsh command prompt as such Connected to Test Cluster at localhost:9160. [cqlsh 4.1.1 | Cassandra 2.0.8 | CQL spec 3.1.1 | Thrift protocol 19.39.0] Use HELP for help. cqlsh>
  • 13. 2. Create a schema with CQL • A keyspace is a container for our data. Here we are creating a demo keyspace and a users table within. A table consists of rows and columns. CREATE KEYSPACE demo WITH REPLICATION = {‘class’:’SimpleStrategy’,’replication_factor’:1}; USE demo; CREATE TABLE users ( firstname text, lastname text, age int, email text, city text, PRIMARY KEY (lastname) );
  • 14. 3. Inject some data into your instance • Nothing sadder than an empty database. Here we are populating our “users” table with rows of data using the INSERT command. INSERT INTO users (firstname, lastname, age, email, city) VALUES (‘John’,’Smith’, 46, ‘johnsmith@email.com’, ‘Sacramento’); INSERT INTO users (firstname, lastname, age, email, city) VALUES (‘Jane’,’Doe’, 36, ‘janedoe@email.com’, ‘Beverly Hills’); INSERT INTO users (firstname, lastname, age, email, city) VALUES (‘Rob’,’Byrne’, 24, ‘robbyrne@email.com’, ‘San Diego’);
  • 15. 4. Make a query against your database SELECT * FROM users; lastname | age | city | email | firstname ----------+-----+---------------+---------------------+----------- Doe | 36 | Beverly Hills | janedoe@email.com | Jane Bryne | 24 | San Diego | robbyrne@email.com | Rob Smith | 46 | Sacramento | johnsmith@email.com | John SELECT * FROM users WHERE lastname=‘Doe’; lastname | age | city | email | firstname ----------+-----+---------------+-------------------+----------- Doe | 36 | Beverly Hills | janedoe@email.com | Jane
  • 16. 5. Make a change to your data UPDATE users SET city=‘San Jose’ WHERE lastname=‘Doe’; SELECT * FROM users WHERE lastname= ‘Doe’; lastname | age | city | email | firstname ----------+-----+----------+-------------------+------------- Doe | 36 | San Jose | janedoe@email.com | Jane SELECT * FROM users; DELETE FROM users WHERE lastname=‘Doe’; lastname | age | city | email | firstname ----------+-----+---------------+---------------------+----------- Bryne | 24 | San Diego | robbyrne@email.com | Rob Smith | 46 | Sacramento | johnsmith@email.com | John
  • 17. Two really neat tools: 1. Opscenter 2. DevCenter
  • 18. Dev Center • Try out your CQL in an easy-to-use tool • Has most of the same functionality as cqlsh with a few exceptions • Quickly connect to your cluster and keyspace. GO!
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Opscenter • Opscenter makes it easy to manage and configure your cluster!
  • 26. Change configurations • Just a couple clicks and you can reconfigure an entire cluster.
  • 27. Metrics • Diagnosis problems with your cluster
  • 28. How about multi datacenter? Of course!
  • 29. You can run an AWS AMI from Opscenter! • Run a Cassandra instance/cluster in the cloud! • Using Amazon Web Services EC2 Management Console • Quickly deploy a Cassandra cluster within a single availability zone through Opscenter • Check out http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installAMI.html
  • 30.
  • 31.
  • 32. What about the drivers • Datastax provides drivers for Java, Python, C#, and C++ • There are also many open sources community drivers, including Closure, Go, Node.js and many many more.
  • 33. Connect to your instance with Java • Create a new Java class, com.example.cassandra.SimpleClient for example • Add an instance field to hold cluster reference private Cluster cluster; • Add an instance method, connect, to your new class. Here you can add your contact point, the ip address of your node. public void connect(String node) { cluster = Cluster.builder() .addContactPoint(<ip_address>) .build(); } • Add an instance method, close, to shut down the cluster once you are finished public void close() { cluster.close(); }
  • 34. Connect to your instance with Java • In your main class, create a SimpleClient object, call connect, and close it public static void main(String[] args) { SimpleClient client = new SimpleClient(); client .connect(<ip_address>); client.close(); } • Select some data session.execute (‘SELECT * FROM demo.users’);
  • 35. Connect to your instance in Python • From cassandra.cluster import Cluster cluster = Cluster() • This will attempt to connect to a cluster on your local machine. You could also give it an ip address and it will connect to that. cluster = Cluster(<ip_address>) • To connect to a node and begin begin actually running queries against our instance, we need a session, which is created by calling Cluster.connect() cluster = Cluster() Session = cluster.connect() • You can even connect to a particular keyspace cluster = Cluster() Session = cluster.connect(‘demo’)
  • 36. Connect to your instance in Python • Select some data results = session.execute (””” SELECT * FROM demo.users “““)
  • 37. Get familiar • Visit http://planetcassandra.org • Your #1 destination for NoSQL Apache Cassandra resources • Downloads, webinars, presentations, blog posts, and much, much more! • Check out the Try Cassandra section – for beginners!!
  • 39. Thank you!! Any Questions?