radondb / radondb-clickhouse-operator

Apache License 2.0
23 stars 11 forks source link

How to implement logical cluster? #9

Closed haiertashu closed 2 years ago

haiertashu commented 2 years ago

Hi All, I saw the feature about logical cluster has already implemented in the Release Notes v2.0.0, but I found no idea about the details of the implements from the source code in file ch_config_generator.go: func (c *ClickHouseConfigGenerator) GetRemoteServers(options *RemoteServersGeneratorOptions) string {

Could you tell me how the logical cluster comes true? Thanks!

sozenh commented 2 years ago

In clickhouse, there are two cluster implementations:

  1. Logical consistency cluster: by distributed + mergetree engine. This method does not rely on zookeeper, and the data writing of the replica is led by the distributed engine;
  2. Physically consistent cluster: by distributed + replicatedmergetree engine. This method relies on zookeeper for data synchronization between replicas;

You can see the difference between these two clusters in the configuration file. The internal_replication of the logical consistency cluster is false, and the internal_replication of the physical consistency cluster is true;