本测试采用ReplicatedMergeTree + Distributed引擎作为集群结构的引擎
需要注意的是ReplicatedMergeTree('zk路径,如果要相互复制,这里必须一样', '副本名称, 必须不一样', 剩下的就是分区和主键,以及索引粒度)
[root@node100 ~]# clickhouse-client -m --password UHXQQmhb
ClickHouse client version 1.1.54385.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54385.
localhost :) create database ontime; #所有节点执行
localhost :) use ontime; #所有节点执行
localhost :) CREATE TABLE ontime (FlightDate Date,Year UInt16) ENGINE = ReplicatedMergeTree('/clickhouse/tables/ontime/shard1','1',FlightDate,(Year, FlightDate),8192); #分片1的第1个副本执行
localhost :) CREATE TABLE ontime (FlightDate Date,Year UInt16) ENGINE = ReplicatedMergeTree('/clickhouse/tables/ontime/shard1','2',FlightDate,(Year, FlightDate),8192); #分片1的第2个副本执行
localhost :) CREATE TABLE ontime (FlightD