Connect to a ClickHouse® cluster
You can connect to a ClickHouse® cluster:
- via console clients, for example clickhouse-client;
- program code.
SSL connection is used for all methods.
When connecting, specify the port and address.
Connection ports
Use the following ports to connect to ClickHouse®:
- 9440 — port for connecting via native interface (TCP);
- 8443 — port for connecting via HTTP interface.
Connection addresses
You can select an address for connection depending on one of the scenarios:
You can view the connection address in the Dashboard.

Connecting to a cluster from a private subnet
If you are connecting to a cluster from a private subnet, use the private IP address.
To connect from another private subnet, first connect both private subnets to a cloud router.
Connecting to a cluster from the Internet
If you connect to the cluster from the internet, use a public IP address.
View connection address
- In the control panel, in the top menu, click Products and select Cloud Databases.
- Open the tab Active.
- Open the database cluster page → tab Connection.
- In the Connection addresses block, open the tab of the node group whose addresses you want to view.
Connect to the cluster
clickhouse-client
Python
Go
Node.js
Java
-
Create a configuration file
config.xml:if [ "$USER" = "root" ]; thenCONFIG_DIR="/root/.clickhouse-client"elseCONFIG_DIR="/home/${USER}/.clickhouse-client"fimkdir -p ${CONFIG_DIR}cat > ${CONFIG_DIR}/config.xml << EOF<config><openSSL><client><caConfig>${CONFIG_DIR}/root.crt</caConfig><verificationMode>strict</verificationMode><invalidCertificateHandler><name>RejectCertificateHandler</name></invalidCertificateHandler></client></openSSL></config>EOF -
Download the root certificate and place it in the folder
~/.clickhouse-client/:wget https://storage.dbaas.selcloud.ru/CA.pem -O ~/.clickhouse-client/root.crtchmod 0600 ~/.clickhouse-client/root.crt -
Connect to the node:
clickhouse-client --host <host> \--secure \--user admin \--database <database_name> \--port <port> \--password <password>Specify:
<host>— node IP address;<database_name>— database name. When connecting to the cluster for the first time, specify the default database —default. After connecting for the first time, you can create new databases;<port>— connection port;<password>— administrator user password. The password is set when creating a cluster. After creation, the password cannot be viewed in the control panel, but can be changed.
ClickHouse® is a registered trademark of ClickHouse, Inc. https://clickhouse.com.