开发者社区 > 博文 > clickhouse: 报错解决方案
分享
  • 打开微信扫码分享

  • 点击前往QQ分享

  • 点击前往微博分享

  • 点击复制链接

clickhouse: 报错解决方案

  • 京东城市JUST团队
  • 2021-01-22
  • IP归属:未知
  • 1073浏览

Cannot execute replicated DDL query on leader

在执行分布式删除时报错:

10.10.10.16 :) truncate table t_test_local on cluster shard2_replica2_copy

TRUNCATE TABLE t_test_local ON CLUSTER shard2_replica2_copy

┌─host──────────┬─port─┬─status─┬─error─────────────────────────────────────────┬─num_hosts_remaining─┬─num_hosts_active─┐
│ 10.10.10.15 │ 9000 │     48 │ Cannot execute replicated DDL query on leader │                   3 │                2 │
│ 10.10.10.12 │ 9000 │     48 │ Cannot execute replicated DDL query on leader │                   2 │                2 │
└───────────────┴──────┴────────┴───────────────────────────────────────────────┴─────────────────────┴──────────────────┘
↑ Progress: 2.00 rows, 204.00 B (0.19 rows/s., 19.32 B/s.) ███████████████████████████████████████████████████████████████████████████████████████████████████████    
┌─host──────────┬─port─┬─status─┬─error─────────────────────────────────────────┬─num_hosts_remaining─┬─num_hosts_active─┐
│ 10.10.10.16 │ 9000 │     48 │ Cannot execute replicated DDL query on leader │                   1 │                1 │
└───────────────┴──────┴────────┴───────────────────────────────────────────────┴─────────────────────┴──────────────────┘
↗ Progress: 2.00 rows, 204.00 B (0.18 rows/s., 18.61 B/s.) ███████████████████████████████████████████████████████████████████████████████████████████████████████    → Progress: 3.00 rows, 306.00 B (0.27 rows/s., 27.66 B/s.) █████████████████████████████████████████████████████████████████████████████████████████████████████████
┌─host──────────┬─port─┬─status─┬─error─────────────────────────────────────────┬─num_hosts_remaining─┬─num_hosts_active─┐
│ 10.10.10.13 │ 9000 │     48 │ Cannot execute replicated DDL query on leader │                   0 │                0 │
└───────────────┴──────┴────────┴───────────────────────────────────────────────┴─────────────────────┴──────────────────┘
↘ Progress: 3.00 rows, 306.00 B (0.27 rows/s., 27.53 B/s.) ██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌                                                    74%Received exception from server (version 20.4.4):
Code: 48. DB::Exception: Received from 127.0.0.1:9000. DB::Exception: There was an error on [10.10.10.15:9000]: Cannot execute replicated DDL query on leader. 

不知道集群为啥删不掉,试试单机版删除:

10.10.10.16 :) truncate table t_test_local

TRUNCATE TABLE t_test_local

Received exception from server (version 20.4.4):
Code: 359. DB::Exception: Received from 127.0.0.1:9000. DB::Exception: Table or Partition in default.t_test_local was not dropped.
Reason:
1. Size (80.35 GB) is greater than max_[table/partition]_size_to_drop (50.00 GB)
2. File '/export/server/ch/data/flags/force_drop_table' intended to force DROP doesn't exist
How to fix this:
1. Either increase (or set to zero) max_[table/partition]_size_to_drop in server config and restart ClickHouse
2. Either create forcing file /export/server/ch/data/flags/force_drop_table and make sure that ClickHouse has write permission for it.
Example:
sudo touch '/export/server/ch/data/flags/force_drop_table' && sudo chmod 666 '/export/server/ch/data/flags/force_drop_table'.

然后发现原因很清楚:表太大了,大于参数 max_table_size_to_drop 控制的值。

根据文档:
https://clickhouse.tech/docs/en/operations/server-configuration-parameters/settings/#max-table-size-to-drop

默认是50G, 而我的数据有80G。

所以修改配置文件:vim /etc/clickhouse-server/config.xml, 假如以下配置,禁止这项判断:

<yandex>
	<max_table_size_to_drop>0</max_table_size_to_drop>
	...
</yandex>
共0条评论