BookKeeper Getting Started Guide

Getting Started: Setting up BookKeeper to write logs.

This document contains information to get you started quickly with
BookKeeper. It is aimed primarily at developers willing to try it out, and
contains simple installation instructions for a simple BookKeeper installation
and a simple programming example. For further programming detail, please refer to
BookKeeper Programmer's Guide.

Pre-requisites

Download

BookKeeper is distributed along with ZooKeeper. To get a ZooKeeper distribution,
download a recent
stable release from one of the Apache Download
Mirrors.

LocalBookKeeper

Under org.apache.bookkeeper.util, you'll find a java program
called LocalBookKeeper.java that sets you up to run BookKeeper on a
single machine. This is far from ideal from a performance perspective,
but the program is useful for both test and educational purposes.

Setting up bookies

If you're bold and you want more than just running things locally, then
you'll need to run bookies in different servers. You'll need at least three bookies
to start with.

"/path_to_log_device/" and "/path_to_ledger_device/" are different paths. Also, port 3181
is the port that a bookie listens on for connection requests from clients. 127.0.0.1:2181 is the hostname:port
for the ZooKeeper server. In this example, the standalone ZooKeeper server is running locally on port 2181.
If we had multiple ZooKeeper servers, this parameter would be a comma separated list of all the hostname:port
values corresponding to them.

Setting up ZooKeeper

ZooKeeper stores metadata on behalf of BookKeeper clients and bookies. To get a minimal
ZooKeeper installation to work with BookKeeper, we can set up one server running in
standalone mode. Once we have the server running, we need to create a few znodes:

/ledgers

/ledgers/available

For each bookie, we add one znode such that the name of the znode is the
concatenation of the machine name and the port number that the bookie is
listening on. For example, if a bookie is running on bookie.foo.com an is listening
on port 3181, we add a znode
/ledgers/available/bookie.foo.com:3181.