Данные действия необходимо производить на двух нодах
vim /etc/clickhouse-server/config.xml
/etc/clickhouse-server/cluster.xml
vim /etc/clickhouse-server/cluster.xml
// Название кластера
167.99.142.32 // первая нода в нашем кластере
9000
159.65.123.161 // вторая нода в нашем кластере
9000
vim /etc/clickhouse-server/config.xml
0.0.0.0
sudo chown clickhouse:clickhouse /etc/clickhouse-server/cluster.xml
service clickhouse-server status
CREATE TABLE ch_local
(
id Int64,
title String,
description String,
content String,
date Date
)
ENGINE = MergeTree()
PARTITION BY date
ORDER BY id;
CREATE TABLE ch_distributed
(
id Int64,
title String,
description String,
content String,
date Date
)
ENGINE = Distributed('local', 'default', 'ch_local', rand());
# clickhouse-client --query "INSERT INTO ch_distributed FORMAT CSV" < ch_distributed.csv
clickhouse-client
INSERT INTO ch_distributed (id, title, description, content, date) VALUES(1, 'title', 'desc', 'content', '2018-07-03')
SELECT count(*)
FROM ch_distributed
Query id: 1611236f-d12b-4b24-9ac9-44f854232d3a7
┌─count()─┐
│ 10 │
└─────────┘
1 rows in set. Elapsed: 0.013 sec.