Amirhossein Saberi May 2016 CASSANDRA NAME A daughter
Amirhossein Saberi May 2016
CASSANDRA NAME A daughter of the Trojan king Priam, who was given the gift of prophecy by Apollo. When she cheated him, however, he turned this into a curse by causing her prophecies, though true, to be disbelieved.
RDBMS VS NOSQL Vertical scaling Horizontal scaling
WHAT'S WRONG WITH RELATIONAL DATABASE?
ACID GUARANTEE TRANSACTIONS ARE PROCESSED • Atomic: Atomic means “all or nothing” • Consistent: Consistent means that data moves from one correct state to another correct state • Isolated: Isolated means that transactions executing concurrently will not become entangled with each • other • Durable: Once a transaction has succeeded, the changes will not be lost
INTRODUCTION Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. • Original authors: Avinash Lakshman, Prashant Malik • Developer: Apache Software Foundation (Initially developed by Facebook to power their Inbox Search feature) • Initial release: 2008 • Stable release: 3. 4 / March 8, 2016 • Written in: Java • Type: Database / No. SQL • License: Apache License 2. 0 (permissive free software license)
MAIN FEATURES • Decentralized: Data located, stored, and maintained in a single location • Supports replication and multi data center replication • Scalability (Elastic Scaling) • Fault-tolerant • Tunable consistency: Strong consistency or eventual? • Map. Reduce support: programming model and an associated implementation for processing and generating large data sets with a parallel, distributed algorithm on a cluster. • Cassandra Query language (CQL) • Fast write
WHAT PROBLEM DO YOU HAVE? RDBMS, No. SQL. The horse, the car, the plane. They each build on prior art, they each attempt to solve certain problems, and so they’re each good at certain things—and less good at others. They each coexist, even now. Do u need to fully support transactions with ACID guarantee? Do u need to have high availability and horizontal scalability?
CAP THEOREM • Consistency (all nodes see the same data at the same time - every read would get you the most recent write) • Availability (a guarantee that every request receives a response about whether it succeeded or failed) • Partition tolerance (the system continues to operate despite arbitrary partitioning due to network failures)
CASSANDRA IN CAP
DATA MODEL My. SQL Cassandra
REPLICATION • Simple Strategy: Specifies a simple replication factor for the cluster. • Network Topology Strategy: Using this option, you can set the replication factor for each data-center independently. • Old Network Topology Strategy: This is a legacy replication strategy.
INSTALLATION 1. Download & Install JAVA 2. Download & Install Cassandra
COMMANDS [saberi@linux bin]$ cqlsh Connected to Test Cluster at 127. 0. 0. 1: 9042. [cqlsh 5. 0. 1 | Cassandra 2. 1. 2 | CQL spec 3. 2. 0 | Native protocol v 3] Use HELP for help. cqlsh> - CREATE KEYSPACE “Key. Space Name WITH replication = {'class': ‘Strategy name’, 'replication_factor' : ‘No. Of replicas’}; - CREATE TABLE tablename( column 1 name datatype PRIMARYKEY, column 2 name data type, column 3 name data type. ) - INSERT INTO <tablename> (<column 1 name>, <column 2 name>. . ) VALUES (<value 1>, <value 2>. . ) USING <option> - SELECT FROM <tablename>
REFERENCES • http: //robertgreiner. com/2014/06/cap-theorem-explained/ • https: //en. wikipedia. org/wiki/CAP_theorem • https: //dzone. com/articles/better-explaining-cap-theorem • http: //www. tutorialspoint. com/cassandra_read_data. htm • https: //en. wikipedia. org/wiki/Apache_Cassandra • http: //www. datastax. com/nosql-databases • http: //kkovacs. eu/cassandra-vs-mongodb-vs-couchdb-vs-redis • http: //www. datastax. com/2011/09/cassandra-for-enterprise-tuneable-consistency-its-your-choice
- Slides: 15