This topic describes how to connect to a cluster. ApsaraDB for ClickHouse allows you to use the command-line tool of ClickHouse, Data Management (DMS), or another client such as DataGrip or DBeaver to connect to an ApsaraDB for ClickHouse cluster.

Background information

DMS is an end-to-end data management service provided by Alibaba Cloud. DMS allows you to create ApsaraDB for ClickHouse clusters and tables and query data online. You can connect to an ApsaraDB for ClickHouse cluster and query data in the cluster without installing local clients. For more information, see Manage data.

Use DMS to connect to an ApsaraDB for ClickHouse cluster

  1. Use an Alibaba Cloud account to log on to the ApsaraDB for ClickHouse console.
  2. In the upper-left corner of the page, select the region where the cluster to which you want to connect is deployed.
  3. On the Clusters page, click the ID of the cluster.
  4. In the upper-right corner of the Cluster Information page, click Log On to Database.
  5. Specify the logon information of the ApsaraDB for ClickHouse cluster.
    14610801
    1. Specify the account name of the cluster.
    2. Specify the password of the account.
  6. Click Login.

Use the command-line tool of ClickHouse to connect to an ApsaraDB for ClickHouse cluster

  1. Use an Alibaba Cloud account to log on to the ApsaraDB for ClickHouse console.
  2. In the upper-left corner of the page, select the region where the cluster to which you want to connect is deployed.
  3. On the Clusters page, click the ID of the cluster.
  4. On the Cluster Information page, view the address information.
    14610802
    Note HTTP port 3306 and TCP port 8123 are provided. You can select one of the ports.
  5. Download the client based on your operating system type and ApsaraDB for ClickHouse version. If your operating system uses Linux and the version of your ApsaraDB for ClickHouse version number is 19.15.2.2, you can download the ClickHouse client.
  6. Use the following command to connect to the cluster:
    ./clickhouse-client --host=<host> --port=<port> --user=<user> --password=<password>
    Parameter descriptions:

    host: the VPC endpoint or public endpoint. If an Elastic Compute Service (ECS) instance and the cluster are deployed in the same virtual private cloud (VPC) and you want to use the ECS instance to connect to the cluster, set host to the VPC Endpoint value in the preceding figure. If you use a machine that is not deployed in the VPC to connect to the cluster, set host to the Public IP Address value.

    port: the port number in the connection string of the host address parameter.

    user: the username created in the Account Management module.

    password: the password set when you create the username in the Account Management module.