参考链接
报错日志如下:
2023.05.23 09:58:23.850165 [ 679728 ] {} <Error> Application: Caught exception while loading metadata: Code: 231. DB::Exception: The local set of parts of table `.inner_id.add4e584-377e-47f3-add4-e584377e87f3` (5f31b2f4-3d60-40fb-9f31-b2f43d6040fb) doesn't look like the set of parts in ZooKeeper: 745.44 thousand rows of 764.53 thousand total rows in filesystem are suspicious. There are 110 unexpected parts with 745437 rows (45 of them is not just-written with 745312 rows), 0 missing parts (with 0 blocks).: Cannot attach table `.inner_id.add4e584-377e-47f3-add4-e584377e87f3` from metadata file……
核心问题是有些表同步不过来。
问题描述
之前这个节点异常停了,然后重启的时候,报上面的这个错。
恢复方案1
按照某些文档,修改参数config.xml
<merge_tree>
<parts_to_delay_insert>1500</parts_to_delay_insert>
<parts_to_throw_insert>3000</parts_to_throw_insert>
<max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</merge_tree>
理论上这个表待同步的数据只要不超过3000,就可以正常恢复,但是重启后还是报错。
经过在主节点上分析,因为partition策略太烂,导致待同步数据已经超过3000个partition。所以采用了url中的第二个做法
恢复方案2
在从节点上,连接zk
create /clickhouse/tables/01-1/log_local/replicas/177/flags/force_restore_data
其中01-1和177是要按照自己实际情况修改,log_local为表名称。
然后重启clickhouse解决问题。
特此记录。