SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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 года
 

Ähnlich wie 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
 

Ähnlich wie 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)
 

Kürzlich hochgeladen

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Kürzlich hochgeladen (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

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