clickhouse: Cannot execute replicated DDL query on leader

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>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值