Clickhouse中执行ddl语句报错: executing longer than distributed_ddl_task_timeout (=180) seconds. There are 1 unfinished hosts (0 of them are currently active), they are going to execute the query in background. (TIMEOUT_EXCEEDED)
我在服务器上通过Docker 搭建了一个Clickhouse、Zookeeper服务,然后本地连接创建表时报超时问题,但我感觉大概率应该和网络不相关,因为由于端口等原因,我把docker compomse中clickhouse 9000 expose 端口改成了 8999, 我感觉是哪里配置改的有问题。但没有找到。
详细clickhouse 报错信息:
DB::Exception: Watching task /clickhouse/task_queue/ddl/query-0000000006 is executing longer than distributed_ddl_task_timeout (=180) seconds. There are 1 unfinished hosts (0 of them are currently active), they are going to execute the query in background. (TIMEOUT_EXCEEDED)
- DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000c6cf19b in /usr/bin/clickhouse
- DB::Exception::Exception<String&, long&, unsigned long&, unsigned long&>(int, FormatStringHelperImpl<std::type_identity<String&>::type, std::type_identity<long&>::type, std::type_identity<unsigned long&>::type, std::type_identity<unsigned long&>
::type>, String&, long&, unsigned long&, unsigned long&) @ 0x0000000011717209 in /usr/bin/clickhouse - DB::DDLQueryStatusSource::generate() @ 0x0000000011715cd5 in /usr/bin/clickhouse
- DB::ISource::tryGenerate() @ 0x00000000126d3335 in /usr/bin/clickhouse
- DB::ISource::work() @ 0x00000000126d2d83 in /usr/bin/clickhouse
- DB::ExecutionThreadContext::executeTask() @ 0x00000000126ebd3a in /usr/bin/clickhouse
- DB::PipelineExecutor::executeStepImpl(unsigned long, std::atomic<bool>*) @ 0x00000000126e2750 in /usr/bin/clickhouse
- DB::PipelineExecutor::execute(unsigned long, bool) @ 0x00000000126e1960 in /usr/bin/clickhouse
- void std::__function::__policy_invoker<void ()>::__call_impl<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncP
ipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x00000000126ef6bd in /usr/bin/clickhouse void* std::__thread_proxy[abi:v15000]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long
, bool)::'lambda0'()>>(void*) @ 0x000000000c7b94f8 in /usr/bin/clickhouse
- ? @ 0x00007f95089b5609 in ?
- ? @ 0x00007f95088da353 in ?
zookeeper /clickhouse/task_queue/ddl/query-0000000006 节点信息:
version: 5
query: CREATE TABLE default.events_local UUID \'23da2be5-24cd-4ff0-a185-b0c361864946\' ON CLUSTER posthog (event_date
Date, event_type
Int32, article_id
Int32, title
String) ENGINE = ReplicatedMergeTree(\'/clickhouse/repl-3s3r/posthog/tables/0/default/events_local\', \'chi-repl-3s3r-posthog-0-1\') PARTITION BY toYYYYMM(event_date) ORDER BY (event_type, article_id)
hosts: ['xxxx:8999']
initiator: fe1f4b48cb63:8999
settings: load_balancing = 'random', distributed_ddl_task_timeout = 5, stream_poll_timeout_ms = 50, max_memory_usage = 10000000000, allow_nondeterministic_mutations = true
tracing: 00000000-0000-0000-0000-000000000000
能看到 hosts 和 initiator 这里端口映射的都是对的, hosts里ip是 服务器主机的ip地址。
initiator 里是clickhouse container 的id
docker compose 配置:
clickhouse:
extends:
file: docker-compose.base.yml
service: clickhouse
ports:
- '8123:8123'
- '8999:8999' # 这里做了端口修改
- '9440:9440'
- '9009:9009'
volumes:
- ./posthog/idl:/idl
- ./docker/clickhouse/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./docker/clickhouse/config.xml:/etc/clickhouse-server/config.xml
- ./docker/clickhouse/users-dev.xml:/etc/clickhouse-server/users.xml
extra_hosts:
- 'host.docker.internal:host-gateway'
depends_on:
- kafka
- zookeeper
正常的select 都是可以的, 唯独建表会超时。