==作者:YB-Chi==
[toc]
部署结构
3节点3实例3分片2副本
配置文件
/etc/clickhouse-server/metrika.xml
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
| <?xml version="1.0"?> <clickhouse> <clickhouse_remote_servers> <cyb_cluster> <shard> <internal_replication>true</internal_replication> <replica> <host>node1</host> <port>9000</port> </replica> <replica> <host>node2</host> <port>9002</port> </replica> </shard> <shard> <internal_replication>true</internal_replication> <replica> <host>node2</host> <port>9000</port> </replica> <replica> <host>node3</host> <port>9002</port> </replica> </shard> <shard> <internal_replication>true</internal_replication> <replica> <host>node3</host> <port>9000</port> </replica> <replica> <host>node1</host> <port>9002</port> </replica> </shard> </cyb_cluster> </clickhouse_remote_servers> <macros> <layer>ckcluster_3shard_2replica</layer> <shard>shard01</shard> <replica>node1</replica> </macros> <networks> <ip>::/0</ip> </networks> <clickhouse_compression> <case> <min_part_size>10000000000</min_part_size> <min_part_size_ratio>0.01</min_part_size_ratio> <method>lz4</method> </case> </clickhouse_compression> </clickhouse>
|
其他节点差异化的参数就俩 <shard>shard01</shard>
和 <replica>node1</replica>
config.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <remote_servers incl="clickhouse_remote_servers" /> <include_from>/etc/clickhouse-server/metrika.xml</include_from> <macros incl="macros" optional="true"/> <zookeeper> <node> <host>node1</host> <port>2181</port> </node> <node> <host>node2</host> <port>2181</port> </node> <node> <host>node3</host> <port>2181</port> </node> </zookeeper>
|
后续
1 2 3 4 5 6
| chown clickhouse:clickhouse /etc/clickhouse-server/metrika.xml #3节点需要每个节点起俩实例,需要修改端口,这里不做演示了,可以参考`12实例15node多实例集群部署方案` #启动 systemctl start clickhouse-server #开机自启 systemctl enable clickhouse-server
|