Course Overview
Introduction To ClickHouse

Running and Connecting To ClickHouse

Lesson #5

In this lesson we will:

  • Use the command line interface (CLI) to start the ClickHouse server and then connect to it from a local client.

Starting The Server

The training virtual machine already has the ClickHouse binary installed, but the server has not been started. We can begin therefore by simply running the clickhouse server command to start the process.

cd clickhouse
./clickhouse server

This will output a fairly lengthy set of logs, but a number of informational messages show that the server is starting cleanly:

2021.11.25 12:17:42.942929 [ 25 ] {} <Information> : Starting ClickHouse with revision 54456, build id: 8332E80F7ACF6DE1033E1A6D9F16415C6E03DBF0, PID 25                                                                           2021.11.25 12:17:42.946195 [ 25 ] {} <Information> Application: starting up                                                                                                                                                       2021.11.25 12:17:42.946278 [ 25 ] {} <Information> Application: OS name: Linux, version: 5.10.47-linuxkit, architecture: x86_64
2021.11.25 12:17:45.423613 [ 25 ] {} <Information> Application: Calculated checksum of the binary: 805E158CCA2B20788668232443B9CEE6, integrity check passed.
2021.11.25 12:17:45.555272 [ 25 ] {} <Information> DatabaseCatalog: Found 0 partially dropped tables. Will load them and retry removal.                                                                                                       2021.11.25 12:17:45.561421 [ 25 ] {} <Information> DatabaseAtomic (default): Metadata processed, database default has 0 tables and 0 dictionaries in total.                                                                                   2021.11.25 12:17:45.561494 [ 25 ] {} <Information> TablesLoader: Parsed metadata of 0 tables in 1 databases in 0.000178457 sec
2021.11.25 12:17:45.561503 [ 25 ] {} <Information> TablesLoader: Loading 0 tables with 0 dependency level                                                                                                                                     2021.11.25 12:17:45.561511 [ 25 ] {} <Information> DatabaseAtomic (default): Starting up tables.                                                                                                                                              2021.11.25 12:17:45.561518 [ 25 ] {} <Information> DatabaseAtomic (system): Starting up tables.
2021.11.25 12:17:45.565785 [ 25 ] {} <Information> BackgroundSchedulePool/BgSchPool: Create BackgroundSchedulePool with 128 threads

Starting The Client

In a second shell, we can then start the ClickHouse client command. This is a command line tool which allows us to send commands to the server which we've just started:

./clickhouse client

The connection should be succesful out of the box. This is because the client assumes some defaults for the connection, such as the fact that we would like to connect to localhost, with the username default and a blank password.

If we were connecting to a different secured ClickHouse machine or with a different username or password, we can specify these details at the command line:

clickhouse-client -i -u benjaminwootton --password ABC123

For the purpose of the lesson, the defaults are fine so the client should connect succesfully. We can then issue a command within the ClickHouse client to check connectivity:

show databases



Query id: a3f1db00-87af-47a8-9096-dad14df00589

│ default            │
│ information_schema │
│ system             │

4 rows in set. Elapsed: 0.004 sec.

This shows that the server is running, and we now have connectivity between our client the server.

Join our mailing list for regular insights:

We help enterprise organisations deploy advanced data, analytics and AI enabled systems based on modern cloud-native technology.

© 2024 Ensemble. All Rights Reserved.