Skip to content

Instantly share code, notes, and snippets.

@donpark
Created February 14, 2012 02:58
Show Gist options
  • Save donpark/1823012 to your computer and use it in GitHub Desktop.
Save donpark/1823012 to your computer and use it in GitHub Desktop.
Running Kafka 0.7

Running Apache Kafka 0.7

Download Initial Package

wget http://people.apache.org/~nehanarkhede/kafka-0.7.0-incubating/kafka-0.7.0-incubating-src.tar.gz
tar xvzf kafka-0.7.0-incubating-src.tar.gz
cd kafka-0.7.0-incubating-src

Build Kafka

Bootstrap sbt then enter sbt command prompt:

./sbt

Download jars Kafka depends on, build Kafka, then exit sbt prompt:

update
package
exit

Launch ZooKeeper and Kafka

Run ZooKeeper (in new terminal session)

bin/zookeeper-server-start.sh config/zookeeper.properties

Run Kafka server (in new terminal session)

bin/kafka-server-start.sh config/server.properties

Test

Run test consumer (in new terminal session)

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

Run test producer (in new terminal session)

bin/kafka-console-producer.sh --zookeeper localhost:2181 --topic test

From test producer's terminal session, type a message then hit return to log a test topic message:

Hello World!!!

Check test consumer's terminal session. You should see Hello World!!! received by the consumer.

Node.js and Kafka

I haven't tested it yet but Marcus Westin has a Kafka client module for Node.js here which can be installed using NPM like this:

npm install kafka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment