2017-09-13 11:31:46 +02:00
|
|
|
zookeeper
|
|
|
|
=========
|
|
|
|
|
|
|
|
![](http://zookeeper.apache.org/images/zookeeper_small.gif)
|
|
|
|
|
|
|
|
Apache [ZooKeeper][1] is an effort to develop and maintain an open-source server
|
|
|
|
which enables highly reliable distributed coordination.
|
|
|
|
|
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
|
|
|
```yaml
|
2021-11-26 08:58:00 +02:00
|
|
|
version: "3.8"
|
|
|
|
services:
|
|
|
|
zookeeper:
|
|
|
|
image: zookeeper
|
|
|
|
ports:
|
|
|
|
- "2181:2181"
|
|
|
|
volumes:
|
|
|
|
- ./data/data:/data
|
|
|
|
- ./data/datalog:/datalog
|
|
|
|
- ./data/logs:/logs
|
|
|
|
environment:
|
|
|
|
- ZOO_LOG4J_PROP=INFO,ROLLINGFILE
|
|
|
|
- ZOO_STANDALONE_ENABLED=true
|
|
|
|
restart: unless-stopped
|
2017-09-13 11:31:46 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Standalone Mode
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker-compose up -d
|
2019-09-26 12:25:16 +02:00
|
|
|
|
2019-12-03 11:28:17 +02:00
|
|
|
$ docker-compose exec zookeeper cat /conf/zoo.cfg
|
|
|
|
|
2019-09-26 12:25:16 +02:00
|
|
|
$ docker-compose exec zookeeper zkServer.sh status
|
|
|
|
ZooKeeper JMX enabled by default
|
|
|
|
Using config: /conf/zoo.cfg
|
2019-09-26 13:41:55 +02:00
|
|
|
Client port found: 2181. Client address: localhost.
|
|
|
|
Mode: standalone
|
2019-09-26 12:25:16 +02:00
|
|
|
|
2017-09-13 11:31:46 +02:00
|
|
|
$ docker-compose exec zookeeper zkCli.sh
|
|
|
|
>>> help
|
|
|
|
>>> create /hello world
|
|
|
|
>>> get /hello
|
|
|
|
>>> delete /hello
|
|
|
|
>>> quit
|
|
|
|
```
|
|
|
|
|
|
|
|
Click [this][2] to learn more.
|
|
|
|
|
2019-09-26 13:41:55 +02:00
|
|
|
## Cluster Mode
|
|
|
|
|
|
|
|
See: https://github.com/vimagick/dockerfiles/tree/master/kafka
|
2017-09-13 11:31:46 +02:00
|
|
|
|
|
|
|
[1]: http://zookeeper.apache.org/
|
|
|
|
[2]: https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
|