// Metadata created by nebel
//
// ParentAssemblies: assemblies/tutorial/as_starting-services.adoc
// UserStory:

[id="starting-zookeeper"]
= Starting Zookeeper

ZooKeeper is the first service you must start.

.Procedure

. Open a terminal and use it to start ZooKeeper in a container.
+
--
This command runs a new container using version {debezium-docker-label} of the `quay.io/debezium/zookeeper` image:

[source,shell,options="nowrap",subs="+attributes"]
----
$ docker run -it --rm --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 quay.io/debezium/zookeeper:{debezium-docker-label}
----

`-it`:: The container is interactive,
which means the terminal's standard input and output are attached to the container.
`--rm`:: The container will be removed when it is stopped.
`--name zookeeper`:: The name of the container.
`-p 2181:2181 -p 2888:2888 -p 3888:3888`:: Maps three of the container's ports to the same ports on the Docker host.
This enables other containers (and applications outside of the container) to communicate with ZooKeeper.
--

ifdef::community[]
[NOTE]
====
If you use Podman, run the following command:s
[source,shell,options="nowrap",subs="+attributes"]
----
$ podman pod create --name=dbz -p 8083:8083
$ podman run -it --rm --name zookeeper --pod dbz quay.io/debezium/zookeeper:{debezium-docker-label}
----
====
endif::community[]

. Verify that ZooKeeper started and is listening on port `2181`.
+
--
You should see output similar to the following:

[source,shell,options="nowrap"]
----
Starting up in standalone mode
ZooKeeper JMX enabled by default
Using config: /zookeeper/conf/zoo.cfg
2017-09-21 07:15:55,417 - INFO  [main:QuorumPeerConfig@134] - Reading configuration from: /zookeeper/conf/zoo.cfg
2017-09-21 07:15:55,419 - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2017-09-21 07:15:55,419 - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 1
...
port 0.0.0.0/0.0.0.0:2181  // <1>
----

<1> This line indicates that ZooKeeper is ready and listening on port 2181. The terminal will continue to show additional output as ZooKeeper generates it.
--
