SlideShare une entreprise Scribd logo
1  sur  40
Apache Cassandra, part 3 – machinery, work with Cassandra
V. Architecture (part 2)
SEDA Architecture SEDA – Staged event-driven architecture Every unit of work is split into several stages that are executed in parallel threads.  Each stage consist of input and output event queue, event handler and stage controller.
SEDA Architecture advantages Well conditioned system load Preventing resources from being overcommitted.
SEDA in Cassandra - Usages Read Mutation Gossip Anti – Entropy ….
SEDA in Cassandra - Design  Stage Manager presents Map between stage names and Java 5 thread pool executers. Each controller with queue is presented by ThreadPoolExecuter that can be configured through JMX.
VI. Working with Cassandra
Installing and launching Cassandra Download from http://cassandra.apache.org/download/
Installing and launching Cassandra Launching server:  bin/cassandra.bat use “-f” key to run sever in foreground, so that all of the server logs will print to standard out is started with single node cluster called “Test Cluster” listening on port 9160
Installing and launching Cassandra Starting command-line client interface: bin/cassandra-cli.bat you see [username@keyspace] at the beginning of every line
Creating a cluster In configuration file cassandra.yaml specify:  seeds – the list of seeds for the cluster rpc_address and listen_address – network addresses
Creating a cluster initial_token – defining the node’s token range auto_bootstrap – enables auto-migration of data to the new node
nodetool ring Use nodetool for view configuration ~$ nodetool -h localhost -p 8080 ring    Address           Status  State     Load         Owns    Range             Ring                                                                                   850705…    10.203.71.154   Up      Normal  2.53 KB    50.00    0|<--|    10.203.55.186   Up      Normal  1.33 KB    50.00    850705…|-->|
Connecting to server Connect from command line: connect <HOSTNAME>/<PORT> [<USERNAME> ‘<PASSWORD>’]; Examples: connect localhost/9160; 			connect 127.0.0.1/9160 user ‘password’; Connect when staring command line client: cassandra-cli 		 	–h,––host <HOSTNAME> 			–p,––port <PORT> 			–k,––keyspace <KEYSPACE> 			–u,––username <USERNAME> 			–p,––password <PASSWORD>
Describing environment show cluster name; show keyspaces; show api version; describe cluster; describe keyspace [<KEYSPACE>];
Create keyspace create keyspace <KEYSPACE>; create keyspace <KEYSPACE> with 		<ATTR1> = <VAL1> and 		<ATTR2> = <VAL2> ...; Attributes: placement_strategy replication_factor …
Create keyspace Example: create keyspace Keyspace1 with placement_strategy = ‘org.apache.cassandra.locator.RackUnawareStrategy’ and replication_factor = 4;
Update keyspace Update attributes of created keyspace: 	update keyspace <KEYSPACE> with 		<ATTR1> = <VAL1> and  		<ATTR2> = <VAL2> ...;
Switch to keyspace use <KEYSPACE>; use <KEYSPACE> [<USERNAME> ‘<PASSWORD>’]; If you don’t specify username and password then credentials supplied to the ‘connect’ statement will be used If the server doesn’t support authentication it will ignore credentials
Switch to keyspace Example: use Keyspace1 user1 ‘qwerty123’; When you use keyspace you’ll see [user1@Keyspace1] at the beginning of every line
Create column family create column family <COL_FAMILY>; create column family <COL_FAMILY> with 		<ATTR1> = <VAL1> and 		<ATTR2> = <VAL1> ...; Example: create column family Users with column_type = Super and 	comparator = UTF8Type and rows_cached = 1000;
Update column family When column family is created you can update its attributes: 	update column family <COL_FAMILY> with 		<ATTR1> = <VAL1> and 		<ATTR2> = <VAL1> ...;
Comparators and validators Comparators – compare column names Validators – validate column values
Comparators and validators You can specify comparator for column family and all subcolumns in column family (one for all) You can specify validators for each known column of column family You can specify default validator for column family that will be used for columns for which validators aren’t specified You can specify key validatorwhich will validate row keys
Attributes of column family column_type: can be Standard or Super(default - Standard) comparator: specifies how column names will be compared for sort order column_metadata: defines the validation and indexes for known columns default_validation_class: validator to use for values in columns which are not listed in the column_metadata. (default – BytesType) key_validation_class: validator for keys
Column metadata You can define validators for each known column in the family 	create column family User with column_metadata = [ 		{column_name: name, validation_class: UTF8Type}, 		{column_name: age, validation_class: IntegerType},  		{column_name: birth, validation_class: UTF8Type} 	]; Columns not listed in this section are validated with default_validation_class
Secondary indexes Allows queries by value 		get users where name = ‘Some user'; Can be created in background
Creating index Define it in column metadata For example in cassandra-cli:create column family users with comparator=UTF8Type and column_metadata=[{column_name: birth_date, validation_class: LongType, index_type: KEYS}];
Some restrictions Cassandra use hash indexes instead of btree indexes. Thus, in where condition at least one indexed field with operator “=“ must be presentSo, you can’t useget users where birth_date > 1970; but canget users where birth_date = 1990 and karma > 50;
Index types KEYS BITMAP (will be supported in future releases)
Writing data To write data use set command: set Customers[‘ivan’][‘name’] = ‘Ivan’; set Customers[‘makar’][‘info’][‘age’] = 96;
Reading data To read data use get command: get Customers[‘ivan’][‘name’]; - this will display ‘Ivan’ get Customers[‘makar’]; - this will display all columns for key ‘makar’
Reading data To list a range of rows use list command: list Customers; list Customers[a:]; list Customers[a:c] limit 40; - you can specify limit of rows that will be displayed (default - 100)
Reading data To get columns number use count command: count Customers[‘ivan’] - this will display number of columns for key ‘ivan’
Deleting data To delete a row, a column or a subcolumn use del command: del Customers[‘ivan’]; - this will delete all columns for key ‘ivan’ del Customers[‘ivan’][‘name’]; - this will delete column name for key ‘ivan’ del Customers[‘ivan’][‘accounts’][‘2312784829312343’]; - this will delete a subcolumn with an account number from ‘accounts’ column for key ‘ivan’
Deleting data To delete all data in a column family use truncate command: truncate Customers;
Drop column family or keyspace 	drop column family Customers; 	drop keyspace Keyspace1;
Q&A
Resources Home of Apache Cassandra Project http://cassandra.apache.org/ Apache Cassandra Wiki http://wiki.apache.org/cassandra/ Documentation provided by DataStaxhttp://www.datastax.com/docs/0.8/ Good explanation of creation secondary indexes http://www.anuff.com/2010/07/secondary-indexes-in-cassandra.html Eben Hewitt “Cassandra: The Definitive Guide”, O’REILLY, 2010, ISBN: 978-1-449-39041-9
Authors Lev Sivashov- lsivashov@gmail.com Andrey Lomakin - lomakin.andrey@gmail.com, twitter: @Andrey_LomakinLinkedIn: http://www.linkedin.com/in/andreylomakin Artem Orobets – enisher@gmail.comtwitter: @Dr_EniSh Anton Veretennik - tennik@gmail.com

