Abstract

This document contains information about deploying, administering and mantaining BookKeeper. It also discusses best practices and common problems.

Running a BookKeeper instance

System requirements

A typical BookKeeper installation comprises a set of bookies and a set of ZooKeeper replicas. The exact number of bookies depends on the quorum mode, desired throughput, and number of clients using this installation simultaneously. The minimum number of bookies is three for self-verifying (stores a message authentication code along with each entry) and four for generic (does not store a message authentication code with each entry), and there is no upper limit on the number of bookies. Increasing the number of bookies will, in fact, enable higher throughput.

For performance, we require each server to have at least two disks. It is possible to run a bookie with a single disk, but performance will be significantly lower in this case.

For ZooKeeper, there is no constraint with respect to the number of replicas. Having a single machine running ZooKeeper in standalone mode is sufficient for BookKeeper. For resilience purposes, it might be a good idea to run ZooKeeper in quorum mode with multiple servers. Please refer to the ZooKeeper documentation for detail on how to configure ZooKeeper with multiple replicas.

Running bookies

To run a bookie, we execute the following command:

bookkeeper-server/bin/bookkeeper bookie

The configuration parameters can be set in bookkeeper-server/conf/bk_server.conf.

The important parameters are:
* bookiePort, Port number that the bookie listens on;
* zkServers, Comma separated list of ZooKeeper servers with a hostname:port format;
* journalDir, Path for Log Device (stores bookie write-ahead log);
* ledgerDir, Path for Ledger Device (stores ledger entries);

Ideally, journalDir and ledgerDir are each in a different device. See BookKeeper Configuration Parameters for a full list of configuration parameters.

Logging

BookKeeper uses slf4j for logging, with the log4j bindings enabled by default. To enable logging from a bookie, create a log4j.properties file and point the environment variable BOOKIE_LOG_CONF to the configuration file. The path to the log4j.properties file must be absolute.

export BOOKIE_LOG_CONF=/tmp/log4j.properties
bookkeeper-server/bin/bookkeeper bookie

Setting up a test ensemble

Sometimes it is useful to run a ensemble of bookies on your local machine for testing. We provide a utility for doing this. It will set up N bookies, and a zookeeper instance locally. The data on these bookies and of the zookeeper instance are not persisted over restarts, so obviously this should never be used in a production environment. To run a test ensemble of 10 bookies, do the following.

bookkeeper-server/bin/bookkeeper localbookie 10