Building Applications with Apache Cassandra
A Quickstart Guide to Cassandra for Java Developers and Architects
Apache Cassandra is an open-source distributed database management system designed to handle large amounts of data across many commodity servers, providing horizontal scalability and high availability with no single point of failure. Join Jeff Carpenter for this interactive training session in which you’ll hit the ground running with Cassandra, learning how to create data models and client applications in Java. Along the way, we’ll peek under the covers of Cassandra’s architecture so that you’ll understand how to get the most out of this powerful, highly scalable database.
What you'll learn-and how you can apply it
By the end of this live, hands-on, online course, you’ll understand:
- Cassandra’s architecture (at a high level) and how it works
- How Cassandra is different from traditional databases, and how those differences affect data modeling and application development
- How to determine whether Cassandra is a good fit for your application
- Cassandra’s features, especially as available through the client drivers
- Configuration options available (at a high level)
And you’ll be able to:
- Design Cassandra data models that will perform / scale effectively
- Create application programs using the DataStax Java Driver
- Use tools including as cqlsh, nodetool, CCM, and DataStax DevCenter
This training course is for you because...
- You are a developer looking to get started quickly building applications using Cassandra. We’ll focus on development in Java but the concepts are applicable to writing applications on top of Cassandra in any of the supported languages.
- You are an architect interested in Cassandra’s architecture and data modeling philosophy. By gaining a sense of the features available to application developers will help you determine when to use Cassandra, map out design approaches, and guide development teams.
- Background in Java development
- Familiarity with basic database concepts
- Read Chapters 1 through 4 of Cassandra: The Definitive Guide, second edition.
- Make sure you have a Java JDK 11 or 12 installed
- For example: https://jdk.java.net/12/
- Have your editor/IDE of choice ready for the course exercises.
- For example: IntelliJ IDEA, Eclipse
- Recommended: IntelliJ IDEA Ultimate (30-day trial available)
- Download the exercise source code from GitHub.
- For the first half of the course, we’ll be running Cassandra Query Language (CQL) commands in cqlsh. You can find the files containing the commands in this gist:
- For the second half of the course, we’ll be using a sample Java microservice implemented as a Spring Boot application, which you can access by running:
- git clone https://github.com/jeffreyscarpenter/reservation-service
- Download Cassandra.
- Review Chapters 5 through 9 of Cassandra: The Definitive Guide, second edition, to reinforce concepts covered in the course
- Watch Data Modeling for Microservices with Cassandra and Spark (conference talk)
- Watch An Introduction to Time Series with Team Apache (video course)
- Watch Cassandra Administration (video course)
- Read Cassandra 3.x High Availability, second edition (book)
About your instructor
Jeff Carpenter is a developer advocate at DataStax, where he leverages his background in system architecture, microservices and Apache Cassandra to help empower developers and operations engineers build distributed systems that are scalable, reliable, and secure. Jeff has worked on projects ranging from a complex battle planning system in an austere network environment, to a cloud-based hotel reservation system. He the author of Cassandra: The Definitive Guide, 2nd Edition.
The timeframes are only estimates and may vary according to how the class is progressing
Introduction, install and cqlsh (45 minutes)
- Introductions: Who is Jeff? Who are you?
- Presentation: Introducing Cassandra, key terms, and concepts that will be used throughout the course.
- Discussion: Is Cassandra a Good Fit for my project?
- Exercise: Setup your environment to do the course exercises.
- Exercise: Running cqlsh. Run cqlsh, create tables, read and write some data.
- Break (5 minutes)
Data Modeling (50 minutes)
- Exercise: Cassandra data types. Create and manipulate additional tables using various built-in data types, collections and UDTs.
- Exercise: Query options. Learn more about WHERE, IN, SORT clauses through examples. Create indexes and materialized views.
- Presentation: Cassandra Data Modeling Principles. Partition keys, clustering columns, sort order. Designing queries around access patterns.
- Exercise: Data modeling. Create a reservation schema based on a provided design.
- Q&A and Discussion: Discuss results of data modeling exercise.
- Break (5 minutes)
Basic Application Development (65 minutes)
- Presentation: Introduction to Drivers. Drivers for various languages and common features.
- Exercise: DataStax Java Driver. Run the provided program. Examine project Maven dependencies, Java includes, and write code to connect to a Cassandra cluster and execute simple statements.
- Presentation: Cassandra Clusters. What is a cluster? Various topologies and their merits.
- Exercise: Additional Statements. Write code to demonstrate PreparedStatements, BoundStatements. (Additional exercises on QueryBuilder and ObjectMapper available for learners to puruse on their own time.)
- Exercise: Consistency Level. Update code to set consistency level on statements.
- Presentation: Replication, consistency and the CAP theorem. Discuss concepts of replication and consistency in Cassandra and how it works.
- Break (5 minutes)
Advanced Application Development (65 minutes)
- Exercise: Batches and transactions
- Presentation: Batches, Lightweight transactions and Paxos. How Cassandra’s Batches and LWTs work and their limitations.
- Exercise: Paging
- Presentation: Policies, speculative retry, and schema creation
- Exercise: Tracing. Viewing traces in cqlsh, DevCenter, and logs.
- Presentation: Cassandra Read and Write Paths
- Exercise: Deleting Data
- Presentation: TTL, Deletion and Tombstones
- Discussion: What’s next