Bobcares

How to install ClickHouse on Ubuntu 20.04?

by | Oct 7, 2020

Install of ClickHouse on Ubuntu involves a series of steps that includes adjusting the configuration file to enable listening over other IP address and remote access.

As a part of our Server Management Services, we help our Customers with Software installations regularly.

Let us today discuss the steps to install ClickHouse on Ubuntu.

How to install ClickHouse on Ubuntu?

ClickHouse is an open-source analytics database developed for big data use cases. Typically, the installation process involves the steps below:

  • Installing ClickHouse
  • Starting the Service
  • Change the listening IP address
  • Enable Tabix
  • Setting Up Firewall Rules

Let us discuss each of them in detail.

Installing ClickHouse

In this section, we will install the ClickHouse server and client programs using apt.

In the first step, we need to add the repository of ClickHouse. To add the repository’s GPG key and then to add the repository to the APT repositories, use the command below:

$ 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

Now, we shall update the packages:

$ sudo apt update

Next, we shall proceed to install the clickhouse-server and clickhouse-client packages:

$ sudo apt install clickhouse-server clickhouse-client

Here, it will ask to set a password for the default ClickHouse user. We will require this password to access ClickHouse server later.

Starting the Service

After the ClickHouse server and client installation, let us proceed to start the database service.

We can start the clickhouse-server service and verify its status with the commands below:

$ sudo service clickhouse-server start
$ sudo service clickhouse-server status

The output of the status command confirms that the server is running. Further, we can also enable ClickHouse to run on boot with the command below:

$ sudo systemctl enable clickhouse-server

Now that we have enabled ClickHouse, we can access ClickHouse with the password that we set during installation.

$ clickhouse-client --password

This will take us to the prompt where we can execute SQL statements create, update and delete databases, tables, etc. We can also execute queries to retrieve filtered data from this client prompt.

For instance, to create a test database use the command below:

ch:) CREATE DATABASE test;

Change the listening IP address

By default ClickHouse only listens on localhost. Thus we can access it only from the same server. However, we can change the listening IP address, by editing the /etc/clickhouse-server/config.xml file.

Open this file with any available text editor, find the string listen_host, and uncomment the line.

To make the ClickHouse server listen only on a specific IP address, we can edit the line as follows:

<listen_host>xxx.xxx.xxx.xxx</listen_host>

Replace xxx.xxx.xxx.xxx with the actual IP address.

Enable Tabix

To access the ClickHouse server through a web browser, we need to enable Tabix by editing the config.xml file as mentioned before. Open the config.xml file as we did earlier,  find the string http_server_default_response and uncomment the line.

After making changes to the config.xml file, we need to restart our clickhouse-server service.

# sudo systemctl restart clickhouse-server

Now, we can access ClickHouse over a browser with the link  http://Your_IP_Address:8123 and log in using the default user and password that we specified earlier in the installation process.

install clickhouse on ubuntu

 

Setting Up Firewall Rules

This step should be followed if we intend to connect to the ClickHouse database server remotely. Remote connection requires ClickHouse to listen to an IP address other than localhost. Thus changing the listening IP address that we discussed earlier is the primary step to enable remote access.

ClickHouse’s server listens on port 8123 for HTTP connections and port 9000 for connections from clickhouse-client.

Allow access to both ports for the remote server IP address with the following command:

$ sudo ufw allow from remote_server_ip/32 to any port 8123
$ sudo ufw allow from remote_server_ip/32 to any port 9000

We can add additional IPs such as our local machine’s address in the same manner if required.

Now to verify the remote connection, install the clickhouse-client on the remote server with the steps that we followed initially.  Then, start a client session by executing:

$ clickhouse-client --host your_server_ip --password

We will see an output that we have connected to the server.

 [Need any further assistance to install ClickHouse on Ubuntu?– We’re available 24*7]

Conclusion

In short, ClickHouse is an open-source analytics database developed for big data use cases. Install of ClickHouse on Ubuntu involves a series of steps that includes adjusting the configuration file to enable listening over other IP address and remote access. Today, we saw how our Support Engineers install ClickHouse on Ubuntu.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF