Help Center/ MapReduce Service/ Component Operation Guide (LTS)/ Using ClickHouse/ Configuring Strong Data Consistency Between ClickHouse Replicas
Updated on 2024-05-29 GMT+08:00

Configuring Strong Data Consistency Between ClickHouse Replicas

This section applies to MRS 3.3.0-LTS or later.

Scenario

ClickHouse supports multiple replicas. When data is written to a local table, the data on the current node is updated immediately, but the data between other replicas is asynchronously updated.

Configure ClickHouse to ensure strong data consistency between replicas.

Parameter Configuration

The priority of configuring strong data consistency between ClickHouse replicas is as follows: single statements > sessions > global defaults.

Strong data consistency between replicas must be used together with atomicity. Otherwise, an exception occurs during data insertion and the rollback fails.

Log in to FusionInsight Manager and choose Cluster > Services > ClickHouse. Click Configurations then All Configurations, click Reliability, and search for and modify the following parameters:

Parameter

Description

profiles.default.insert_quorum

Whether to enable strong data consistency between ClickHouse replicas. The default value is 0, indicating that strong consistency between replicas is disabled. Value options are as follows: 0 to 9, auto, and all.

  • If this parameter is set to a number, the INSERT operation can succeed only when ClickHouse attempts to correctly write data to the insert_quorum of replicas during the insert_quorum_timeout period.
  • auto indicates that the INSERT operation is successful only when data is correctly written to more than half of the replicas.
  • all indicates that the INSERT operation is successful only when data is correctly written to all replicas.

profiles.default.insert_quorum_timeout

Timeout interval for writing strongly consistent data between replicas. The default value is 600000 ms. The value must be greater than 0.