ClickHouse Installation on Ubuntu/Linux Box
Sunny Kichloo
Database Architect at Nutanix|Ex-Oracle ACE ?|Database Migration Architect
ClickHouse is an open-source column-oriented database management system for online analytical processing (OLAP).
ClickHouse allows generating analytical reports of data using SQL queries that are updated in real-time. The system is marketed for high performance. It is simple and works out of the box. In this article we will go through steps to install clickhouse in either Linux/Unix Machines.
Prerequisites
Step 1 — Installing ClickHouse
In this section, you will install the ClickHouse server and client programs using?apt.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
You will see output similar to the following which confirms that it has successfully verified and added the key.:
Output
Executing: /tmp/apt-key-gpghome.zJVSvL3NNE/gpg.1.sh --keyserver keyserver.ubuntu.com --recv E0C56BD4
gpg: key C8F1E19FE0C56BD4: public key "ClickHouse Repository Key <[email protected]>" imported
gpg: Total number processed: 1
gpg:?????????????? imported: 1
echo "deb <https://repo.yandex.ru/clickhouse/deb/stable/> main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list
Here you’ve piped the output of?echo?to?sudo tee?so that this output can print to a root-owned file.
领英推荐
sudo apt update
sudo apt install clickhouse-server clickhouse-client
During the installation, you will be asked to set a password for the default ClickHouse user.
You’ve installed the ClickHouse server and client successfully. You’re now ready to start the database service and ensure that it’s running correctly.
Step 2 — Starting the Service
The?clickhouse-server?package that you installed in the previous section creates a?systemd?service, which performs actions such as starting, stopping, and restarting the database server.?systemd is an init system for Linux to initialise and manage services. In this section you’ll start the service and verify that it is running successfully.
sudo service clickhouse-server start
sudo service clickhouse-server status
You’ll see similar output mentioned below which confirms that the server is running.
Output
● 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 Tue 2022-06-14 09:44:08 IST; 4h 42min ago
???Main PID: 1605 (clckhouse-watch)
??????Tasks: 213 (limit: 18810)
?????Memory: 2.1G
????????CPU: 9min 32.908s
?????CGroup: /system.slice/clickhouse-server.service
?????????????├─1605 clickhouse-watchdog "" "" "" "" "" "" "" --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
?????????????└─1617 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid