Skip to content

Instantly share code, notes, and snippets.

@MihaiTheCoder
Last active June 8, 2017 11:42
Show Gist options
  • Save MihaiTheCoder/4cb1a57e39b811aab957a165887fc3f0 to your computer and use it in GitHub Desktop.
Save MihaiTheCoder/4cb1a57e39b811aab957a165887fc3f0 to your computer and use it in GitHub Desktop.
Install kafka in ubuntu
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.12.1.deb
sudo dpkg -i scala-2.12.1.deb
sudo apt-get update
sudo apt-get install scala
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
wget http://apache.cs.utah.edu/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz
tar -xvzf kafka_2.11-0.10.1.0.tgz
--offset and message retentiont policy
cd kafka_2.11-0.10.1.0
bin/zookeeper-server-start.sh config/zookeeper.properties
new terminal
cd kafka_2.11-0.10.1.0
bin/kafka-server-start.sh config/server.properties
--------USAGE---------------------------------------
--create topic
new terminal
cd kafka_2.11-0.10.1.0
bin/kafka-topics.sh --create --topic my_topic --zookeeper localhost:2181 --replication-factor 1 --partitions 1
--list topics
bin/kafka-topics.sh --list --zookeeper localhost:2181
--start producing messages
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my_topic
--Press Ctrl+C when ready
--start consuming messages
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic my_topic --from-beginning
--You should see the messages produced earlier -- Press Ctrl+C when ready
--test connection to the machine - start a simple server sudo python -m SimpleHTTPServer 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment