Skip to content

Instantly share code, notes, and snippets.

@tt293
Created August 27, 2018 16:05
Show Gist options
  • Save tt293/b0574c13133136a4f0b76733dddb102e to your computer and use it in GitHub Desktop.
Save tt293/b0574c13133136a4f0b76733dddb102e to your computer and use it in GitHub Desktop.
Install kafka
# Install JDK 8
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm
sudo yum install -y jdk-8u141-linux-x64.rpm
# Download and unzip Scala and Kafka
wget http://www.scala-lang.org/files/archive/scala-2.12.6.tgz
tar xvf scala-2.12.6.tgz
wget https://archive.apache.org/dist/kafka/0.8.1/kafka_2.12-2.0.0.tgz
tar zxvf kafka_2.12-2.0.0.tgz
# Add to path
export PATH=$PATH:$HOME/bin:/home/ec2-user/scala-2.12.6/bin:/home/ec2-user/kafka_2.12-2.0.0/bin/
#Start Zookeeper
nohup bin/zookeeper-server-start.sh config/zookeeper.properties &
nohup bin/kafka-server-start.sh config/server.properties &
#Producer
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test &
bin/kafka-topics.sh --list --zookeeper localhost:2181
#Consumer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment