Install ClickHouse

System Requirements and Runtime Notes

ClickHouse is configured to run with a minimum of 16 GB RAM. You can further optimize performance by applying the best practices for schema design, memory management, and storage.

The 3.3.6 ODP distribution includes JDK 11 and Python 3 as standard runtime components.

Steps to Install

  1. Run the following command to install Mpack on Ambari Server.
Bash
Copy
  1. To begin, add the ClickHouse service from the list in the Ambari UI. Once added, proceed with the installation steps.
  2. Choose your deployment template based on your specific requirements. Here are some reusable examples, but note that actual deployment may vary depending on your use case:
ServerKeeperWeb ServerKeeper Node List*ShardReplicaHost Shard Replica Map**
111111hostA:1:1
3331@hostA,2@hostB,3@hostC13hostA:1:1,hostB:1:2,hostC:1:3
63 or 631@hostA,2@hostB,3@hostC32hostA:1:1,hostB:1:2,hostC:2:1,hostD:2:2,hostE:3:1,hostF:3:2
  1. Set the Cluster Name and Cluster Secret values.
  2. Configure the Keeper Node List using the format shown in the templates above.
  3. Define the Host-Shard-Replica Mapping as per the template examples provided.

Once these settings are configured, proceed to the next steps to deploy the service.

Ideal case for HA: ClickHouse Cluster requirements: Minimum 2 servers + 3 Keepers for quorum

Keeper Management

The Keeper Node List configuration manages the persistent mapping of Node IDs to hostnames. Currently, this mapping must be manually specified by the user and set within the configuration files under the keeper_config.d directory on each host.

Important Requirements:

  • Follow the right syntax as mentioned in the example: ID@FQDN → 1@host1.acceldata.ce
  • Do not assign the same Node ID to multiple hosts. Each host must have a unique Node ID.
  • Avoid reusing old Node IDs when replacing or adding new hosts. This helps prevent conflicts and data corruption.
  • Always assign a new, incremented Node ID when provisioning a new or replacement host.

For additional information, see the Keeper Maintenance section below.

Keeper Maintenance

Adding a Keeper Node To add a Keeper node, update the Keeper Node List configuration, ensuring that the Keeper management rules are followed. After making the changes, perform a rolling restart of the Keeper service.

Removing a Keeper Node To remove a Keeper node, modify the Keeper Node List configuration while following the Keeper management rules. After the update, perform a rolling restart of the Keeper service.

Shard Replica Management

The Host Shard Replica Map configuration in Ambari defines and persists the cluster topology across hosts. It informs each node about the overall cluster structure, including the number of shards and replicas.

The configuration follows this format:

Bash
Copy

Example: For a 3-node cluster with 1 shard and 3 replicas, the Host Shard Replica Map configuration looks like:

Bash
Copy
  • hostA, hostB, and hostC are the fully qualified domain names (FQDNs) of the ClickHouse servers.
  • The second value (1) is the shard ID (same for all, since there’s only 1 shard).
  • The third value (1, 2, 3) is the replica ID.

The above configuration represents 1 shard with 3 replicas, and each node contains a replica of the same shard.

Best Practices

The total number of unique ClickHouse server nodes in the cluster must equal the product of shards and replicas, as each (shard, replica) pair maps to one physical node.

Ensure that all nodes use a consistent configuration during the initial cluster setup to avoid mismatches and connectivity issues.

Valid Combinations for a Three-Node Cluster

ShardsReplicasDescriptionTotal Server Nodes Required
131 shard replicated across 3 nodes3
313 shards, no replication3
12Only 2 nodes needed (not HA on 3)❌ Applicable but not recommended
22Requires 4 nodes (not valid here)❌ Not applicable

Server Maintenance

Adding Servers To add a server, update the Host Shard Replica Map configuration as needed for shard–replica management. Ensure all shard management rules are followed. After making the changes, perform a rolling restart of the Servers service.

Removing Servers To remove a server, update the Host Shard Replica Map configuration accordingly. Ensure all shard management rules are followed. After making the changes, perform a rolling restart of the Servers service.

Note: High availability (HA) is not supported for the ClickHouse UI.

Unistall ClickHouse

You can use the following command to uninstall ClickHouse.

Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated