You can use the clickhouse-client to connect to an ApsaraDB for ClickHouse cluster.
Prerequisites
-
You have created an ApsaraDB for ClickHouse cluster. For more information, see Create a cluster.
-
You have created a database account and a password. For more information, see Create an account.
-
You have installed a compatible version of the clickhouse-client. For the download link, see clickhouse-client.
-
If the clickhouse-client server is not in the same VPC as the ApsaraDB for ClickHouse cluster, apply for a public endpoint first. For more information, see Apply for and release a public endpoint.
-
You have added the IP address of the server running the clickhouse-client to the ApsaraDB for ClickHouse whitelist. For more information, see Configure a whitelist.
Procedure
-
Log on to the server where the clickhouse-client is installed.
-
Run the connection command to connect to the ApsaraDB for ClickHouse cluster. The syntax is as follows.
clickhouse-client --host=<host> --port=<port> --user=<user> --password=<password>The following table describes the parameters.
Parameter
Description
hostThe public or internal endpoint of the cluster. You can find the endpoint on the Cluster Information page.
NoteIf the server running the clickhouse-client and the ApsaraDB for ClickHouse cluster are in the same VPC, use the internal endpoint. Otherwise, use the public endpoint.
portThe TCP port number, available on the Cluster Information page.
userThe database account.
passwordThe password for the database account.