Building distributed applications is difficult enough without having to coordinate the actions that make them work. This practical guide shows how Apache ZooKeeper helps you manage distributed systems, so you can focus mainly on application logic. Even with ZooKeeper, implementing coordination tasks is not trivial, but this book provides good practices to give you a head start, and points out caveats that developers and administrators alike need to watch for along the way.
In three separate sections, ZooKeeper contributors Flavio Junqueira and Benjamin Reed introduce the principles of distributed systems, provide ZooKeeper programming techniques, and include the information you need to administer this service.
Learn how ZooKeeper solves common coordination tasks
Explore the ZooKeeper API’s Java and C implementations and how they differ
Use methods to track and react to ZooKeeper state changes
Handle failures of the network, application processes, and ZooKeeper itself
Learn about ZooKeeper’s trickier aspects dealing with concurrency, ordering, and configuration
Use the Curator high-level interface for connection management
Become familiar with ZooKeeper internals and administration tools
ZooKeeper Concepts and Basics
Chapter 1 Introduction
The ZooKeeper Mission
Example: Master-Worker Application
Why Is Distributed Coordination Hard?
ZooKeeper Is a Success, with Caveats
Chapter 2 Getting to Grips with ZooKeeper
Getting Started with ZooKeeper
Implementation of a Master-Worker Example
Programming with ZooKeeper
Chapter 3 Getting Started with the ZooKeeper API
Setting the ZooKeeper CLASSPATH
Creating a ZooKeeper Session
The Admin Client
Chapter 4 Dealing with State Change
Getting More Concrete: How to Set Watches
A Common Pattern
The Master-Worker Example
An Alternative Way: Multiop
Watches as a Replacement for Explicit Cache Management
Flavio Junqueira is a member of the research staff of Microsoft Research in Cambridge, UK. He holds a PhD degree in Computer Science from the University of California, San Diego. He is interested in various aspects of distributed systems, including distributed algorithms, concurrency, and scalability. He is an active contributor of Apache projects, such as Apache ZooKeeper (PMC chair and committer) and Apache BookKeeper (committer). When he is idle, he sleeps.
Benjamin Reed is a Software Engineer at Facebook working on all things small. His previous positions include Principal Research Scientist at Yahoo! Research (working on all things big) and Research Staff Member (working on the big and the small) at IBM Almaden Research. The University of California, Santa Cruz granted him a PhD in computer science. He has worked in the areas of distributed computing, big data processing, distributed storage, systems management, and embedded frameworks. He participated in various open source projects such as Hadoop and Linux. He helped start the Pig, Zookeeper, and BookKeeper projects hosted by the Apache Software Foundation.
The animal on the cover of ZooKeeper is a European wildcat (Felis silvestris silvestris), a subspecies of the wildcat that inhabits the forests and grasslands of Europe, as well as Turkey and the Caucasus Mountains.Similar in size to a large domestic cat, the European wildcat has a broader head, longish fur, and a shorter, blunted tail—white patches are often found on the throat, chest, and abdomen. The staple diet for the majority of European wildcats is made up of small rodents such as wood mice, pine voles, water voles, and shrews. Interestingly, at odds with domesticated cats’ love of fish, wildcats rarely prey on fish in the wild.The European wildcat was once found throughout Europe and is considered by some to be the oldest form of the species—limited fossil records indicate an ancestral link to wildcats dating back to the Early Pleistocene period. During the past 300 years, the range of the European wildcat, through pressures brought about by hunting and the spread of human population, has been significantly reduced.Hybridization is also a major issue. Although many of the wildcat subspecies live in remote regions, others are in relative close proximity to human habitation and therefore near domestic and feral cat populations, within which they often mate. Over an extended period of time, it is possible that certain subspecies will simply “breed” themselves out of existence.The cover image is from Meyers Kleines Lexicon. The cover font is Adobe ITC Garamond. The text font is Adobe Minion Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag's Ubuntu Mono.
The authors do quite a good job of explaining how ZooKeeper should be used. There is quite a detailed description of the Java API needed to create master-slave systems, and to create and consume watches. There are also two chapters which describe ZooKeeper's internals and how ZooKeeper can be maintained and monitored, and a brief description of the C API. Overall, I found the book to be quite good. The code is well documented and has clear explanations of all important parts. There are also several diagrams showing how client systems interact with ZooKeeper as time passes, which I found quite useful in understanding how the entire process works with several interacting clients, such as during leader election. The only drawback of this book is that it covers only ZooKeeper, and does not cover distributed systems with ZooKeeper. It concentrates only on documenting ZooKeeper and how clients should work with ZooKeeper. It doesn't cover how you should create a distributed system using ZooKeeper, such as how the workers should recieve tasks and report thier status effectively, what the distribution of workers and masters should be, or how you should setup a effective cluster. I think the book would have been more effective if the authors could have provided a simple example of a working distributed system using ZooKeeper rather than concentrating only on the nuances of ZooKeeper.
Bottom Line Yes, I would recommend this to a friend