Chapter 9. Data storage with Clojure

 

This chapter covers

  • Using Clojure with MySQL for simple needs
  • Using Clojure with HBase for big data
  • Using Clojure with Redis for key-value storage

This chapter begins an exciting journey. We’re going to use all the concepts you’ve learned so far and apply them to applications that might be useful in the real world. We’ll start by discussing a simple requirement common to most nontrivial applications, that of storing data.

First, we’ll look at relational database systems because many applications need a standard relational database. MySQL fits the bill for most people, and we’ll examine an open source project that provides functionality to allow Clojure programs to talk to MySQL.

After discussing MySQL, we’ll look at communicating with HBase, which is an open source implementation of Google’s BigTable. These are column-oriented databases that can handle extremely large datasets, often measured in petabytes. The term big data has been used recently to describe such systems, and HBase is one answer to such large-scale data storage requirements.

Finally, we’ll wrap up the chapter by examining Redis, a new key-value store designed for extremely fast lookups. We’ll write code to create a convenient Clojure abstraction that makes dealing with Redis easy and transparent. It will allow you to map Clojure data structures into and out of Redis.

9.1. MySQL & clj-record

9.2. HBase

9.3. Redis

9.4. Summary