clickhouse集群中 macros 配置
发布于 10 个月前 作者 YouDail 1134 次浏览 来自 问答

我的clickhouse 集群是3个节点,划分了3个shard,每个shard有2个replica,集群状态是这样的:

default_cluster 1 1 1 clickhouse-0 10.200.81.67 9000 1 sys_distrib_query default_cluster 1 1 2 clickhouse-1 10.100.160.75 9000 1 sys_distrib_query default_cluster 2 1 1 clickhouse-1 10.100.160.75 9000 0 sys_distrib_query default_cluster 2 1 2 clickhouse-2 10.100.154.36 9000 0 sys_distrib_query default_cluster 3 1 1 clickhouse-2 10.100.154.36 9000 1 sys_distrib_query default_cluster 3 1 2 clickhouse-0 10.200.81.67 9000 1 sys_distrib_query

使用 ReplicatedMergeTree 建表,语句中的/{layer} 和 {shard} 不知道怎么写在macros 配置文件里:

CREATE TABLE table_name ( EventDate DateTime, CounterID UInt32, UserID UInt32 ) ENGINE = ReplicatedMergeTree(’/clickhouse/tables/{layer}-{shard}/hits’, ‘{replica}’) PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID)

麻烦各位大神解说下

1 回复

配置文件里面:

<macros> <shard>xx</shard> <layer>yy</layer> </macros>

回到顶部