Giter Club home page Giter Club logo

zkconf's Introduction

Generate configuration for ZooKeeper ensemble

Author: Patrick Hunt (follow me on twitter)

Summary

This project will generate all of the configuration needed to run a ZooKeeper ensemble. I mainly use this tool for localhost based testing, but it can generate configurations for any list of servers (see the —server option).

What’s Apache ZooKeeper?

From the official site: “ZooKeeper is a high-performance coordination service for distributed applications.”

It exposes common services – such as naming, configuration management, synchronization, and group services – in a simple interface so you don’t have to write them from scratch. You can use it off-the-shelf to implement consensus, group management, leader election, and presence protocols. And you can build on it for your own, specific needs.

License

This project is licensed under the Apache License Version 2.0

Requirements

  • Python
  • Cheetah templating package are necessary to run this
    • On ubuntu “sudo apt-get install python-cheetah”
  • Bash

before using the first time (or on update) run the following command

cheetah compile *.tmpl

Usage

Usage: zkconf.py [options] zookeeper_dir output_dir

Options:
  -h, --help            show this help message and exit
  -c COUNT, --count=COUNT
                        ensemble size (default 3)
  --servers=SERVERS     explicit list of comma separated server names
                        (alternative to --count)
  --clientportstart=CLIENTPORTSTART
                        first client port (default 2181)
  --quorumportstart=QUORUMPORTSTART
                        first quorum port (default 3181)
  --electionportstart=ELECTIONPORTSTART
                        first election port (default 4181)
  --weights=WEIGHTS     comma separated list of weights for each server (flex
                        quorum only, default off)
  --groups=GROUPS       comma separated list of groups (flex quorum only,
                        default off)
  --maxClientCnxns=MAXCLIENTCNXNS
                        maxClientCnxns of server config (default unspecified,
                        ZK default)
  --electionAlg=ELECTIONALG
                        electionAlg of server config (default unspecified, ZK
                        default - FLE)

Where zookeeper_dir is the location of your ZooKeeper trunk (zkconf copies the jars/confs from this directory into the output_dir to make your life easier). And output_dir is the directory to which we will output the generated files (assumption is that this is a non-existent directory – ie zkconf will create it)

example of typical use; 9 server quorum:

zkconf.py —count 9 ~/zookeeper_trunk test9servers

zkconf.py —servers “host1.com,host2.com,168.1.1.1” ~/zookeeper_trunk test3servers

example of using weights/groups (only for flex quorum, not typical); 9 servers with 3 groups

zkconf.py -c 9 —weights=“1,1,1,1,1,0,0,0,0” —groups=“1:2:3:4:5,6:7,8:9” ~/dev/workspace/gitzk testflexquroum

Running localhost (default) starts client:quorum:election ports as 2181:3181:4181 respectively. Running non-localhost (—servers) starts client:quorum:elections ports for all hosts as 2181:3181:4181.

  • cli.sh “server:port,server:port,…” – open a client to the server list
  • status.sh – status of each of the servers (prints leader | follower if active)
  • start.sh – start the ensemble (logs are output to the respective server subdir, localhost only)
  • stop.sh – stop the ensemble (localhost only)

zkconf's People

Contributors

phunt avatar grossws avatar

Watchers

James Cloos avatar

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.