Book Image

Apache Cassandra Essentials

By : Nitin Padalia
Book Image

Apache Cassandra Essentials

By: Nitin Padalia

Overview of this book

Apache Cassandra Essentials takes you step-by-step from from the basics of installation to advanced installation options and database design techniques. It gives you all the information you need to effectively design a well distributed and high performance database. You’ll get to know about the steps that are performed by a Cassandra node when you execute a read/write query, which is essential to properly maintain of a Cassandra cluster and to debug any issues. Next, you’ll discover how to integrate a Cassandra driver in your applications and perform read/write operations. Finally, you’ll learn about the various tools provided by Cassandra for serviceability aspects such as logging, metrics, backup, and recovery.
Table of Contents (14 chapters)
Apache Cassandra Essentials
About the Author
About the Reviewers

A database and schema

A Cassandra database schema has two major building blocks: Keyspace, Column Family and Primary Key for Column Family. Let's discuss them in some detail.


In previous chapters we learned that similar to RDBMS database Cassandra Keyspace is a namespace that logically contains a set of tables. A keyspace has there configuration options;

  • Replication Strategy

  • Replication Factor

  • The durable_writes

Former two options we already discussed in previous chapter. The durable_writes option lets you to enable or disable the option of using commit log for updates. By default durable_writes is enabled and its suggested to keep this enabled.

We know how to create a keyspace but what if the keyspace already exists. in such case Cassandra will return error. However we can use IF NOT EXISTS option to disable error; using IF NOT EXISTS option Cassandra will do nothing if keyspace exists otherwise it'll create it:

CREATE KEYSPACE IF NOT EXISTS cassandrademodb WITH replication = {'class'...