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;