| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta content="Apache Forrest" name="Generator"> |
| <meta name="Forrest-version" content="0.8"> |
| <meta name="Forrest-skin-name" content="pelt"> |
| <title>BookKeeper overview</title> |
| <link type="text/css" href="skin/basic.css" rel="stylesheet"> |
| <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet"> |
| <link media="print" type="text/css" href="skin/print.css" rel="stylesheet"> |
| <link type="text/css" href="skin/profile.css" rel="stylesheet"> |
| <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script> |
| <link rel="shortcut icon" href="images/favicon.ico"> |
| </head> |
| <body onload="init()"> |
| <script type="text/javascript">ndeSetTextSize();</script> |
| <div id="top"> |
| <!--+ |
| |breadtrail |
| +--> |
| <div class="breadtrail"> |
| <a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script> |
| </div> |
| <!--+ |
| |header |
| +--> |
| <div class="header"> |
| <!--+ |
| |start group logo |
| +--> |
| <div class="grouplogo"> |
| <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a> |
| </div> |
| <!--+ |
| |end group logo |
| +--> |
| <!--+ |
| |start Project Logo |
| +--> |
| <div class="projectlogo"> |
| <a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a> |
| </div> |
| <!--+ |
| |end Project Logo |
| +--> |
| <!--+ |
| |start Search |
| +--> |
| <div class="searchbox"> |
| <form action="http://www.google.com/search" method="get" class="roundtopsmall"> |
| <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google"> |
| <input name="Search" value="Search" type="submit"> |
| </form> |
| </div> |
| <!--+ |
| |end search |
| +--> |
| <!--+ |
| |start Tabs |
| +--> |
| <ul id="tabs"> |
| <li> |
| <a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a> |
| </li> |
| <li> |
| <a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> |
| </li> |
| <li class="current"> |
| <a class="selected" href="index.html">ZooKeeper 3.2 Documentation</a> |
| </li> |
| </ul> |
| <!--+ |
| |end Tabs |
| +--> |
| </div> |
| </div> |
| <div id="main"> |
| <div id="publishedStrip"> |
| <!--+ |
| |start Subtabs |
| +--> |
| <div id="level2tabs"></div> |
| <!--+ |
| |end Endtabs |
| +--> |
| <script type="text/javascript"><!-- |
| document.write("Last Published: " + document.lastModified); |
| // --></script> |
| </div> |
| <!--+ |
| |breadtrail |
| +--> |
| <div class="breadtrail"> |
| |
| |
| </div> |
| <!--+ |
| |start Menu, mainarea |
| +--> |
| <!--+ |
| |start Menu |
| +--> |
| <div id="menu"> |
| <div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Overview</div> |
| <div id="menu_1.1" class="menuitemgroup"> |
| <div class="menuitem"> |
| <a href="index.html">Welcome</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperOver.html">Overview</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperStarted.html">Getting Started</a> |
| </div> |
| <div class="menuitem"> |
| <a href="releasenotes.html">Release Notes</a> |
| </div> |
| </div> |
| <div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div> |
| <div id="menu_1.2" class="menuitemgroup"> |
| <div class="menuitem"> |
| <a href="api/index.html">API Docs</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperProgrammers.html">Programmer's Guide</a> |
| </div> |
| <div class="menuitem"> |
| <a href="javaExample.html">Java Example</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> |
| </div> |
| <div class="menuitem"> |
| <a href="recipes.html">Recipes</a> |
| </div> |
| </div> |
| <div onclick="SwitchMenu('menu_selected_1.3', 'skin/')" id="menu_selected_1.3Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">BookKeeper</div> |
| <div id="menu_selected_1.3" class="selectedmenuitemgroup" style="display: block;"> |
| <div class="menuitem"> |
| <a href="bookkeeperStarted.html">Getting started</a> |
| </div> |
| <div class="menupage"> |
| <div class="menupagetitle">Overview</div> |
| </div> |
| <div class="menuitem"> |
| <a href="bookkeeperConfig.html">Setup guide</a> |
| </div> |
| <div class="menuitem"> |
| <a href="bookkeeperProgrammer.html">Programmer's guide</a> |
| </div> |
| </div> |
| <div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Admin & Ops</div> |
| <div id="menu_1.4" class="menuitemgroup"> |
| <div class="menuitem"> |
| <a href="zookeeperAdmin.html">Administrator's Guide</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperQuotas.html">Quota Guide</a> |
| </div> |
| <div class="menuitem"> |
| <a href="zookeeperJMX.html">JMX</a> |
| </div> |
| </div> |
| <div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Contributor</div> |
| <div id="menu_1.5" class="menuitemgroup"> |
| <div class="menuitem"> |
| <a href="zookeeperInternals.html">ZooKeeper Internals</a> |
| </div> |
| </div> |
| <div onclick="SwitchMenu('menu_1.6', 'skin/')" id="menu_1.6Title" class="menutitle">Miscellaneous</div> |
| <div id="menu_1.6" class="menuitemgroup"> |
| <div class="menuitem"> |
| <a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> |
| </div> |
| <div class="menuitem"> |
| <a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a> |
| </div> |
| <div class="menuitem"> |
| <a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a> |
| </div> |
| </div> |
| <div id="credit"></div> |
| <div id="roundbottom"> |
| <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> |
| <!--+ |
| |alternative credits |
| +--> |
| <div id="credit2"></div> |
| </div> |
| <!--+ |
| |end Menu |
| +--> |
| <!--+ |
| |start content |
| +--> |
| <div id="content"> |
| <div title="Portable Document Format" class="pdflink"> |
| <a class="dida" href="bookkeeperOverview.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br> |
| PDF</a> |
| </div> |
| <h1>BookKeeper overview</h1> |
| <div id="minitoc-area"> |
| <ul class="minitoc"> |
| <li> |
| <a href="#bk_Overview">BookKeeper overview</a> |
| <ul class="minitoc"> |
| <li> |
| <a href="#bk_basicComponents">Basic elements</a> |
| </li> |
| <li> |
| <a href="#bk_moreDetail">In slightly more detail...</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| |
| |
| |
| |
| <a name="N10009"></a><a name="bk_Overview"></a> |
| <h2 class="h3">BookKeeper overview</h2> |
| <div class="section"> |
| <p>This document explains basic concepts of BookKeeper. We start by discussing |
| the basic elements of BookKeeper, and next we discuss how they work together. |
| </p> |
| <a name="N10012"></a><a name="bk_basicComponents"></a> |
| <h3 class="h4">Basic elements</h3> |
| <p> |
| BookKeeper uses four basic elements: |
| </p> |
| <ul> |
| |
| <li> |
| |
| <p> |
| |
| <strong>Ledger</strong>: A ledger is a sequence of entries, and each entry is a sequence of bytes. Entries are |
| written sequentially to a ledger and at most once. Consequently, ledgers have an append-only semantics; |
| </p> |
| |
| </li> |
| |
| |
| <li> |
| |
| <p> |
| |
| <strong>BookKeeper client</strong>: A client runs along with a BookKeeper application, and it enables applications |
| to execute operations on ledgers, such as creating a ledger and writing to it; |
| </p> |
| |
| </li> |
| |
| |
| <li> |
| |
| <p> |
| |
| <strong>Bookie</strong>: A bookie is a BookKeeper storage server. Bookies store the content of ledgers. For any given |
| ledger L, we call an <em>ensemble</em> the group of bookies storing the content of L. For performance, we store on |
| each bookie of an ensemble only a fragment of a ledger. That is, we stripe when writing entries to a ledger such that |
| each entry is written to sub-group of bookies of the ensemble. |
| </p> |
| |
| </li> |
| |
| |
| <li> |
| |
| <p> |
| |
| <strong>Metadata storage service</strong>: BookKeeper requires a metadata storage service to store information related |
| to ledgers and available bookies. We currently use ZooKeeper for such a task. |
| </p> |
| |
| </li> |
| |
| </ul> |
| <a name="N10046"></a><a name="bk_moreDetail"></a> |
| <h3 class="h4">In slightly more detail...</h3> |
| <p> BookKeeper implements highly available logs, and it has been designed with write-ahead logging in mind. Besides high availability |
| due to the replicated nature of the service, it provides high throughput due to striping. As we write entries in a subset of bookies of an |
| ensemble and rotate writes across available quorums, we are able to increase throughput with the number of servers for both reads and writes. |
| Scalability is a property that is possible to achieve in this case due to the use of quorums. Other replication techniques, such as |
| state-machine replication, do not enable such a property. |
| </p> |
| <p> An application first creates a ledger before writing to bookies through a local BookKeeper client instance. To |
| create a ledger, an application has to specify which kind of ledger it wants to use: self-verifying or generic. Self-verifying |
| includes a digest on every entry, which enables a reduction on the degree of replication. Generic ledgers do not store a digest |
| along with entries at the cost of using more bookies. |
| </p> |
| <p> Upon creating a ledger, a BookKeeper clients writes metadata about the ledger to ZooKeeper. A given client first creates |
| a znode named "L" as a child of "/ledger" with the SEQUENCE flag. ZooKeeper consequently assigns a unique sequence number to the |
| node, naming the node "/Lx", where x is the sequence number assigned. We use this sequence number as the identifier of the ledger. |
| This identifier is necessary when opening a ledger. We also store the ensemble composition so that readers know which set of bookies |
| of access for a given ledger. |
| </p> |
| <p> |
| Each ledger currently has a single writer. This writer has to execute a close ledger operation before any other client can read |
| from it. If the writer of a ledger does not close a ledger properly because, for example, it has crashed before having the |
| opportunity of closing the ledger, then the next client that tries to open a ledger executes an procedure to recover it. As closing a ledger |
| consists essentially of writing the last entry written to a ledger to ZooKeeper, the recovery procedure simply finds the last entry |
| written correctly and writes it to ZooKeeper in the form of a close znode as a child of "/Lx", where x is the identifier of the ledger. |
| </p> |
| <p> |
| Note that currently this recovery procedure is executed automatically upon trying to open a ledger and no explicit action is necessary. |
| Although two clients may try to recover a ledger concurrently, only one will succeed, the first one that is able to create the close znode |
| for the ledger. |
| </p> |
| </div> |
| |
| <p align="right"> |
| <font size="-2"></font> |
| </p> |
| </div> |
| <!--+ |
| |end content |
| +--> |
| <div class="clearboth"> </div> |
| </div> |
| <div id="footer"> |
| <!--+ |
| |start bottomstrip |
| +--> |
| <div class="lastmodified"> |
| <script type="text/javascript"><!-- |
| document.write("Last Published: " + document.lastModified); |
| // --></script> |
| </div> |
| <div class="copyright"> |
| Copyright © |
| 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a> |
| </div> |
| <!--+ |
| |end bottomstrip |
| +--> |
| </div> |
| </body> |
| </html> |