Contenu connexe

Tendances

Cassandra
CassandraCassandra
Cassandrapcmanus
 
Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3DataStax
 
Cassandra and Spark
Cassandra and Spark Cassandra and Spark
Cassandra and Spark datastaxjp
 
Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2Knoldus Inc.
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupMichael Wynholds
 
Kafka zero to hero
Kafka zero to heroKafka zero to hero
Kafka zero to heroAvi Levi
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized ViewsCarl Yeksigian
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBMongoDB
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra ExplainedEric Evans
 
Cassandra Community Webinar | Become a Super Modeler
Cassandra Community Webinar | Become a Super ModelerCassandra Community Webinar | Become a Super Modeler
Cassandra Community Webinar | Become a Super ModelerDataStax
 
Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Markus Klems
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011Takahiko Ito
 
Go Programming Patterns
Go Programming PatternsGo Programming Patterns
Go Programming PatternsHao Chen
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgzznate
 
Cassandra EU - Data model on fire
Cassandra EU - Data model on fireCassandra EU - Data model on fire
Cassandra EU - Data model on firePatrick McFadin
 
Cassandra 2012
Cassandra 2012Cassandra 2012
Cassandra 2012beobal
 
Cassandra 2.0 better, faster, stronger
Cassandra 2.0   better, faster, strongerCassandra 2.0   better, faster, stronger
Cassandra 2.0 better, faster, strongerPatrick McFadin
 
