via Clickhouse Client

How to connect to Hydrolix using clickhouse-client

Clickhouse provide a great cli tool to connect to Hydrolix and run SQL query.
clickhouse-client is a CLI interface allowing you to connect to Hydrolix and run query from your terminal.
To install clickhouse-client you can refer to the documentation from Clickhouse here

Once the client is installed you can issue SQL query to your Hydrolix cluster using the following:

clickhouse client --host $host.hydrolix.live --port 9440 -s

--host $host.hydrolix.live to connect your Hydrolix cluster
--port 9440 is the default port for the clickhouse native interface
-s to specify that the connection is over TLS

Example to connect to our public Hydrolix server and run query:

clickhouse client --host try3.hydrolix.live --port 9440 -s

Once connected you have a prompt allowing you to write your SQL statement:

query-peer :) SELECT COUNT() FROM sample.performance_logs

SELECT COUNT()
FROM sample.performance_logs

Query id: d7c8e441-0f3d-420e-a87d-8e6af10715f1

[ip-10-0-10-216] 2022.03.30 08:19:03.264549 [ 11066 ] {fd08db3c-e773-4f0b-8a6f-216b96114b83} <Information> executeQuery: query_id=fd08db3c-e773-4f0b-8a6f-216b96114b83 Read 1 rows, 4.01 KiB in 0.175487409 sec., 5 rows/sec., 22.84 KiB/sec.
[ip-10-0-9-127] 2022.03.30 08:19:03.264564 [ 16366 ] {e857c98f-d5f7-4d8a-8a79-4df5f2b33d66} <Information> executeQuery: query_id=e857c98f-d5f7-4d8a-8a79-4df5f2b33d66 Read 1 rows, 4.01 KiB in 0.175620806 sec., 5 rows/sec., 22.82 KiB/sec.
[ip-10-0-14-216] 2022.03.30 08:19:03.278970 [ 28475 ] {cc5a2a84-a134-4472-8921-18bba5ba6359} <Information> executeQuery: query_id=cc5a2a84-a134-4472-8921-18bba5ba6359 Read 1 rows, 4.01 KiB in 0.18547285 sec., 5 rows/sec., 21.61 KiB/sec.
┌──────count()─┐
│ 415827688196 │
└──────────────┘
[ip-10-0-9-20] 2022.03.30 08:19:03.279734 [ 5645 ] {d7c8e441-0f3d-420e-a87d-8e6af10715f1} <Information> executeQuery: query_id=d7c8e441-0f3d-420e-a87d-8e6af10715f1 Read 3 rows, 12.02 KiB in 0.343507604 sec., 8 rows/sec., 35.00 KiB/sec.

1 rows in set. Elapsed: 0.559 sec.

Did this page help you?