From 76c4b86e0ad60598b4cc6aacddad73716374fa1b Mon Sep 17 00:00:00 2001 From: Ivan Lezhankin Date: Tue, 15 Jan 2019 15:57:06 +0300 Subject: [PATCH] Add sample instruction on how to test Kafka with ClickHouse locally --- dbms/tests/instructions/kafka.txt | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 dbms/tests/instructions/kafka.txt diff --git a/dbms/tests/instructions/kafka.txt b/dbms/tests/instructions/kafka.txt new file mode 100644 index 00000000000..69e87f38b24 --- /dev/null +++ b/dbms/tests/instructions/kafka.txt @@ -0,0 +1,45 @@ +Use this config for docker-compose: + + version: '3' + + services: + + kafka: + depends_on: + - zookeeper + hostname: kafka + image: wurstmeister/kafka + environment: + KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + ports: + - "9092:9092" + - "9094:9094" + + security_opt: + - label:disable + + zookeeper: + hostname: zookeeper + image: zookeeper + + security_opt: + - label:disable + +Start containers with `docker-compose up`. + +In clickhouse-client create table like: + + CREATE TABLE kafka ( a UInt8, b String) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'CSV') SETTINGS kafka_row_delimiter = '\n'; + +Login inside Kafka container and stream some data: + + docker exec -it bash --login + vi data.csv + cat data.csv | /opt/kafka/bin/kafka-console-producer.sh --topic topic --broker-list localhost:9092 + +Read data in clickhouse: + + SELECT * FROM kafka;