You are previewing Instant Cassandra Query Language.
O'Reilly logo
Instant Cassandra Query Language

Book Description

A practical, step-by-step guide for quickly started with CassandraQuery Language

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results

  • Covers the most frequently used constructs using practical examples

  • Dive deeper into CQL, TTL, batch operations, and more

  • Learn how to shed Thrift and adopt a CQL-based binary protocol

In Detail

Apache Cassandra is a fault-tolerant, distributed data store that offers linear scalability, allowing it to act as a storage platform for large, high-volume websites. Cassandra Query Language, or CQL, is the default language/method used to access, change, and query the Cassandra database. It is essential to learn how to use CQL since the old RPC-based mechanism is now giving way to CQL-based Cassandra drivers.

Instant Cassandra Query Language serves as a great starting point for anyone who has started working on Cassandra and who wishes to learn its query language, CQL, in a simple, concise, and quick way. It teaches you how to use CQL in an efficient manner and shows you the exact query commands you need to run.

Instant Cassandra Query Language takes you on a journey through Cassandra Query Language. We first introduce CQL and help you to get started with it by installing, configuring, and opening the console. In order to get a quick feel for it before delving deeper into its inner workings, we’ll run some basic read and write commands. After the stage is set, we’ll design and experiment with a simple social media application, explaining the different CQL constructs used along the way.

You’ll also learn some specific skills like how to specify database columns that expire after a certain period of time, how to create batch operations, and more. Since CQL is used as a base for Cassandra drivers, it’s important to explore the usage of CQL via different libraries. You’ll learn how to write client applications over Cassandra in different ways, namely using Thrift and Datastax Java Driver. A listing of high-level clients is also provided that serves as a good starting point for you to explore them further. With this book, you’ll learn everything you’re likely to encounter while working with CQL.

Table of Contents

  1. Instant Cassandra Query Language
    1. Instant Cassandra Query Language
    2. Credits
    3. About the Author
    4. About the Reviewers
      1. Support files, eBooks, discount offers and more
      1. Why Subscribe?
      2. Free Access for Packt account holders
    7. 1. Instant Cassandra Query Language
      1. So, what is CQL?
        1. Where will you use CQL?
      2. Installation
        1. Step 1 – what do I need?
        2. Step 2 – download Cassandra
        3. Step 3 – install Cassandra
        4. Step 4 – configure Cassandra
        5. Step 5 – start Cassandra server
          1. What may go wrong?
        6. And that's it
      3. Quick start – running CQL queries
        1. Step 1 – start CQL shell (cqlsh)
          1. On Unix
          2. On Windows
            1. Install and configure Python
            2. Run cqlsh
        2. Step 2 – create and use a keyspace
        3. Step 3 – describe and list keyspace
        4. Step 4 – create table and insert records
        5. Step 5 – display records
          1. How is data actually stored?
        6. Step 6 – deleting data
          1. DELETE
          2. TRUNCATE
          3. USING TTL
          4. Dropping TABLE and KEYSPACE
          5. CQL versions
        7. Step 7 – building facebook
        8. Creating keyspace for facebook
        9. Storing facebook data using tables
        10. Storing user profiles
          1. Create table
          2. Insert records
          3. Update row
          4. View rows
          5. Alter table (add collections columns)
        11. Storing facebook posts
          1. Create table
          2. Add records
        12. Creating table for user wall (timeline)
          1. How data is stored
        13. Connecting users with their friends
        14. Counting friends and posts
      4. Top 3 features you need to know about
        1. TTL (time to live)
          1. Syntax
          2. Gone in 60 seconds!
        2. CQL for client applications
          1. Using the Thrift API
          2. Using the Datastax Java driver
          3. Using high-level clients
        3. Batch operations
          1. Syntax
          2. Three flavors of the batch operation
      5. People and places you should get to know
        1. Official sites
        2. Articles and tutorials
        3. Community
        4. Blogs
        5. Twitter