diff --git a/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/guide.en-gb.md b/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/guide.en-gb.md new file mode 100644 index 00000000000..13331ae767d --- /dev/null +++ b/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/guide.en-gb.md @@ -0,0 +1,147 @@ +--- +title: ClickHouse - How to connect to a ClickHouse cluster with CLI +excerpt: Learn how to connect to a ClickHouse cluster using the CLI +updated: 2026-01-10 +--- + + + +## Objective + +ClickHouse is an open-source, columnar analytical database system designed for real-time processing of massive data volumes, providing high performance, scalability, and low latency. + +This guide explains how to connect to a ClickHouse cluster using the CLI. + +## Requirements + +- Access to the [OVHcloud Control Panel](/links/manager) +- A [Public Cloud project](/links/public-cloud/public-cloud) in your OVHcloud account +- A [ClickHouse cluster running](/pages/public_cloud/data_analytics/analytics/clickhouse_create_cluster) on OVHcloud Public Cloud [accepting incoming connections](/pages/public_cloud/data_analytics/analytics/clickhouse_incoming_connections) + +## Instructions + +### First CLI connection + +> [!warning] +> Verify that the IP address visible from your browser application is part of the "Authorised IPs" defined for this ClickHouse service. +> +> Check also that the user has granted ACLs for the target topics. + +#### Download server and user certificates + +In order to connect to the ClickHouse service, it is required to use server and user certificates. + +##### Server certificate + +The server CA (*Certificate Authority*) certificate can be downloaded from the `Dashboard`{.action} tab: + +![ClickHouse server certificate](images/clickhouse_get_server_certificate.png){.thumbnail} + +##### User certificate and access key + +The user certificate and the user access key can be downloaded from the `Users`{.action} tab: + +![User informations](images/clickhouse_user_certificate_and_access_key.png){.thumbnail} + +#### Install a ClickHouse CLI + +As part of the official ClickHouse installation, you will have access to several tools, including the standard `clickhouse-client` CLI. You can refer to the official guide here: [ClickHouse Client official](https://clickhouse.com/docs/interfaces/cli){.external}. + +We recommend using the lightweight `clickhouse-client` CLI instead, which does not require a JVM and provides a simple way to execute queries and manage your ClickHouse cluster. + +##### **ClickHouse configuration file** + +You can create a configuration file to simplify connecting to your ClickHouse server: + +The ClickHouse Client can be configured using an XML or YAML file. The client searches for configuration files in the following order: + +1. A file specified with `-c` / `--config` / `--config-file` +2. `./clickhouse-client.[xml|yaml|yml]` +3. `$XDG_CONFIG_HOME/clickhouse/config.[xml|yaml|yml]` (or `~/.config/clickhouse/config.[xml|yaml|yml]` if XDG_CONFIG_HOME is not set) +4. `~/.clickhouse-client/config.[xml|yaml|yml]` +5. `/etc/clickhouse-client/config.[xml|yaml|yml]` + +/// details | **Example XML Configuration** + +Create a file named `clickhouse-client.xml` with the following content: + +```json + + default + your_password + true + + + + /home/user/clickhouse/ca.pem + + + + + + default + clickhouse-12345.cluster.database.cloud.ovh.net + 9440 + + + +``` + +For more information, see the [sample official configuration file](https://github.com/ClickHouse/ClickHouse/blob/master/programs/client/clickhouse-client.xml){.external} + +/// + +/// details | **Example YAML Configuration** + +Create a file named `clickhouse-client.yml` with the following minimal content: + +```yaml +user: default +password: 'your_password' +secure: true +openSSL: + client: + caConfig: '/home/user/clickhouse/ca.pem' +``` + +/// + +Change these values according to your own cluster configuration. + +##### **Insert data into ClickHouse** + +For this first example, let's insert a test row into the `my_table` table in the `test_db` database. + +```bash +clickhouse-client --query "INSERT INTO test_db.my_table (id, message) VALUES (1, 'test-message-content')" +``` + +##### **Query data into ClickHouse** + +Retrieve all the data from the `my_table` table in the `test_db` database: + +```bash +clickhouse-client --query "SELECT * FROM test_db.my_table" +``` + +## We want your feedback! + +We would love to help answer questions and appreciate any feedback you may have. + +If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](/links/professional-services) to get a quote and ask our Professional Services experts for a custom analysis of your project. + +Are you on Discord? Connect to our channel at and interact directly with the team that builds our Analytics service! + +Join our [community of users](/links/community). \ No newline at end of file diff --git a/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/meta.yaml b/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/meta.yaml new file mode 100644 index 00000000000..7e19d5acc6e --- /dev/null +++ b/pages/public_cloud/data_analytics/analytics/clickhouse_connect_cluster_cli/meta.yaml @@ -0,0 +1,4 @@ +id: 1b36ffc6-9756-491b-8ac7-1b9b70eabfbf +full_slug: data-analytics-clickhouse-connect-cli +engine: clickhouse +reference_category: public-cloud-data-analytics-clickhouse-getting-started \ No newline at end of file