Giter Site home page Giter Site logo

zootomy's Introduction

Kubernetes Zookeeper as a Contained Service

To run this locally without staging data:

  1. make
  2. docker run -e MYID=1 -e <container_id>

To run this locally while creating new folder paths:

  1. make
  2. docker run -d --net="host" -p 2181:2181 -p 2888:2888 -p 3888:3888 -e MYID=1 -e ZOOKEEPER_01_SERVICE_HOST=localhost -e LAB=1 -e BUCKET_1=Folder1 -e BUCKET_2=Folder2 zookeeper:3.5.0-alpha

To run this within a Kubernetes cluster:

  1. make, docker tag <container_id>, and docker push the Dockerfile.
  2. Service .metadata.name field must always be zookeeper-XX, with XX being a two digit number.
  3. Replication Controller .spec.template.spec.containers.env field must always contain MYID=X, with X being the server ID integer.
  • If you are trying to stage data, make sure the LAB and BUCKET_X variables are added to the Replication Controllers.

This container exposes ports 2181, 2888, and 3888.

โ— For best performance use with an emtpyDir volume mount that uses Memory or tmpfs mount from the host with Kubernetes or -v with a tmpfs mount in Docker. โ—

Examples

Here is an example service configuration.

{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": {
    "name": "zookeeper-01",
    "version": "3.5.0"
  },
  "spec": {
    "ports": [
      {
        "name": "client",
        "port": 2181
      },
      {
        "name": "followers",
        "port": 2888
      },
      {
        "name": "election",
        "port": 3888
      }
    ],
    "selector": {
      "app": "zookeeper",
      "server-id": "1"
    }
  }
}

Here is an example replication controller configuration:

{
  "apiVersion": "v1",
  "kind": "ReplicationController",
  "metadata": {
    "name": "zookeeper-01",
    "version": "3.5.0"
  },
  "spec": {
    "replicas": 1,
    "template": {
      "metadata": {
        "labels": {
          "app": "zookeeper",
          "server-id": "1"
        }
      },
      "spec": {
        "containers": [
          {
            "env": [
              {
                "name": "MYID",
                "value": "1"
              }
            ],
            "image": "zookeeper:3.5.0",
            "name": "server",
            "ports": [
              {
                "containerPort": 2181
              },
              {
                "containerPort": 2888
              },
              {
                "containerPort": 3888
              }
            ]
          }
        ]
      }
    }
  }
}

Improving

The zkcfg.go program is what actually configures Zookeeper. If changes need to be made in regards to Zookeeper configurations, create a pull request and implement them here.

License

This project is covered under the Apache v2.0 License, please see the license

zootomy's People

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.