Add sample instruction on how to test Kafka with ClickHouse locally

This commit is contained in:
Ivan Lezhankin 2019-01-15 15:57:06 +03:00
parent f4a18ccb32
commit 76c4b86e0a

View File

@ -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 <kafka_container_id> 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;