Skip to content

Commit

Permalink
modified KAFKA_CREATE_TOPICS syntax
Browse files Browse the repository at this point in the history
Replaced `name1,partitions,replicas:name2,partitions,replicas` with
`name1:partitions:replicas,name2:partitions:replicas`.
  • Loading branch information
filiptepper committed Apr 23, 2015
1 parent bed7b77 commit 4fa870d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ added in ```docker-compose.yml```.
Here is an example snippet from ```docker-compose.yml```:

environment:
KAFKA_CREATE_TOPICS: "Topic1,1,3:Topic2,1,1"
KAFKA_CREATE_TOPICS: "Topic1:1:3,Topic2:1:1"

```Topic 1``` will have 1 partition and 3 replicas, ```Topic 2``` will have 1 partition and 1 replica.

NOTE: All topics will be created with a single partition and a single replica

##Tutorial

[http://wurstmeister.github.io/kafka-docker/](http://wurstmeister.github.io/kafka-docker/)
Expand Down
4 changes: 2 additions & 2 deletions start-kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ KAFKA_SERVER_PID=$!
while netstat -lnt | awk '$4 ~ /:9092$/ {exit 1}'; do sleep 1; done

if [[ -n $KAFKA_CREATE_TOPICS ]]; then
IFS=':'; for topicToCreate in $KAFKA_CREATE_TOPICS; do
IFS=',' read -a topicConfig <<< "$topicToCreate"
IFS=','; for topicToCreate in $KAFKA_CREATE_TOPICS; do
IFS=':' read -a topicConfig <<< "$topicToCreate"
$KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partition ${topicConfig[1]} --topic "${topicConfig[0]}"
done
fi
Expand Down

0 comments on commit 4fa870d

Please sign in to comment.