代码:306。DB::Exception:从 localhost:9000 接收。 DB::Exception:堆栈大小太大。堆栈地址

Posted

技术标签:

【中文标题】代码:306。DB::Exception:从 localhost:9000 接收。 DB::Exception:堆栈大小太大。堆栈地址【英文标题】:Code: 306. DB::Exception: Received from localhost:9000. DB::Exception: Stack size too large. Stack address 【发布时间】:2021-02-02 13:28:32 【问题描述】:

尝试在 k8s 上部署 clickhouse 以用作石墨后端。 Clickhouse 的新手我已经浏览了相同问题的链接,但没有一个对我有帮助。正在尝试创建两个 clickhouse 服务器,计划在未来再添加一个.. clickhouse 服务器部署为 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

我正在使用的示例 init.sql。

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);

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>

指标路径已编入索引。

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.)

【问题讨论】:

config.xml 块保留用于第二个 clickhouse 服务器,仅 init.sql 中的更改将 clickhouse1-0 替换为 clickhouse2-0。 【参考方案1】:

你做了无限循环:

CREATE TABLE IF NOT EXISTS default.graphite (
) ENGINE = Distributed('graphite', '', graphite, xxHash64(Path));

分布式表指向自身。

必须是分布式的('graphite', 'SOMEDATABASE'

或者应该在 remote_servers 中使用默认数据库

<replica>
        <default_database>

!!!!!! 永远不要使用循环复制

!!!!!! 永远不要使用循环复制

!!!!!! 永远不要使用循环复制

!!!!!! 永远不要使用循环复制

必须删除这篇文章。 https://altinity.com/blog/2018/5/10/circular-replication-cluster-topology-in-clickhouse 这份文件对 ClickHouse 造成了极大的伤害。

【讨论】:

以上是关于代码:306。DB::Exception:从 localhost:9000 接收。 DB::Exception:堆栈大小太大。堆栈地址的主要内容,如果未能解决你的问题,请参考以下文章

DB::Exception: 从 localhost:8000 接收。 DB::Exception:列数不匹配

HTTP 状态代码:404 收到错误:代码:47,e.displayText() = DB::Exception:未知标识符:TableauSQL.cnt,e.what() = DB::Excepti

clickhouse_driver.errors.ServerException:代码:62.DB::Exception:语法错误

clickhouse:如何避免 DB::Exception:除以零

clickhouse未解决 ClickHouse exception, code: 1002 DB::Exception: Directory already exists

“DB::Exception: RangeReader read 7523 rows, but 7550 expected”异常在clickhouse中是啥意思?