clickhouse错误汇总

PersistenceException org.apache.ibatis.exceptions.ExceptionFactory in wrapException

 

Error querying database.  Cause: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: xxxx, port: 8123; xxxx:8123 failed to respond

升级驱动

<!--ClickHouse驱动-->
<dependency>
    <groupId>ru.yandex.clickhouse</groupId>
    <artifactId>clickhouse-jdbc</artifactId>
    <version>0.2.6</version>
</dependency>

DB::Exception: Nested type Array(String) cannot be inside Nullable type (version 24.3.2.23 (official build))

字段类型是Nullable(String),在使用一些字符串函数时对Nullable类型是不支持的,需要转成String

DB::Exception: Cannot convert NULL value to non-Nullable type: while converting source column second_channel to destination column second_channel (version 24.3.2.23 (official build))

字段类型是非空类型,将非空类型改成Nullable(String)

DB::Exception: Memory limit (total) exceeded: 

单次查询出来的数据量过大大于机器剩余内存

DB::Exception: Table columns structure in ZooKeeper is different from local table structure (version 24.3.2.23(official build))

Replicated(副本)表删表重建,但zk中表结构删除操作是异步的,默认为五分钟,或重启该节点的ck,或者选择等待几分钟内

Too many parts (300). Merges are processing significantly  slower than inserts..

使用 Flink 实时消费 Kafka 的数据,Sink 到 ClickHouse ,策略是一条一条插入,任务上线一段时间之后,ClickHouse 扛不住数据插入的压力了(是因为MergeTree的merge的速度跟不上 data part 生成的速度)。

解决:优化 FLink ClickHouse Sink逻辑, 根据时间和数据量做触发,满足其一才会执行插入操作。

Caused by: org.apache.spark.memory.SparkOutOfMemoryError: error while calling spill() on org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter@5915c8a5

 

磁盘空间不足

spark sql unsupported type array

因为数据源的数组类型和spark sql的数组类型不一致,可以将数组转为string
select toString(field) from tablet

Code: 48. DB::Exception: Received from xxxx:9000, ::1. DB::Exception: Mutations are not supported by storage Distributed.

分布式表不能进行更新,ALTER TABLE UPDATE/DELETE不支持分布式DDL
需要在分布式环境中手动在每个节点上local的进行更新/删除数据。

execute clickhouse Query Error ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: xxxx, port: 8123; xxxx:8123 failed to respond

JDBC client端和server端对 http connection , header `keep-alive` 不一致。升级clickhouse-jdbc 驱动jar或者pom引入依赖版本到0.2.6 。

Code: 159,read timeout

执行某些SQL很耗时导致最后报错读超时,这是因为clickhouse执行单次SQL的默认最大等待时间是30s,如果有比较耗时的SQL, 可以通过将JdbcURL的socket_timeout参数值设置的大一点来解决这个问题(注意这个参数的时间单位是毫秒,默认是30000)

Code 62,Max query size exceeded

Select语句中使用in方式查询报错。
因为查询语句特别的大造成的,而默认的max_query_size最大是256 KB(字节展示)。打开/etc/clickhouse-server/users.xml(只配置了一些常用的用户)。max_query_size这种配置,就需要在profiles部分中配置修改。
修改配置文件或者查询的时候避免大量查询条件

Code: 168,AST is too big,Maximum: 50000

AST太大了。在users.xml配置文件中添加相应配置,或者通过sql修改,具体步骤参照修改权限文档即可。
<max_ast_elements>10000000</max_ast_elements>
<max_expanded_ast_elements>10000000</max_expanded_ast_elements>

Code: 221,db::exception: no interserver io endpoint named…

复制副本数据时报错导致无法同步数据,直接在err.log日志文件看到的报错是:auto
DB::StorageReplicatedMergeTree::processQueueEntry(ReplicatedMergeTreeQueue::SelectedEntryPtr)::(anonymous class)::operator()(DB::StorageReplicatedMergeTree::LogEntryPtr &) const: Poco::Exception. Code: 1000, e.code() = 111, Connection refused
没有指定interserver_http_host参数,clickhouse配置文件中关于对这个参数的描述我翻译过来大概意思就是这个参数是其他副本用于请求此服务器的主机名;如果未指定,则与“hostname-f”命令类似确定,此设置可用于将复制切换到另一个网络接口(服务器可以通过多个地址连接到多个网络)。不指定该参数的话,服务器就会试图连接到自己,而对应的端口号未提供服务时就会报Connection refused这样的错误了。

Code: 253, Replica /clickhouse/tables/XXX/XXX/replicas/dba07 already exists

原因:建立副本表(ReplicatedMergeTree)的时候,如果数据库的引擎是Atomic,则在删除表之后马上重建会报这个错。删除的时候clickhouse是通过异步线程清除掉zookeeper上的数据的,立马新建的话可能异步线程还没开始执行,如果不想做其他操作的话,等一会再执行创建语句就不会报这个错了,也可以通过指定如下参数设置清除zookeeper上数据操作的延迟时间:
<!-- 修改参数 database_atomic_delay_before_drop_table_sec = 0 ,解决删除副本表立马重建会报错的问题 -->
<database_atomic_delay_before_drop_table_sec>0</database_atomic_delay_before_drop_table_sec>

Code: 252, e.displayText() = DB::Exception: Too many partitions ,for single INSERT block (more than 100).

原因:单次插入的数据分区太多了,超过默认配置的 100 个了。
解决:
1.合理设置分区字段 。
2.修改这个 max_partitions_per_insert_block 参数,调大这个值。
3.避免同一批次写入包含太多分区的数据。

Code: 359,e.displayText()=DB::Exception: Table or Partition in xxx was not dropped.

原因:
1) 可以看到,删除的数据实际大小已经超过了配置的大小。
2) 说明是可以跳过配置检查,进行强制删除的,但是没找到这个文件 /data/clickhouse/clickhouse-server/flags/force_drop_table,所以不能跳过检查,也就是不能强制删除。
sudo touch '/data/clickhouse/clickhouse-server/flags/force_drop_table'
&& sudo chmod 666 '/data/clickhouse/clickhouse-server/flags/force_drop_table'
然后再次执行 删除操作就可以了。需要注意的是,这个标识文件有效期只有一次,执行删除完毕之后,这个文件就会消失

Code: 117, e.displayText() = DB::Exception: Unexpected NULL value of not Nullable type String

转换类型

ERROR ApplicationMaster: User class threw exception: ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 62, host: 127.0.0.1, port: 8123; Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 1432 (end of query): . Expected one of: ENGINE, storage definition

表不存在

Code: 241. DB::Exception: Received from localhost:9000. DB::Exception: Memory limit (for query) exceeded: would use 9.31 GiB (attempt to allocate chunk of 4223048 bytes), maximum: 9.31 GiB: While executing MergeTreeThread: While executing CreatingSetsTransform

内存使用超出限制,默认的最大限制是10G。
sql设置单次查询内存或者设置用户配额(sql设置或者users.xml设置调整max_memory_usage = 20000000000000)

ClickHouse exception, code: 202, host: xxxxx, port: 8123; Code: 202, e.displayText() = DB::Exception: Too many simultaneous queries. Maximum: 100

最大并发为100。
修改config.xml文件:<max_concurrent_queries>100</max_concurrent_queries>。

ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 252, host: xxxx, port: 8123; Code: 252, e.displayText() = DB::Exception: Too many parts (308). Merges are processing significantly slower than inserts.

插入的速度太快了,clickhouse合并的速度太慢。调小并行度,减少批次处理的条数。

Code: 159. DB::Exception: Received from localhost:9000. DB::Exception: Watching task /clickhouse/task_queue/ddl/query-0000000002 is executing longer than distributed_ddl_task_timeout (=180) seconds. There are 3 unfinished hosts (0 of them are currently active), they are going to execute the query in background

端口错了检查metrika.xml文件中ck端口

 


原文链接:https://blog.csdn.net/qq_42093488/article/details/124149804

 

posted @   白玉神驹  阅读(390)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
历史上的今天:
2023-06-25 Linux查找某个文件在哪里
2023-06-25 docker安装showdoc
2019-06-25 如何快速的将已知的1000万条数据插入到数据库中
2019-06-25 Mapper映射文件没有提示的解决方案
2019-06-25 MyBatis简单使用
点击右上角即可分享
微信分享提示