Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TattiQ committed Jun 2, 2017
2 parents 29a2d58 + 20b6576 commit ba33e85
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# kafka
pykafka client related stuff
# Kafka in Docker
## Deploy instructions.

Search for any kafka docker:
```
docker search kafka
```

Start the zookeeper container, give it a name, bind the container port 2181 to the host OS port so that we can access that port from the our host OS if needed:
```
docker run -d -p 2181:2181 --name zookeeper jplock/zookeeper
```

Start the Kafka Docker, name it: kafka, link it to the above Zookeeper container:
```
docker run -d --name kafka --link zookeeper:zookeeper ches/kafka
```

Get the IP addresses of the Zookeeper and the Kafka broker first. Note that these IP addresses are assigned for Docker container automatically when we started them:

```
ZK_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' zookeeper)
KAFKA_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' kafka)
```

We will issue the below command to create a topic “test” with 1 partition and replication factor 1:

```
docker run --rm ches/kafka \
> kafka-topics.sh --create --topic test --replication-factor 1 --partitions 1 --zookeeper $ZK_IP:2181
Created topic "test".
```

Issue below command to produce message to the “test” topic (The terminal will wait for our input.):
```
docker run --rm --interactive ches/kafka kafka-console-producer.sh --topic test0 --broker-list $KAFKA_IP:9092
02120152
```


0 comments on commit ba33e85

Please sign in to comment.