Last active
May 31, 2017 18:29
-
-
Save deanproctor/f1bc31ac817d356b6ec2ce37e6582876 to your computer and use it in GitHub Desktop.
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 | |
# Quick and dirty script to install Kafka and the Couchbase connector on RHEL7 | |
rm -rf /tmp/kafka-logs | |
rm -rf /tmp/zookeeper | |
service firewalld stop | |
chkconfig firewalld off | |
mkdir -p kafka | |
cd kafka | |
if [ ! -e scala-2.12.2.rpm ]; then | |
wget https://downloads.lightbend.com/scala/2.12.2/scala-2.12.2.rpm | |
fi | |
yum install -y java-1.8.0-openjdk wget unzip tar curl scala-2.12.2.rpm | |
export JAVA_HOME=/usr/lib/jvm/jre | |
if [ ! -d kafka_2.12-0.10.2.1 ]; then | |
wget http://www-eu.apache.org/dist/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz | |
tar xzf kafka_2.12-0.10.2.1.tgz | |
fi | |
export KAFKA_HOME=$(pwd)/kafka_2.12-0.10.2.1 | |
if [ ! -d kafka-connect-couchbase-3.1.3 ]; then | |
wget http://packages.couchbase.com/clients/kafka/3.1.3/kafka-connect-couchbase-3.1.3.zip | |
unzip kafka-connect-couchbase-3.1.3.zip | |
cd kafka-connect-couchbase-3.1.3 | |
cp etc/kafka-connect-couchbase/*.properties $KAFKA_HOME/config/ | |
cp share/java/kafka-connect-couchbase/*.jar $KAFKA_HOME/libs | |
wget http://gist.githubusercontent.com/dmaier-couchbase/f5110d183fae0b558b59668d3bec21db/raw/3eceb5884e246946547e5b287dd5ace406724574/blog-kafka-3-connect-config.properties -O $KAFKA_HOME/config/couchbase-distributed.properties | |
wget http://gist.githubusercontent.com/deanproctor/e9f2e5adccc76a38030a70d13597bb67/raw/d51c3c6f67b11e1db0245a8ce21afbff815b08ea/gistfile1.txt -O $KAFKA_HOME/config/couchbase-distributed.json | |
fi | |
$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties & | |
sleep 5 | |
$KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties & | |
sleep 5 | |
$KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test-cb & | |
sleep 5 | |
$KAFKA_HOME/bin/connect-distributed.sh $KAFKA_HOME/config/couchbase-distributed.properties & | |
sleep 20 | |
cd $KAFKA_HOME | |
curl -XPOST http://localhost:8083/connectors -d "@config/couchbase-distributed.json" -H "Content-Type: application/json" | |
sleep 10 | |
$KAFKA_HOME/bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test-cb --from-beginning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment