DEV Community

Alif Ruliarso
Alif Ruliarso

Posted on

Clickhouse - Getting started with Docker

Clickhouse is a popular open-source column-oriented database management system that is designed for fast analytical queries and real-time data processing. It is particularly well-suited for handling large volumes of data and has been used by companies like Yandex, Alibaba, and Uber for their data warehousing and analytics needs.

This is a simple guide to playing with Clickhouse.

Run clickhouse server

docker run -d \
        -v $(realpath ./ch_data):/var/lib/clickhouse/ \
        -v $(realpath ./ch_logs):/var/log/clickhouse-server/ \
        --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server
Enter fullscreen mode Exit fullscreen mode

The server should be started after downloading Clickhouse image.

Start clickhouse client

docker run -it --rm --link some-clickhouse-server:clickhouse-server --entrypoint clickhouse-client clickhouse/clickhouse-server --host clickhouse-server
Enter fullscreen mode Exit fullscreen mode

This will open a Clickhouse client session, and you can start issuing commands to the Clickhouse server. Let's test the following query:

SHOW DATABASES
Enter fullscreen mode Exit fullscreen mode
SELECT version()
Enter fullscreen mode Exit fullscreen mode

Stop clickhouse server

docker stop some-clickhouse-server
Enter fullscreen mode Exit fullscreen mode

Start existing clickhouse server

docker start some-clickhouse-server
Enter fullscreen mode Exit fullscreen mode

Top comments (0)