Code Monkey home page Code Monkey logo

alpine-zk's Introduction

alpine-zk

This image is the zookeeper base. It comes from alpine-jvm8.

Build

docker build -t rawmind/alpine-zk:<version> .

Versions

Configuration

This image runs zookeeper with monit. Zookeeper is started with user and group "zookeeper".

Besides, you can customize the configuration in several ways:

Default Configuration

zookeeper is installed with the default configuration and some parameters can be overrided with env variables:

  • ZK_DATA_DIR="/opt/zk/data"
  • ZK_INIT_LIMIT="10"
  • ZK_MAX_CLIENT_CXNS="500"
  • ZK_SYNC_LIMIT="5"
  • ZK_TICK_TIME="2000"
  • ZK_SERVER="127.0.0.1"

Custom Configuration

Zookeeper is installed under /opt/zk and make use of /opt/zk/conf/myid and /opt/zk/conf/zoo.cfg.

You can edit this files in order customize configuration

You could also include FROM rawmind/alpine-zk at the top of your Dockerfile, and add your custom config.

Rancher

If you are running it in rancher, you could run rancher-zk as a sidekick to get dynamic configuration.

k8s

If you are running it in k8s, you could run k8s-zk at the same pod to get dynamic configuration.

Example

See rancher-example, rancher catalog package that runs zookeeper in a cattle environment with dynamic configuration.

See k8s-example, rancher catalog package that runs zookeeper in a k8s environment with dynamic configuration.

alpine-zk's People

Contributors

bl4ckb1rd77 avatar rawmind0 avatar tsindot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

alpine-zk's Issues

Issues with Kubernetes

$ kubectl logs zk-w6owo zk-conf
Thu Sep 15 11:39:32 UTC 2016 - Extracting /opt/tools.tgz
confd/
confd/bin/
confd/bin/confd
confd/etc/
confd/etc/templates/
confd/etc/conf.d/
confd/log/
monit/
monit/conf.d/
scripts/
scripts/jq
Thu Sep 15 11:39:33 UTC 2016 - Extracting /opt/k8s-tools.tgz
confd/
confd/bin/
confd/bin/service-conf.sh
monit/
monit/conf.d/
monit/conf.d/monit-conf.cfg
Thu Sep 15 11:39:33 UTC 2016 - Extracting /opt/zk-k8s-tools.tgz
confd/
confd/bin/
confd/bin/gen.conf.tmpl.sh
confd/bin/service-conf.sh
scripts/
scripts/zk-service.sh
Thu Sep 15 11:39:33 UTC 2016 - I'm alive


$ kubectl logs zk-w6owo zk-service
 New Monit id: a88311e8144446e5a6fa20e00cc77f11
 Stored in '/opt/zk/.monit.id'
Starting Monit 5.19.0 daemon with http interface at [*]:2812
'zk-w6owo' Monit 5.19.0 started
'confd' process is not running
'confd' trying to restart
'confd' start: /opt/tools/confd/bin/service-conf.sh
'confd' failed to start (exit status -1) -- /opt/tools/confd/bin/service-conf.sh: Program timed out -- etcd.kubernetes.: Name does not resolve

'zk-service' process is not running
'zk-service' trying to restart
'zk-service' start: /opt/zk/bin/zk-service.sh
'zk-service' failed to start (exit status -1) -- /opt/zk/bin/zk-service.sh: Program timed out -- Thu Sep 15 11:40:17 UTC 2016 - [ Starting zk... ]
Thu Sep 15 11:40:17 UTC 2016 - [ Checking zk configuration... ]
Thu Sep 15 11:40:17 UTC 2016 - [ Applying dinamic zk configuration... ]
Thu Sep 15 11:40:17 U
'confd' process is not running
'confd' trying to restart
'confd' start: /opt/tools/confd/bin/service-conf.sh
'confd' failed to start (exit status -1) -- /opt/tools/confd/bin/service-conf.sh: Program timed out -- etcd.kubernetes.: Name does not resolve

'zk-service' process is not running
'zk-service' trying to restart
'zk-service' start: /opt/zk/bin/zk-service.sh
'zk-service' failed to start (exit status -1) -- /opt/zk/bin/zk-service.sh: Program timed out -- Thu Sep 15 11:42:18 UTC 2016 - [ Starting zk... ]
Thu Sep 15 11:42:18 UTC 2016 - [ Checking zk configuration... ]
Thu Sep 15 11:42:18 UTC 2016 - [ Applying dinamic zk configuration... ]
Thu Sep 15 11:42:18 U
'confd' service restarted 2 times within 2 cycles(s) - unmonitor
'zk-service' process is not running
'zk-service' trying to restart
'zk-service' start: /opt/zk/bin/zk-service.sh
'zk-service' failed to start (exit status -1) -- /opt/zk/bin/zk-service.sh: Program timed out -- Thu Sep 15 11:43:48 UTC 2016 - [ Starting zk... ]
Thu Sep 15 11:43:48 UTC 2016 - [ Checking zk configuration... ]
Thu Sep 15 11:43:48 UTC 2016 - [ Applying dinamic zk configuration... ]
Thu Sep 15 11:43:48 U

Trying to make work in vanilla Minikube

I'm trying to deploy this in vanilla Minikube (no Rancher) but after killing in all the variables with values and deploying, I get this:

Wed Nov 22 17:24:07 UTC 2017 - [ Waiting /opt/tools to be synced ... ]
 New Monit id: 9293648f56753aea4b9f4dd74ae25f37
 Stored in '/opt/zk/.monit.id'
Starting Monit 5.24.0 daemon with http interface at [*]:2812
'zookeeper-2ttd9' Monit 5.24.0 started
'confd' trying to restart
'confd' process is not running
'confd' start: '/opt/tools/confd/bin/service-conf.sh start'
'zk-service' trying to restart
'zk-service' start: '/opt/zk/bin/zk-service.sh start'
'confd' failed to start (exit status -1) -- '/opt/tools/confd/bin/service-conf.sh start': Program timed out -- etcd.kubernetes.: Name does not resolve

'zk-service' process is not running
'zk-service' failed to start (exit status -1) -- '/opt/zk/bin/zk-service.sh start': Program timed out -- Wed Nov 22 17:24:42 UTC 2017 - [ Starting zk... ]
Wed Nov 22 17:24:42 UTC 2017 - [ Checking zk configuration... ]
Wed Nov 22 17:24:42 UTC 2017 - [ Applying dinamic zk configuration... ]
Wed Nov 22 17

Any idea what to fix here? It's expecting a DNS resolution of etcd.kubernetes. but that doesn't exist in k8s 1.7.5 on Minikube.

Issue starting up cleanly in Kubernetes

Hello

I have been running your great images in kubernetes for quite some time now without issue.

I recently upgraded my GKE cluster to the latest version 1.7.6

I rebooted and redeployed fresh images and zookeeper seems to be unable to start up cleanly.

 New Monit id: 91d371eb870b43197094a6ee3df98d75
 Stored in '/root/.monit.id'
