Skip to content

Commit

Permalink
Merge pull request #6 from xBazilio/kafka_cluster
Browse files Browse the repository at this point in the history
kafka_cluster
  • Loading branch information
xBazilio authored May 27, 2021
2 parents 2a7e71a + 143ec45 commit e84650d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ I did my best to include helpfull examples for most common use cases

1. Download and unpack [kafka](https://kafka.apache.org/downloads) into `kafka_distr` folder
1. Copy and overwrite *.properties files from `kafka_custom_config` to `kafka_distr/config`
1. Copy and overwrite `kafka-server-start.sh` fo `kafka_distr/bin`
1. Run `docker-compose up`

### Usage
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
volumes:
- "$PWD/kafka_distr:/opt/kafka"
- "$PWD/zookeeper/data/zoo1:/opt/zookeeper"
hostname: zoo1
networks:
- kafka-lab
zoo2:
Expand All @@ -16,6 +17,7 @@ services:
volumes:
- "$PWD/kafka_distr:/opt/kafka"
- "$PWD/zookeeper/data/zoo2:/opt/zookeeper"
hostname: zoo2
networks:
- kafka-lab
zoo3:
Expand All @@ -25,6 +27,7 @@ services:
volumes:
- "$PWD/kafka_distr:/opt/kafka"
- "$PWD/zookeeper/data/zoo3:/opt/zookeeper"
hostname: zoo3
networks:
- kafka-lab

Expand All @@ -37,6 +40,7 @@ services:
- zoo1
- zoo2
- zoo3
hostname: kafka1
networks:
- kafka-lab
environment:
Expand All @@ -51,6 +55,7 @@ services:
- zoo1
- zoo2
- zoo3
hostname: kafka2
networks:
- kafka-lab
environment:
Expand All @@ -65,6 +70,7 @@ services:
- zoo1
- zoo2
- zoo3
hostname: kafka3
networks:
- kafka-lab
environment:
Expand Down
46 changes: 46 additions & 0 deletions kafka-server-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

sleep 20

if [ $# -lt 1 ];
then
echo "USAGE: $0 [-daemon] server.properties [--override property=value]*"
exit 1
fi
base_dir=$(dirname $0)

if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi

EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'}

COMMAND=$1
case $COMMAND in
-daemon)
EXTRA_ARGS="-daemon "$EXTRA_ARGS
shift
;;
*)
;;
esac

exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"

0 comments on commit e84650d

Please sign in to comment.