Sign inSign up

topochan/docker-zookeeper

By topochan

•Updated over 9 years ago

This project creates a docker-based Zookeeper container that supports dynamically changing

Image
0

439

topochan/docker-zookeeper repository overview

⁠Overview

This project creates a docker-based Zookeeper container that supports dynamically changing the enemble configuration based on consul service discovery. This allows you to spin up and modify ZK ensembles quickly.

Warning! This is a test of consul-template. Don't use for anything important at this time, as we haven't tested various failure scenarios.

⁠Features

  • Uses consul-template⁠ to dynamicaly write zoo.cfg and restart Zookeeper
  • Supplies environment variables for registrator⁠ for service discovery
  • Configurable via environment variables passed to container
  • Supports docker-assigned ports for client, peer and leaders (you can run multiple zookeepers on the same machine without port conflicts)
  • Will generate random ZKIDs if one is not provided
  • Supports tagging for use with registrator and consul service discovery

⁠Building

This image is available in the Docker hub as asteris/zookeeper:latest. To build your own use the included Makefile. You can override any of the NAME, REPO or TAG:

cd zookeeper-3.4
NAME=zk make -e
REPO=mycompany NAME=zk TAG=test make -e tag

Pushing to the Docker hub:

REPO=mycompany NAME=zk TAG=test make -e push

⁠Running

⁠From the command line
  • Ensure that consul is running. We recommend using the instructions from docker-consul⁠. The container should be named consul

  • Ensure that registrator is running:

       -v /var/run/docker.sock:/tmp/docker.sock \
       -h $HOSTNAME progrium/registrator```
    
    
  • Optional: configure dnsmasq to use consul for DNS. See http://www.morethanseven.net/2014/04/25/consul/⁠

  • Run ./start_container.sh

  • If you want to use Consul DNS instead of container linking, replace the --link consul:consul line in the script with a CONSUL_CONNECT pointing to the dns name of the consul system

⁠Environment variables

VariableDefaultDescription
CONSUL_CONNECTconsul:8500DNS name of consul server. If using dnsmasq + consul you can use consul.service.consl instead and pass --dns=127.0.0.1 when starting the container
CONSUL_MINWAIT20sConsul template minimum wait
CONSUL_MAXWAIT60sConsul template maximum wait
CONSUL_QUERY${CONSUL_SERVICE} if ${CONSUL_TAG} is defined the default will be ${CONSUL_TAG}.${CONSUL_SERVICE}Consul template query. For example, set the tag & service name to have consul template look for systems like: cluster1.zookeeper
CONSUL_SERVICEzookeeperConsul Service discovery name
CONSUL_TAGNot definedConsul Service discovery tag
ZOO_LOG_DIR${ZK_LOG_DIR}log4j zookeeper.out file location
ZK_DATA_DIR/var/lib/zookeeperlocation of Zookeeper data
ZK_LOG_DIR/var/log/zookeeperlocation of Zookeeper dataLog
ZK_HOME/opt/zookeeperZookeeper install directory
ZK_ID1Zookeeper serverid

##License This software is released under an Apache 2.0 License

Copyright Asteris, LLC 2014

Tag summary

Content type

Image

Digest

sha256:f5ea3d619…

Size

83.4 MB

Last updated

over 9 years ago

docker pull topochan/docker-zookeeper