Trying to deploy clickhouse on k8s to use as graphite backend. New to clickhouse I have gone through links with same issue but none is helping me. Trying to create two clickhouse servers planning to add one more in-future.. clickhouse server deployed as k8 statefulset.
clickhouse1-0.clickhouse1-hs.ns-vaggarwal.svc.cluster.local :) select * from graphite
SELECT *
FROM graphite
Query id: 7ba316b8-bc88-4ab2-83d2-269a990f93b7
Received exception from server (version 20.12.4):
Code: 306. DB::Exception: Received from localhost:9000. DB::Exception: Stack size too large. Stack address: 0x7fd2d75fe000, frame address: 0x7fd2d79fd3f0, stack size: 4197392, maximum stack size: 8388608.
0 rows in set. Elapsed: 0.044 sec.
clickhouse1-0.clickhouse1-hs.ns-vaggarwal.svc.cluster.local :) exit
Example init.sql i am using.
CREATE TABLE IF NOT EXISTS default.graphite_index
(
Date Date,
Level UInt32,
Path String,
Version UInt32,
updated DateTime DEFAULT now(),
status Enum8('SIMPLE' = 0, 'BAN' = 1, 'APPROVED' = 2, 'HIDDEN' = 3, 'AUTO_HIDDEN' = 4)
)
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/single/default.graphite_index', '{replica}', updated)
PARTITION BY toYYYYMM(Date)
ORDER BY (Path)
SETTINGS index_granularity = 1024;
CREATE TABLE IF NOT EXISTS default.graphite (
Path String CODEC(ZSTD(2)),
Value Float64 CODEC(Delta, ZSTD(2)),
Time UInt32 CODEC(Delta, ZSTD(2)),
Date Date CODEC(Delta, ZSTD(2)),
Timestamp UInt32 CODEC(Delta, ZSTD(2))
) ENGINE = Distributed('graphite', '', graphite, xxHash64(Path));
CREATE DATABASE IF NOT EXISTS shard_01;
CREATE TABLE IF NOT EXISTS shard_01.graphite
AS default.graphite
ENGINE = ReplicatedGraphiteMergeTree('/clickhouse/tables/01/graphite', 'clickhouse1-0', 'graphite_rollup')
PARTITION BY toYYYYMM(Date)
ORDER BY (Path, Time);
CREATE DATABASE IF NOT EXISTS shard_02;
CREATE TABLE IF NOT EXISTS shard_02.graphite
AS default.graphite
ENGINE = ReplicatedGraphiteMergeTree('/clickhouse/tables/02/graphite', 'clickhouse1-0', 'graphite_rollup')
PARTITION BY toYYYYMM(Date)
ORDER BY (Path, Time);
Relevant part from config.xml
<remote_servers>
<graphite>
<!-- Shard 01 -->
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>clickhouse1-0</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse2-0</host>
<port>9000</port>
</replica>
</shard>
<!-- Shard 02 -->
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>clickhouse1-0</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse2-0</host>
<port>9000</port>
</replica>
</shard>
</graphite>
</remote_servers>
metric paths have been indexed.
clickhouse1-0.clickhouse1-hs.ns-vaggarwal.svc.cluster.local :) show tables
SHOW TABLES
Query id: 8cc91a1f-0be1-4ae8-98ed-411b06624968
┌─name───────────┐
│ graphite │
│ graphite_index │
└────────────────┘
2 rows in set. Elapsed: 0.002 sec.
clickhouse1-0.clickhouse1-hs.ns-vaggarwal.svc.cluster.local :) select * from graphite_index LIMIT 5;
SELECT *
FROM graphite_index
LIMIT 5
Query id: ced975d1-cd06-49b7-a18f-96e0e62504fd
┌───────Date─┬─Level─┬─Path────────────────────────────────────────────────────────────┬────Version─┬─────────────updated─┬─status─┐
│ 1970-02-12 │ 30005 │ active.pickle.carbon-clickhouse1-6489b8f7c8-mbzpr.agents.carbon │ 1612267498 │ 2021-02-02 12:04:58 │ SIMPLE │
│ 1970-02-12 │ 30005 │ active.pickle.carbon-clickhouse1-6489b8f7c8-ts6kk.agents.carbon │ 1612267558 │ 2021-02-02 12:05:58 │ SIMPLE │
│ 1970-02-12 │ 30005 │ active.pickle.carbon-clickhouse2-7898cd697d-jndms.agents.carbon │ 1612271795 │ 2021-02-02 13:16:35 │ SIMPLE │
│ 1970-02-12 │ 30005 │ active.pickle.carbon-clickhouse2-7898cd697d-pbns7.agents.carbon │ 1612271786 │ 2021-02-02 13:16:26 │ SIMPLE │
│ 1970-02-12 │ 30005 │ active.tcp.carbon-clickhouse1-6489b8f7c8-mbzpr.agents.carbon │ 1612267498 │ 2021-02-02 12:04:58 │ SIMPLE │
└────────────┴───────┴─────────────────────────────────────────────────────────────────┴────────────┴─────────────────────┴────────┘
5 rows in set. Elapsed: 0.002 sec. Processed 1.12 thousand rows, 110.75 KB (613.49 thousand rows/s., 60.45 MB/s.)