美文网首页
clickhouse ddl on cluster hangin

clickhouse ddl on cluster hangin

作者: NazgulSun | 来源:发表于2020-09-05 12:21 被阅读0次

问题描述

clickhouse 支持创建分布式ddl
比如执行create database test on cluster testCluster
这样会在所有的节点上创建 这个数据库,大大降低运维的成本。

原理

执行的client 节点,会读取集权配置信息,然后发送 任务到 各个节点
可以
select * from system.zookeeper 看到各个节点的任务
考虑到ha,所有的配置在 zookeeper中存在。

问题

在单机节点执行时候,整个ddl 都是超时

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

root cause

单个节点的DDL work线程,拿到task列表的时候
会决定 自己是否包含在task里面,如果在,则在本机执行。
判断的依据。是通过一个 isLocalHost 函数。

比如,task列表里面,有ubuntu1-9
而自己,是 ubuntu2
那么按道理自己是在里面的。

判断的方法,貌似是与网卡地址做匹配【不确定】
我在/etc/hosts 里面配置的是
127.0.0.1, ubuntu2 ,这种方式就是匹配不上
需要修改成
192.168.1.2 , bunutu2

这个问题困扰好久,终于解决了。

相关文章

网友评论

      本文标题:clickhouse ddl on cluster hangin

      本文链接:https://www.haomeiwen.com/subject/sraxektx.html