Replication in Managed Service for ClickHouse®

ClickHouse® can manage replication for clusters. It uses ClickHouse Keeper as its coordination system. This allows you to use replicated tables in clusters with any number of hosts.

The process of replication is managed automatically.

ClickHouse® Keeper

By default, ClickHouse Keeper provides the same guarantees as ZooKeeper (linearizable writes, non-linearizable reads).

ClickHouse Keeper client-server protocol is compatible with ZooKeeper. However, ClickHouse Keeper snapshots and logs use a format incompatible with ZooKeeper.

ClickHouse Keeper doesn't need separate hosts to perform replication, it operates within ClickHouse® hosts themselves.

Warning

You cannot turn off ClickHouse Keeper support on your clusters.

For more information, see the ClickHouse® documentation

Replicated tables

ClickHouse® uses the ReplicatedMergeTree engine to create and manage replication tables. To enable replication, create tables on each host separately or use a distributed DDL query .

Tip

Create replicated tables on all hosts within your cluster. Otherwise, data loss is possible after you restore the cluster from a backup.

For more information, see Backups in Managed Service for ClickHouse®.

Replication for new hosts and shards

When you create a new host on your cluster, the Managed Service for ClickHouse® copies the schema to this host automatically. Then it selects a random host within the same shard and copies all the tables from the shard.

When a new shard is created, the replication sequence is the same as described above, except that a random host is selected from the first shard on the cluster.

Transfer to hosts with replicated tables

If you create a transfer to a host with a replicated table, all the new data from the transfer will be automatically replicated to all the hosts within the cluster.

See ClickHouse® sharding for more information on how to manage interactions between replicated and distributed tables in your Managed ClickHouse® cluster.

See also