Download and start Kafka
Apache Kafka is a high throughput message bus that works well with Druid. For this tutorial, we will use Kafka 2.1.0. To download Kafka, issue the following commands in your terminal:
curl -O https://archive.apache.org/dist/kafka/2.1.0/kafka_2.12-2.1.0.tgz
tar -xzf kafka_2.12-2.1.0.tgz
cd kafka_2.12-2.1.0
需要修改配置参数server.properties,不然连接不上:
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
host.name=192.168.1.8
listeners=PLAINTEXT://192.168.1.8:9092
advertised.host.name=192.168.1.8
advertised.port=2181
advertised.listeners=PLAINTEXT://192.168.1.8:9092
zookeeper.connect=192.168.1.8:2181
Start a Kafka broker by running the following command in a new terminal:
./bin/kafka-server-start.sh config/server.properties
Run this command to create a Kafka topic called wikipedia, to which we'll send data:
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic wikipedia