SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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 года
 

Semelhante a 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
 

Semelhante a 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)
 

Último

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Último (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

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