Coder Social home page Coder Social logo

docker-zookeeper's Introduction

ZooKeeper on Docker

This Dockerfile creates a Docker image that can be used as the base for running ZooKeeper within a Docker container. The run script is responsible for creating the ZooKeeper configuration based on the container's environment and starting the ZooKeeper service.

The version of ZooKeeper is defined in the Dockerfile and generally points to the latest stable release of ZooKeeper.

Environment variables

The following environment variables are understood by the startup script to seed the service's configuration:

  • SERVICE_NAME should contain the logical name of the service this container is an instance of;
  • CONTAINER_NAME should contain the logical name of the container, which will be used for looking up links and ports informations from the other environment variables. For this, the name is uppercased and non-alphanumeric characters are replaced by underscores.
  • <SERVICE_NAME>_<CONTAINER_NAME>_CLIENT_INTERNAL_PORT, which controls the clientPort configuration setting. Defaults to 2181;
  • <SERVICE_NAME>_<CONTAINER_NAME>_PEER_PORT, which is used as the peer port specified in the server list for this node (and the others). Defaults to 2888;
  • <SERVICE_NAME>_<CONTAINER_NAME>_LEADER_ELECTION_PORT, which is used as the leader election port specified in the server list for this node (and the others). Defaults to 3888;
  • MAX_SNAPSHOT_RETAIN_COUNT, the maximum number of snapshots to retain on disk. Defaults to to 10;
  • PURGE_INTERVAL, the interval, in hours, being transaction logs and snapshot purges. Defaults to 24 (daily).

If you plan to run a cluster of nodes, you also need to pass in the ZOOKEEPER_SERVER_IDS environment variable containing a comma-separated list of cluster nodes descriptors, as tuples of node:id. The node part being the container name of a node, from which its coordinates can be found.

For example, in three-node cluster, each node would expect the following set of environment variables:

SERVICE_NAME=zookeeper
CONTAINER_NAME=zk-node-{0,1,2}
ZOOKEEPER_SERVER_IDS=zk-node-0:1,zk-node-1:2,zk-node-2:3
ZOOKEEPER_INSTANCES=zk-node-0,zk-node-1,zk-node-2
ZOOKEEPER_ZK_NODE_0_HOST=host1
ZOOKEEPER_ZK_NODE_0_CLIENT_PORT=2181
ZOOKEEPER_ZK_NODE_0_PEER_PORT=2888
ZOOKEEPER_ZK_NODE_0_LEADER_ELECTION_PORT=3888
ZOOKEEPER_ZK_NODE_1_HOST=host2
ZOOKEEPER_ZK_NODE_1_CLIENT_PORT=2181
ZOOKEEPER_ZK_NODE_1_PEER_PORT=2888
ZOOKEEPER_ZK_NODE_1_LEADER_ELECTION_PORT=3888
ZOOKEEPER_ZK_NODE_2_HOST=host3
ZOOKEEPER_ZK_NODE_2_CLIENT_PORT=2181
ZOOKEEPER_ZK_NODE_2_PEER_PORT=2888
ZOOKEEPER_ZK_NODE_2_LEADER_ELECTION_PORT=3888

This will make zk-node-0 be ZooKeeper node ID 1 running on host1, etc.

If ZOOKEEPER_SERVER_IDS is not specified, the container will run in single-node mode.

Volumes

The ZooKeeper images uses the following volumes that you may want to bind from the container's host:

  • /var/lib/zookeeper, for the ZooKeeper data snapshots.
  • /var/log/zookeeper, for the ZooKeeper service logs (rotated 10 times by 100MB sections).

Usage

To build a new image, simply run from this directory:

$ docker build -t `whoami`/zookeeper:3.4.6 .

The Docker image will be built and now available for Docker to start a new container from:

$ docker images | grep zookeeper
mpetazzoni/zookeeper   3.4.6              294bef30310b        2 days ago          12.29 kB (virtual 856.7 MB)

docker-zookeeper's People

Contributors

aeuio avatar flands avatar gsmirnov-splk avatar hayderimran7 avatar henrysfx avatar janantala avatar kpruden avatar mpetazzoni avatar odcinek avatar philatsf avatar rajivsignal avatar tedoc2000 avatar udaysagar2177 avatar wlopata-sfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-zookeeper's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.