setup_services.sh 919 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. set -ex
  3. stop toxiproxy || true
  4. cp ${REPOSITORY_ROOT}/vagrant/toxiproxy.conf /etc/init/toxiproxy.conf
  5. cp ${REPOSITORY_ROOT}/vagrant/run_toxiproxy.sh ${KAFKA_INSTALL_ROOT}/
  6. start toxiproxy
  7. for i in 1 2 3 4 5; do
  8. ZK_PORT=`expr $i + 2180`
  9. KAFKA_PORT=`expr $i + 9090`
  10. stop zookeeper-${ZK_PORT} || true
  11. # set up zk service
  12. cp ${REPOSITORY_ROOT}/vagrant/zookeeper.conf /etc/init/zookeeper-${ZK_PORT}.conf
  13. sed -i s/KAFKAID/${KAFKA_PORT}/g /etc/init/zookeeper-${ZK_PORT}.conf
  14. # set up kafka service
  15. cp ${REPOSITORY_ROOT}/vagrant/kafka.conf /etc/init/kafka-${KAFKA_PORT}.conf
  16. sed -i s/KAFKAID/${KAFKA_PORT}/g /etc/init/kafka-${KAFKA_PORT}.conf
  17. sed -i s/ZK_PORT/${ZK_PORT}/g /etc/init/kafka-${KAFKA_PORT}.conf
  18. start zookeeper-${ZK_PORT}
  19. done
  20. # Wait for the last kafka node to finish booting
  21. while ! nc -q 1 localhost 29095 </dev/null; do echo "Waiting"; sleep 1; done