Wow. That was harder than Cassandra and I still haven’t started on Pulsar. A few notes:
- ZooKeeper needs persistent volumes. BookKeeper expects some metadata to be there. If you don’t persist it, you end up with race conditions when they start (as each one tries to bootstrap the metadata).
- Get the right image from dockerhub. “bookkeeper image for each bookie” sounds better (to me, at least) than “Non-official bookkeeper convenience binaries”. However, the former has not been updated in four years; the latter four days ago.
- BookKeeper needs persistent volumes because of what it does. It stores a cookie in them that contains the IP address. This means you must hard-code one or each container gets one on the fly and refuses to start if there is a mismatch with the previous start. Since these containers are using the same network as ZooKeeper (and soon to be Pulsar), those need hard-code IP addresses, too, in order to avoid conflicts.
- BookKeeper’s ZooKeeper cluster configuration (BZ_zkServers) does NOT work as advertised. A comma separated list will fail, always. If you use comma-space, it fails differently, but equally dramatically.
- Attaching the BookKeeper configuration to your filesystem fails. Something (“netty” seems suspicious) overwrites it when the container starts. You must use environment variables.
I have more notes locally, but those were the big stumbling blocks.
Related: I spent an hour figuring out how to set the title of a gnome terminal window because I kept getting confused about which window was doing what. A small bash function and a command to “up” the containers were well worth the effort. In .bashrc add:
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$@\a\]"
PS1=${ORIG}${TITLE}
export PS1
}
function title { echo -en "\033]2;$1\007"; }
“title” is transient; as soon as the script ends, the title goes back to whatever it was. “set-title” is permanent. It’s very handy to know which tab in which window is actually running something.
Create a script to call docker-compose (in the ~/bin directory to put it in your path). This one is cleverly called “zkup”.; the others are equally creative.
#!/bin/bash
source ~/.bashrc
title "ZooKeeper: zk_zoo"
docker-compose -f ~/zk/zoo.yaml up