Created
March 8, 2018 04:12
-
-
Save bjethwan/e2d774ddda3fb1eb23241d6ff1e007c6 to your computer and use it in GitHub Desktop.
Script to convert a single broker kafka instance to multi instance on single node for my demo at TMB...changing the boker.id, broker.port, and broker.log.dirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -rf mykafka | |
mkdir mykafka | |
cd mykafka | |
mkdir kafka-config | |
mkdir kafka-log0 | |
mkdir kafka-log1 | |
mkdir kafka-log2 | |
cp /opt/kafka_2.12-1.0.0/config/server.properties kafka-config/server0.properties | |
cp /opt/kafka_2.12-1.0.0/config/server.properties kafka-config/server1.properties | |
cp /opt/kafka_2.12-1.0.0/config/server.properties kafka-config/server2.properties | |
sed -i 's|broker.id=0|broker.id=0|' kafka-config/server0.properties | |
sed -i 's|broker.id=0|broker.id=1|' kafka-config/server1.properties | |
sed -i 's|broker.id=0|broker.id=2|' kafka-config/server2.properties | |
sed -i 's|#listeners=PLAINTEXT://:9092|listeners=PLAINTEXT://:9092|' kafka-config/server0.properties | |
sed -i 's|#listeners=PLAINTEXT://:9092|listeners=PLAINTEXT://:9093|' kafka-config/server1.properties | |
sed -i 's|#listeners=PLAINTEXT://:9092|listeners=PLAINTEXT://:9094|' kafka-config/server2.properties | |
sed -i 's|log.dirs=/tmp/kafka-logs|log.dirs=/home/ec2-user/mykafka/kafka-log0|' kafka-config/server0.properties | |
sed -i 's|log.dirs=/tmp/kafka-logs|log.dirs=/home/ec2-user/mykafka/kafka-log1|' kafka-config/server1.properties | |
sed -i 's|log.dirs=/tmp/kafka-logs|log.dirs=/home/ec2-user/mykafka/kafka-log2|' kafka-config/server2.properties | |
cp /opt/kafka_2.12-1.0.0/config/zookeeper.properties kafka-config/zookeeper.properties | |
zookeeper-server-start.sh -daemon kafka-config/zookeeper.properties | |
kafka-server-start.sh -daemon kafka-config/server0.properties | |
kafka-server-start.sh -daemon kafka-config/server1.properties | |
kafka-server-start.sh -daemon kafka-config/server2.properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AWS -> Red Hat Enterprise Linux 7.4