How to Install and Configure ClickHouse on Ubuntu 16.04 | 18.04

ClickHouse is a fast, open-source, column-oriented analytics database system with a high availability feature that works across clusters, thus eliminating a single failure point… It is developed by Yandex and is useful when working with big data warehouses….

If you need a fast, column-oriented database system with native SQL queries, powerful reporting and high availability, you may want to look at ClickHouse…

Column-oriented databases store records in blocks grouped by columns instead of rows… When working with large data that requires lots of processing power, this may be what you want… The system provides multi-master synchronous replication, automatic failover and self-organizing cluster… with no single points of failure…

This brief tutorial shows students and new users how to install ClickHouse on Ubuntu 16.04 | 18.04 LTS servers…

For more about ClickHouse, please visit its homepage.

If you want to test it in your lab environment before going out and using it in production, the steps below should be a great place to start..Follow the steps below to get ClickHouse installed on Ubuntu

Step 1: Install Required Packages

To get the latest version of ClickHouse, you can either clone the project file from Github or add its official repository to Ubuntu… This post shows you how to install it from its office repository…

Before installing, some required packages may be needed for the installation to work…

First, run the commands below to install apt-transport-https

sudo apt update
sudo apt install apt-transport-https

After installing the package above, continue below to installing ClickHouse.

Step 2: Installing ClickHouse

Now that some required packages are installed, follow the steps below to get ClickHouse installed and configured… If you’re not cloning the project file from Github, then add its official package repository by running the commands below..

The first line imports the repository’s GPG key… the second adds ClickHouse’s repository into a new file called clickhouse.list

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list

After the steps above, run the commands below to install it.

sudo apt update
sudo apt-get install clickhouse-server clickhouse-client

After installing the commands below can be used to stop, start and enable ClickHouse service…

sudo systemctl stop clickhouse-server
sudo systemctl start clickhouse-server
sudo systemctl enable clickhouse-server

To verify that ClickHouse is installed and running, run the commands below check its status..

sudo systemctl status clickhouse-server

You should see similar lines as shown below:

● clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)
   Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-03-27 10:15:34 CDT; 20s ago
 Main PID: 16734 (clickhouse-serv)
    Tasks: 35 (limit: 4683)
   CGroup: /system.slice/clickhouse-server.service
           └─16734 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml

Mar 27 10:15:34 ubuntu1804 systemd[1]: Started ClickHouse Server (analytic DBMS for big data).
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Include not found: clickhouse_remote_servers
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Include not found: clickhouse_compression
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Include not found: networks
Mar 27 10:15:34 ubuntu1804 clickhouse-server[16734]: Include not found: networks
Mar 27 10:15:36 ubuntu1804 clickhouse-server[16734]: Include not found: clickhouse_remote_servers
Mar 27 10:15:36 ubuntu1804 clickhouse-server[16734]: Include not found: clickhouse_compression

After installing the server, run the commands below to access ClickHouse command SQL console…

clickhouse-client

By default the client connects to localhost:9000 without a password… If you’re connecting from a remote host or location, you will want to add the –host argument to the command.

You should see the SQL console prompt…

ClickHouse client version 19.4.1.3.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 19.4.1 revision 54416.

ubuntu1804 :)

From the SQL console prompt, you can create, update, add, delete and perform other database functions, including table views, indexes and more..

To create a new database, run the commands below:

CREATE DATABASE test;

You should see an output as below:

CREATE DATABASE test

Ok.

0 rows in set. Elapsed: 0.009 sec.

You can use many standard SQL command statements here, like DROP, DELETE JOIN and more… For example, to switch to the test database above, type the commands below:

USE test;

That should do it!

Enjoy!

Congratulations! You have successfully installed ClickHouse on Ubuntu 16.04 and 18.04

You may also like the post below:

Manually Install Oracle Java JDK 12 on Ubuntu 18.04 / 16.04

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.