Enabling cluster fault tolerance

A Managed Service for ClickHouse cluster with one host doesn't ensures fault tolerance or data replication. To make the cluster more reliable, you can add more ClickHouse hosts, but to be able to manage them, you first need to add ZooKeeper hosts to the cluster.

Important

You can add exactly 3 ZooKeeper hosts to the cluster.

Add hosts ZooKeeper

For the ZooKeeper hosts you add, you can indicate the computing power (host class) and subnets to accommodate your hosts.

The following characteristics are set for the ZooKeeper hosts by default:

  • host class s1.nano
  • disk size 10 GB
  • storage type — fast network storage.

To add ZooKeeper hosts:

  1. Go to the folder page and select Managed Service for ClickHouse.

  2. Click on the name of the cluster you need and select the Hosts tab.

  3. Click the Add ZooKeeper hosts button.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View a description of the CLI command for adding ZooKeeper hosts:

    $ yc managed-clickhouse cluster add-zookeeper --help
    
  2. Run the operation with the default host characteristics:

    $ yc managed-clickhouse cluster add-zookeeper clickhouse417 \
                            --host zone-id=ru-central1-c,subnet-name=default-c \
                            --host zone-id=ru-central1-a,subnet-name=default-a \
                            --host zone-id=ru-central1-b,subnet-name=default-b
    

    If the network hosting the cluster contains exactly 3 subnets, each per availability zone, you do not have to explicitly specify subnets for the hosts: Managed Service for ClickHouse automatically distributes hosts over the subnets.

    You can query the cluster name with the list of clusters in the folder.

To add ZooKeeper hosts to the cluster, use the addZookeeper method.