mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Add sample instruction on how to test Kafka with ClickHouse locally
This commit is contained in:
parent
f4a18ccb32
commit
76c4b86e0a
45
dbms/tests/instructions/kafka.txt
Normal file
45
dbms/tests/instructions/kafka.txt
Normal 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;
|
Loading…
Reference in New Issue
Block a user