Starting Monit 5.20.0 daemon with http interface at [*]:2812
'zookeeper-2596185815-p7b71' Monit 5.20.0 started
'zk-service' process is not running
'zk-service' trying to restart
'zk-service' start: '/opt/zk/bin/zk-service.sh start'
2017-10-07 05:39:51,413 [myid:] - INFO  [main:QuorumPeerConfig@124] - Reading configuration from: /opt/zk/bin/../conf/zoo.cfg
2017-10-07 05:39:51,428 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: 127.0.0.1 to address: /127.0.0.1
2017-10-07 05:39:51,428 [myid:] - ERROR [main:QuorumPeerConfig@301] - Invalid configuration, only one server specified (ignoring)
2017-10-07 05:39:51,430 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2017-10-07 05:39:51,430 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 1
2017-10-07 05:39:51,431 [myid:] - WARN  [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running  in standalone mode
2017-10-07 05:39:51,433 [myid:] - INFO  [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started.
2017-10-07 05:39:51,448 [myid:] - INFO  [main:QuorumPeerConfig@124] - Reading configuration from: /opt/zk/bin/../conf/zoo.cfg
2017-10-07 05:39:51,449 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: 127.0.0.1 to address: /127.0.0.1
2017-10-07 05:39:51,449 [myid:] - ERROR [main:QuorumPeerConfig@301] - Invalid configuration, only one server specified (ignoring)
2017-10-07 05:39:51,449 [myid:] - INFO  [main:ZooKeeperServerMain@96] - Starting server
2017-10-07 05:39:51,461 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2017-10-07 05:39:51,461 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=zookeeper-2596185815-p7b71
2017-10-07 05:39:51,462 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=1.8.0_112
2017-10-07 05:39:51,462 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2017-10-07 05:39:51,462 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=/opt/jre1.8.0_112
2017-10-07 05:39:51,467 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=/opt/zk/bin/../build/classes:/opt/zk/bin/../build/lib/*.jar:/opt/zk/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zk/bin/../lib/slf4j-api-1.6.1.jar:/opt/zk/bin/../lib/netty-3.10.5.Final.jar:/opt/zk/bin/../lib/log4j-1.2.16.jar:/opt/zk/bin/../lib/jline-0.9.94.jar:/opt/zk/bin/../zookeeper-3.4.9.jar:/opt/zk/bin/../src/java/lib/*.jar:/opt/zk/bin/../conf:
2017-10-07 05:39:51,467 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2017-10-07 05:39:51,467 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=/tmp
2017-10-07 05:39:51,467 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2017-10-07 05:39:51,468 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Linux
2017-10-07 05:39:51,468 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2017-10-07 05:39:51,468 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=4.4.64+
2017-10-07 05:39:51,469 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=root
2017-10-07 05:39:51,469 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=/root
2017-10-07 05:39:51,469 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=/opt/zk
2017-10-07 05:39:51,471 [myid:] - INFO  [main:ZooKeeperServer@815] - tickTime set to 2000
2017-10-07 05:39:51,471 [myid:] - INFO  [main:ZooKeeperServer@824] - minSessionTimeout set to -1
2017-10-07 05:39:51,471 [myid:] - INFO  [main:ZooKeeperServer@833] - maxSessionTimeout set to -1
2017-10-07 05:39:51,475 [myid:] - INFO  [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed.
2017-10-07 05:39:51,483 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181
'zk-service' failed to start (exit status 0) -- '/opt/zk/bin/zk-service.sh start': rm: can't remove '/opt/zk/logs/zookeeper.out': No such file or directory
rm: can't remove '/opt/zk/nohup.out': No such file or directory
ZooKeeper JMX enabled by default
Using config: /opt/zk/bin/../conf/zoo.cfg

I poked around the filesystem and the files it is looking for (zookeeper.out and nohup.out) are indeed there.

Any ideas? When I build and run the same image locally it works just fine.

Won't complete initializing step

I deployed Zookeeper using the Docker catalog. Zookeeper refuses to start, and gives an error about not finding a myid file in the entered data directory I specified via the Catalog config screen.

How to enable JMX in this docker?

Hi , I saw zkServer.sh and use this docker-compose.yml to enable jmx, but remote could not connect due to timeout, How to enable JMX in this docker ?

zk:
ports:
- 2181:2181/tcp
- 2888:2888/tcp
- 3888:3888/tcp
- 20000:20000
environment:
JMXPORT: '20000'
JVMFLAGS: -Xmx512m -Xms512m
ZK_DATA_DIR: /opt/zk/data
ZK_INIT_LIMIT: '10'
ZK_MAX_CLIENT_CXNS: '500'
ZK_SYNC_LIMIT: '5'
ZK_TICK_TIME: '2000'
tty: true
image: rawmind/alpine-zk:3.4.9-3
Thanks a ton..

Monit check produces warning in Zookeeper logs

First great set of docker images, great job.

The current monit check:

check process zk-service with pidfile /opt/zk/data/zookeeper_server.pid
  start program = "/opt/zk/bin/zk-service.sh start"
  stop program = "/opt/zk/bin/zk-service.sh stop"
  if failed port 2181 type tcp for 5 cycles then exec "/opt/monit/bin/monit quit"

Specifically the if failed port 2181.... produces the following WARN message in zookeeper logs:

2017-06-01 15:39:01,405 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /0:0:0:0:0:0:0:1:41038
2017-06-01 15:39:01,470 [myid:] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@357] - caught end of stream exception
EndOfStreamException: Unable to read additional data from client sessionid 0x0, likely client has closed socket
	at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:228)
	at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:203)
	at java.lang.Thread.run(Thread.java:745)

This does not cause an error just noise in the log.

A colleague of mine suggested converting this over to a custom protocol, which seems to have resolved the WARN message. We modified it to do the following:

check process zk-service with pidfile /opt/zk/data/zookeeper_server.pid
  start program = "/opt/zk/bin/zk-service.sh start"
  stop program = "/opt/zk/bin/zk-service.sh stop"
  if failed port 2181 and send "ruok" expect "imok" for 5 cycles then exec "/opt/monit/bin/monit quit"

Log now looks like this:

2017-06-01 20:34:54,760 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /0:0:0:0:0:0:0:1:41596
2017-06-01 20:34:54,761 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@827] - Processing ruok command from /0:0:0:0:0:0:0:1:41596
2017-06-01 20:34:54,762 [myid:] - INFO  [Thread-30:NIOServerCnxn@1008] - Closed socket connection for client /0:0:0:0:0:0:0:1:41596 (no session established for client)

Will be happy to submit a PR if your interested.

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.