You are previewing Apache ZooKeeper Essentials.
O'Reilly logo
Apache ZooKeeper Essentials

Book Description

A fast-paced guide to using Apache ZooKeeper to coordinate services in distributed systems

In Detail

Apache ZooKeeper provides a simple interface to a centralized coordinating service for distributed applications through a rich set of APIs and primitives, enabling developers to concentrate on the core logic of their applications. With ZooKeeper, it's unnecessary to start from scratch, so the development of distributed applications becomes cleaner and easier.

Starting with how to install, configure, and begin with ZooKeeper, we'll examine the intricacies of ZooKeeper's architecture and internals. Next, you'll learn ZooKeeper's programming model and write code to solve common distributed coordination tasks. We'll also walk you through administering ZooKeeper in a production environment, before finally covering practical examples of real-world projects and services using ZooKeeper to solve complex day-to-day problems.

What You Will Learn

  • Understand how Apache ZooKeeper solves coordination issues in traditional distributed systems

  • Discover steps to set up and get started with ZooKeeper in a development environment in addition to production

  • Explore ZooKeeper's architecture and internals

  • Get to grips with the API model of ZooKeeper to start programming

  • Use ZooKeeper to solve common distributed coordination tasks such as leader election, distributed queues, and group memberships

  • Administer Apache ZooKeeper for real-world use and production workload

  • Investigate the use of ZooKeeper in real-world applications and services

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Apache ZooKeeper Essentials
      1. Table of Contents
      2. Apache ZooKeeper Essentials
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. A Crash Course in Apache ZooKeeper
        1. Defining a distributed system
        2. Why coordination in a distributed system is so challenging
        3. Introducing Apache ZooKeeper
        4. Getting hands-on with Apache ZooKeeper
          1. Download and installation
            1. Downloading
            2. Installing
            3. Configuration
            4. Starting the ZooKeeper server
          2. Connecting to ZooKeeper with a Java-based shell
          3. Connecting to ZooKeeper with a C-based shell
          4. Setting up a multinode ZooKeeper cluster
            1. Starting the server instances
            2. Running multiple node modes for ZooKeeper
        5. Summary
      9. 2. Understanding the Inner Workings of Apache ZooKeeper
        1. A top-down view of the ZooKeeper service
        2. The ZooKeeper data model
          1. Types of znodes
            1. The persistent znode
            2. The ephemeral znode
            3. The sequential znode
          2. Keeping an eye on znode changes – ZooKeeper Watches
        3. The ZooKeeper operations
        4. Watches and ZooKeeper operations
        5. The ZooKeeper access control lists
        6. The ZooKeeper stat structure
        7. Understanding the inner working of ZooKeeper
          1. The quorum mode
          2. Client establishment of sessions with the ZooKeeper service
          3. Implementation of ZooKeeper transactions
            1. Phase 1 – leader election
            2. Phase 2 – atomic broadcast
          4. Local storage and snapshots
        8. Summary
      10. 3. Programming with Apache ZooKeeper
        1. Using the Java client library
          1. Preparing your development environment
          2. The first ZooKeeper program
          3. Implementing a Watcher interface
          4. Example – a cluster monitor
        2. The C client library
          1. Getting started with the C API
          2. Example – the znode data watcher
        3. Python client bindings
          1. A watcher implementation
        4. Summary
      11. 4. Performing Common Distributed System Tasks
        1. ZooKeeper recipes
          1. Barrier
          2. Queue
          3. Lock
          4. Leader election
          5. Group membership
          6. Two-phase commit
          7. Service discovery
        2. Summary
      12. 5. Administering Apache ZooKeeper
        1. Configuring a ZooKeeper server
          1. Minimum configuration
          2. Storage configuration
          3. Network configuration
        2. Configuring a ZooKeeper ensemble
          1. Configuring a quorum
        3. Quota and authorization
        4. ZooKeeper best practices
        5. Monitoring a ZooKeeper instance
          1. Four-letter words
          2. Java Management Extensions
        6. Summary
      13. 6. Decorating ZooKeeper with Apache Curator
        1. Curator components
          1. Curator client
          2. Curator framework
          3. Curator recipes
          4. Curator utilities
          5. Curator extensions
        2. Exhibitor
        3. Summary
      14. 7. ZooKeeper in Action
        1. Projects powered by ZooKeeper
          1. Apache BookKeeper
          2. Apache Hadoop
          3. Apache HBase
          4. Apache Helix
          5. OpenStack Nova
        2. Organizations powered by ZooKeeper
          1. Yahoo!
          2. Facebook
          3. eBay
          4. Twitter
          5. Netflix
          6. Zynga
          7. Nutanix
          8. VMware vSphere Storage Appliance
        3. Summary
      15. Index