赞
踩
CREATE TABLE kafka.Vehicle (
json String
) ENGINE = Kafka SETTINGS
kafka_broker_list = 'xxx.xxx.xxx.xxx:9092',
kafka_topic_list = 'Vehicle',
kafka_group_name = 'clickhouse1',
kafka_format = 'LineAsString',
kafka_num_consumers = 1;
必选参数:
kafka_broker_list
: 这里填写Kafka服务的broker列表,用逗号分隔kafka_topic_list
: 这里填写Kafka topic,多个topic用逗号分隔kafka_group_name
:这里填写消费者group名称kafka_format
__:Kafka数据格式, ClickHouse支持的Format, 详见这里CREATE TABLE kafka_sync.VehicleWarningRaw
(
ts DateTime,
json String
) ENGINE = MergeTree()
ORDER BY ts
TTL ts + INTERVAL 1 MONTH DELETE;
CREATE MATERIALIZED VIEW kafka.Vehicle_consumer TO kafka_sync.Vehicle AS
SELECT now() AS ts, json AS json
FROM kafka.Vehicle;
DETACH TABLE kafka.Vehicle_consumer;
ATTACH TABLE kafka.Vehicle_consumer;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。