Last active
December 29, 2015 12:09
-
-
Save kaolian/7668946 to your computer and use it in GitHub Desktop.
Vagrant provisioning script for kafka
This file contains hidden or 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/sh | |
| wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
| rpm -ivh epel-release-6-8.noarch.rpm | |
| wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0/hdp.repo -O /etc/yum.repos.d/hdp.repo | |
| cp /vagrant/files/jdk-7u45-linux-x64.rpm . | |
| rpm -Uvh jdk-7u45-linux-x64.rpm | |
| ## java ## | |
| alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000 | |
| ## javaws ## | |
| alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000 | |
| ## Install javac only if you installed JDK (Java Development Kit) package ## | |
| alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000 | |
| alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000 | |
| yum -y install python-pip git | |
| #low-level kafka wrapper class in python | |
| git clone https://github.com/mumrah/kafka-python.git | |
| pip install ./kafka-python/ | |
| cd kafka-python | |
| #install kafka | |
| git submodule init | |
| git submodule update | |
| #build kafka jar | |
| cd kafka-src | |
| ./sbt update | |
| ./sbt package | |
| ./sbt assembly-package-dependency | |
| #change zookeeper port from 2181 to 2182 for preventing conflict with preinstalled one | |
| sed -i "s/2181/2182/g" config/* | |
| #replace host.name | |
| sed -i 's/#host.name=localhost/host.name=192.168.56.201/g' config/server.properties | |
| #run kafka-server, zookeeper | |
| bin/zookeeper-server-start.sh config/zookeeper.properties & | |
| bin/kafka-server-start.sh config/server.properties & | |
| cd .. | |
| cp /vagrant/files/dummyconsumer.py . | |
| cp /vagrant/files/dummyproducer.py . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment