-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.sql
69 lines (67 loc) · 1.64 KB
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
CREATE DATABASE IF NOT EXISTS saimiris;
CREATE TABLE saimiris.from_kafka
(
timestamp DateTime64,
agent_id String,
reply_src_addr IPv6,
reply_dst_addr IPv6,
reply_id UInt16,
reply_size UInt16,
reply_ttl UInt8,
reply_protocol UInt8,
reply_icmp_type UInt8,
reply_icmp_code UInt8,
reply_mpls_labels Array(Tuple(UInt32, UInt8, UInt8, UInt8)),
probe_src_addr IPv6,
probe_dst_addr IPv6,
probe_id UInt16,
probe_size UInt16,
probe_protocol UInt8,
quoted_ttl UInt8,
probe_src_port UInt16,
probe_dst_port UInt16,
probe_ttl UInt8,
rtt UInt16
)
ENGINE = Kafka()
SETTINGS
kafka_broker_list = '10.0.0.100:9093',
kafka_topic_list = 'saimiris-results',
kafka_group_name = 'clickhouse-saimiris-group',
kafka_format = 'CSV',
kafka_max_rows_per_message = 1048576;
CREATE TABLE saimiris.results
(
timestamp DateTime64,
agent_id String,
reply_src_addr IPv6,
reply_dst_addr IPv6,
reply_id UInt16,
reply_size UInt16,
reply_ttl UInt8,
reply_protocol UInt8,
reply_icmp_type UInt8,
reply_icmp_code UInt8,
reply_mpls_labels Array(Tuple(UInt32, UInt8, UInt8, UInt8)),
probe_src_addr IPv6,
probe_dst_addr IPv6,
probe_id UInt16,
probe_size UInt16,
probe_protocol UInt8,
quoted_ttl UInt8,
probe_src_port UInt16,
probe_dst_port UInt16,
probe_ttl UInt8,
rtt UInt16
)
ENGINE = MergeTree()
ORDER BY (
probe_protocol,
probe_src_addr,
probe_dst_addr,
probe_src_port,
probe_dst_port,
probe_ttl
);
CREATE MATERIALIZED VIEW saimiris.from_kafka_mv TO saimiris.results
AS SELECT * FROM saimiris.from_kafka;