ClickHouse/tests/instructions/kafka.txt
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

46 lines
1.1 KiB
Plaintext

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;