Public Repository

Last pushed: 5 months ago
Short Description
Short description is empty for this repo.
Full Description

create a script and run it


N=${1:-4}

i=1
while [ $i -lt $N ]
do
    docker run -itd \
        --net hadoop \
        --cpus=2.0 \
        -m 1g \
        -v /home/idslab/thesis/kafka/$i:/root/kafka_log \
        -v /home/idslab/thesis/zookeeper/$i:/root/zookeeper \
                -e "TZ=Asia/Taipei" \
        --name kafka$i \
                --hostname kafka$i \
        chming1016/kafka:b$i &> /dev/null
    i=$(( $i + 1 ))
done

sleep 10
echo "start Zookeeper Cluster..."
echo 'ctrl+pq to continue...'
docker exec -it kafka1 sh -c '/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties > /root/zookeeper/zookeeper.log' > /dev/null
echo 'ctrl+pq to continue...'
docker exec -it kafka2 sh -c '/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties > /root/zookeeper/zookeeper.log' > /dev/null
echo 'ctrl+pq to continue...'
docker exec -it kafka3 sh -c '/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties > /root/zookeeper/zookeeper.log' > /dev/null

sleep 10
echo 'start Kafka Cluster...'
echo 'ctrl+pq to continue...'
docker exec -it kafka1 sh -c '/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties  > /root/kafka_log/kafka.log' > /dev/null
echo 'ctrl+pq to continue...'
docker exec -it kafka2 sh -c '/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties  > /root/kafka_log/kafka.log' > /dev/null
echo 'ctrl+pq to continue...'
docker exec -it kafka3 sh -c '/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties  > /root/kafka_log/kafka.log' > /dev/null
Docker Pull Command
Owner
chming1016