| Setting up a Kafka/Zookeeper config on the default localhost ports is simple |
| and well documented at https://kafka.apache.org/quickstart. This should do it: |
| |
| After downloading kafka: |
| |
| tar zxf ~/Downloads/kafka_2.11-0.10.1.0.tgz |
| cd kafka_2.11-0.10.1.0/ |
| |
| # start the servers (best in separate windows) |
| bin/zookeeper-server-start.sh config/zookeeper.properties |
| bin/kafka-server-start.sh config/server.properties |
| |
| The sample requires a topic. Create it: |
| |
| # create our kafka sample topic |
| bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafkaSampleTopic |
| bin/kafka-topics.sh --list --zookeeper localhost:2181 |
| |
| # quick verify |
| bin/kafka-console-producer.sh --broker-list localhost:9092 --topic kafkaSampleTopic |
| hi |
| there |
| ^D |
| bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kafkaSampleTopic --from-beginning |
| ... you should see the "hi" and "there" messages. |