Config Manager

Listen all interface

Modify config file:/etc/clickhouse-server/config.xml

[[email protected]]# cat /etc/clickhouse-server/config.xml
...
<listen_host>0.0.0.0</listen_host>
...

Change Storage Location

Modify config file:/etc/clickhouse-server/config.xml

[[email protected]]#

User Manager

Create Admin User

Uncomment the access_management

[[email protected]]# cat /etc/clickhouse-server/users.xml
..
<!-- User can create other users and grant rights to them. -->
<!-- <access_management>1</access_management> -->
..

Add normal user

[[email protected]]# CREATE USER zhangsan IDENTIFIED WITH plaintext_password BY 'password' DEFAULT ROLE ALL;
[[email protected]]#

Login with password

[[email protected]]# clickhouse-client -h 127.0.0.1 --user zhangsan --ask-password

Grant permissions

[[email protected]]# GRANT * ON prometheus TO zhangsan;

Database manager

Create database

[[email protected]]# CREATE DATABASE IF NOT EXISTS prometheus;

Show database

[[email protected]]# show DATABASES;

Change database

[[email protected]]# use prometheus;

Table manager

Create Table

[[email protected]]# CREATE TABLE time_series (\
    date Date,\
    fingerprint UInt64,\
    labels String\
)\
ENGINE = ReplacingMergeTree\
    PARTITION BY date\
    ORDER BY fingerprint;

CREATE TABLE samples (\
    fingerprint UInt64,\
    timestamp_ms Int64,\
    value Float64\
)\
ENGINE = MergeTree\
    PARTITION BY toDate(timestamp_ms / 1000)\
    ORDER BY (fingerprint, timestamp_ms);

View table

[[email protected]]# show TABLES;

Ref