Cassandra 2.1 boot camp, Protocol, Queries, CQL
Cassandra 2.1 boot camp, Protocol, Queries, CQLCassandra 2.1 boot camp, Protocol, Queries, CQL
Cassandra 2.1 boot camp, Protocol, Queries, CQLJoshua McKenzie
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strataPatrick McFadin
 

Tendances (20)

Cassandra
CassandraCassandra
Cassandra
 
Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3
 
Cassandra and Spark
Cassandra and Spark Cassandra and Spark
Cassandra and Spark
 
Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL Meetup
 
Kafka zero to hero
Kafka zero to heroKafka zero to hero
Kafka zero to hero
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized Views
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
Cassandra Community Webinar | Become a Super Modeler
Cassandra Community Webinar | Become a Super ModelerCassandra Community Webinar | Become a Super Modeler
Cassandra Community Webinar | Become a Super Modeler
 
Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011
 
Go Programming Patterns
Go Programming PatternsGo Programming Patterns
Go Programming Patterns
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhg
 
Cassandra EU - Data model on fire
Cassandra EU - Data model on fireCassandra EU - Data model on fire
Cassandra EU - Data model on fire
 
Cassandra 2012
Cassandra 2012Cassandra 2012
Cassandra 2012
 
Cassandra 2.0 better, faster, stronger
Cassandra 2.0   better, faster, strongerCassandra 2.0   better, faster, stronger
Cassandra 2.0 better, faster, stronger
 
Cassandra 2.1 boot camp, Protocol, Queries, CQL
Cassandra 2.1 boot camp, Protocol, Queries, CQLCassandra 2.1 boot camp, Protocol, Queries, CQL
Cassandra 2.1 boot camp, Protocol, Queries, CQL
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strata
 

En vedette

Cassandra internals
Cassandra internalsCassandra internals
Cassandra internalsnarsiman
 
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...DataStax
 
High performance queues with Cassandra
High performance queues with CassandraHigh performance queues with Cassandra
High performance queues with CassandraMikalai Alimenkou
 
Always On: Building Highly Available Applications on Cassandra
Always On: Building Highly Available Applications on CassandraAlways On: Building Highly Available Applications on Cassandra
Always On: Building Highly Available Applications on CassandraRobbie Strickland
 
CQRS innovations (English version)
CQRS innovations (English version)CQRS innovations (English version)
CQRS innovations (English version)Andrey Lomakin
 
Apache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelApache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelAndrey Lomakin
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestDuyhai Doan
 
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
 
Cooking Cassandra
Cooking CassandraCooking Cassandra
Cooking CassandraOpen-IT
 

En vedette (11)

Cassandra internals
Cassandra internalsCassandra internals
Cassandra internals
 
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...
CassieQ: The Distributed Message Queue Built on Cassandra (Anton Kropp, Cural...
 
High performance queues with Cassandra
High performance queues with CassandraHigh performance queues with Cassandra
High performance queues with Cassandra
 
Always On: Building Highly Available Applications on Cassandra
Always On: Building Highly Available Applications on CassandraAlways On: Building Highly Available Applications on Cassandra
Always On: Building Highly Available Applications on Cassandra
 
CQRS innovations (English version)
CQRS innovations (English version)CQRS innovations (English version)
CQRS innovations (English version)
 
Apache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelApache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data model
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
 
Cassandra queuing
Cassandra queuingCassandra queuing
Cassandra queuing
 
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
 
Cooking Cassandra
Cooking CassandraCooking Cassandra
Cooking Cassandra
 
Обзор кредитной активности банков в I квартале 2014 года
Обзор кредитной активности банков в I квартале 2014 годаОбзор кредитной активности банков в I квартале 2014 года
Обзор кредитной активности банков в I квартале 2014 года
 

Similaire à Apache Cassandra, part 3 – machinery, work with Cassandra

Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Return on Intelligence
 
KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!Guido Schmutz
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
MYSQL
MYSQLMYSQL
MYSQLARJUN
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL FELIX
 
IBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM Systems UKI
 
Philly security shell meetup
Philly security shell meetupPhilly security shell meetup
Philly security shell meetupNicole Johnson
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot netssa2010
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
 
PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)Jerome Eteve
 

Similaire à Apache Cassandra, part 3 – machinery, work with Cassandra (20)

Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
 
PHP tips by a MYSQL DBA
PHP tips by a MYSQL DBAPHP tips by a MYSQL DBA
PHP tips by a MYSQL DBA
 
MYSQL
MYSQLMYSQL
MYSQL
 
KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Proxy
ProxyProxy
Proxy
 
MYSQL
MYSQLMYSQL
MYSQL
 
Asterisk_MySQL_Cluster_Presentation.pdf
Asterisk_MySQL_Cluster_Presentation.pdfAsterisk_MySQL_Cluster_Presentation.pdf
Asterisk_MySQL_Cluster_Presentation.pdf
 
Sah
SahSah
Sah
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
 
IBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM MQ Channel Authentication
IBM MQ Channel Authentication
 
Iuwne10 S02 L02
Iuwne10 S02 L02Iuwne10 S02 L02
Iuwne10 S02 L02
 
Philly security shell meetup
Philly security shell meetupPhilly security shell meetup
Philly security shell meetup
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Dat402
Dat402Dat402
Dat402
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot net
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)
 

Dernier

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Dernier (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

Apache Cassandra, part 3 – machinery, work with Cassandra

  • 1. Apache Cassandra, part 3 – machinery, work with Cassandra
  • 3. SEDA Architecture SEDA – Staged event-driven architecture Every unit of work is split into several stages that are executed in parallel threads. Each stage consist of input and output event queue, event handler and stage controller.
  • 4. SEDA Architecture advantages Well conditioned system load Preventing resources from being overcommitted.
  • 5. SEDA in Cassandra - Usages Read Mutation Gossip Anti – Entropy ….
  • 6. SEDA in Cassandra - Design Stage Manager presents Map between stage names and Java 5 thread pool executers. Each controller with queue is presented by ThreadPoolExecuter that can be configured through JMX.
  • 7. VI. Working with Cassandra
  • 8. Installing and launching Cassandra Download from http://cassandra.apache.org/download/
  • 9. Installing and launching Cassandra Launching server: bin/cassandra.bat use “-f” key to run sever in foreground, so that all of the server logs will print to standard out is started with single node cluster called “Test Cluster” listening on port 9160
  • 10. Installing and launching Cassandra Starting command-line client interface: bin/cassandra-cli.bat you see [username@keyspace] at the beginning of every line
  • 11. Creating a cluster In configuration file cassandra.yaml specify: seeds – the list of seeds for the cluster rpc_address and listen_address – network addresses
  • 12. Creating a cluster initial_token – defining the node’s token range auto_bootstrap – enables auto-migration of data to the new node
  • 13. nodetool ring Use nodetool for view configuration ~$ nodetool -h localhost -p 8080 ring Address Status State Load Owns Range Ring 850705… 10.203.71.154 Up Normal 2.53 KB 50.00 0|<--| 10.203.55.186 Up Normal 1.33 KB 50.00 850705…|-->|
  • 14. Connecting to server Connect from command line: connect <HOSTNAME>/<PORT> [<USERNAME> ‘<PASSWORD>’]; Examples: connect localhost/9160; connect 127.0.0.1/9160 user ‘password’; Connect when staring command line client: cassandra-cli –h,––host <HOSTNAME> –p,––port <PORT> –k,––keyspace <KEYSPACE> –u,––username <USERNAME> –p,––password <PASSWORD>
  • 15. Describing environment show cluster name; show keyspaces; show api version; describe cluster; describe keyspace [<KEYSPACE>];
  • 16. Create keyspace create keyspace <KEYSPACE>; create keyspace <KEYSPACE> with <ATTR1> = <VAL1> and <ATTR2> = <VAL2> ...; Attributes: placement_strategy replication_factor …
  • 17. Create keyspace Example: create keyspace Keyspace1 with placement_strategy = ‘org.apache.cassandra.locator.RackUnawareStrategy’ and replication_factor = 4;
  • 18. Update keyspace Update attributes of created keyspace: update keyspace <KEYSPACE> with <ATTR1> = <VAL1> and <ATTR2> = <VAL2> ...;
  • 19. Switch to keyspace use <KEYSPACE>; use <KEYSPACE> [<USERNAME> ‘<PASSWORD>’]; If you don’t specify username and password then credentials supplied to the ‘connect’ statement will be used If the server doesn’t support authentication it will ignore credentials
  • 20. Switch to keyspace Example: use Keyspace1 user1 ‘qwerty123’; When you use keyspace you’ll see [user1@Keyspace1] at the beginning of every line
  • 21. Create column family create column family <COL_FAMILY>; create column family <COL_FAMILY> with <ATTR1> = <VAL1> and <ATTR2> = <VAL1> ...; Example: create column family Users with column_type = Super and comparator = UTF8Type and rows_cached = 1000;
  • 22. Update column family When column family is created you can update its attributes: update column family <COL_FAMILY> with <ATTR1> = <VAL1> and <ATTR2> = <VAL1> ...;
  • 23. Comparators and validators Comparators – compare column names Validators – validate column values
  • 24. Comparators and validators You can specify comparator for column family and all subcolumns in column family (one for all) You can specify validators for each known column of column family You can specify default validator for column family that will be used for columns for which validators aren’t specified You can specify key validatorwhich will validate row keys
  • 25. Attributes of column family column_type: can be Standard or Super(default - Standard) comparator: specifies how column names will be compared for sort order column_metadata: defines the validation and indexes for known columns default_validation_class: validator to use for values in columns which are not listed in the column_metadata. (default – BytesType) key_validation_class: validator for keys
  • 26. Column metadata You can define validators for each known column in the family create column family User with column_metadata = [ {column_name: name, validation_class: UTF8Type}, {column_name: age, validation_class: IntegerType}, {column_name: birth, validation_class: UTF8Type} ]; Columns not listed in this section are validated with default_validation_class
  • 27. Secondary indexes Allows queries by value get users where name = ‘Some user'; Can be created in background
  • 28. Creating index Define it in column metadata For example in cassandra-cli:create column family users with comparator=UTF8Type and column_metadata=[{column_name: birth_date, validation_class: LongType, index_type: KEYS}];
  • 29. Some restrictions Cassandra use hash indexes instead of btree indexes. Thus, in where condition at least one indexed field with operator “=“ must be presentSo, you can’t useget users where birth_date > 1970; but canget users where birth_date = 1990 and karma > 50;
  • 30. Index types KEYS BITMAP (will be supported in future releases)
  • 31. Writing data To write data use set command: set Customers[‘ivan’][‘name’] = ‘Ivan’; set Customers[‘makar’][‘info’][‘age’] = 96;
  • 32. Reading data To read data use get command: get Customers[‘ivan’][‘name’]; - this will display ‘Ivan’ get Customers[‘makar’]; - this will display all columns for key ‘makar’
  • 33. Reading data To list a range of rows use list command: list Customers; list Customers[a:]; list Customers[a:c] limit 40; - you can specify limit of rows that will be displayed (default - 100)
  • 34. Reading data To get columns number use count command: count Customers[‘ivan’] - this will display number of columns for key ‘ivan’
  • 35. Deleting data To delete a row, a column or a subcolumn use del command: del Customers[‘ivan’]; - this will delete all columns for key ‘ivan’ del Customers[‘ivan’][‘name’]; - this will delete column name for key ‘ivan’ del Customers[‘ivan’][‘accounts’][‘2312784829312343’]; - this will delete a subcolumn with an account number from ‘accounts’ column for key ‘ivan’
  • 36. Deleting data To delete all data in a column family use truncate command: truncate Customers;
  • 37. Drop column family or keyspace drop column family Customers; drop keyspace Keyspace1;
  • 38. Q&A
  • 39. Resources Home of Apache Cassandra Project http://cassandra.apache.org/ Apache Cassandra Wiki http://wiki.apache.org/cassandra/ Documentation provided by DataStaxhttp://www.datastax.com/docs/0.8/ Good explanation of creation secondary indexes http://www.anuff.com/2010/07/secondary-indexes-in-cassandra.html Eben Hewitt “Cassandra: The Definitive Guide”, O’REILLY, 2010, ISBN: 978-1-449-39041-9
  • 40. Authors Lev Sivashov- lsivashov@gmail.com Andrey Lomakin - lomakin.andrey@gmail.com, twitter: @Andrey_LomakinLinkedIn: http://www.linkedin.com/in/andreylomakin Artem Orobets – enisher@gmail.comtwitter: @Dr_EniSh Anton Veretennik - tennik@gmail.com