异常关机clickhouse无法启动
[ 169492 ] {} <Error> Application: DB::Exception: Suspiciously many (1416 parts, 0.00 B in total) broken parts to remove while maximum allowed broken parts count is 100. You can change the maximum value with merge tree setting 'max_suspicious_broken_parts' in <merge_tree> configuration section or in table settings in .sql file (don't forget to return setting back to default value): Cannot attach table `xxx` from metadata file /xxx/clickhouse/store/471/4714bfe1-4aae-41c5-90dd-fc116041c0f1/xxx.sql from query ATTACH TABLE xxx UUID '52ee5ee1-3bf6-4a16-b89e-81b78e91de90' (`client` UInt32, ...) ENGINE = MergeTree PRIMARY KEY client ORDER BY client SETTINGS index_granularity = 8192
报错日志也说的很清楚了,因为文件损坏,默认可以修复的是100个,但是现在有1416个,超过了限制。可以在配置文件中增加也可以在损坏的数据库sql中增加。数据库sql的位置也给定了/xxx/clickhouse/store/471/4714bfe1-4aae-41c5-90dd-fc116041c0f1/xxx.sql
在sql最后SETTINGS后面增加一个设置SETTINGS index_granularity = 8192,max_suspicious_broken_parts=2000
把限制设置的大于损坏的part个数即可
同样也可以修改配置文件
在config.xml
中,设置max_suspicious_broken_parts,这个参数没有禁用,如果不想每次都自己手动配置,可以把这个数设置的大一些。官方文档定义的是整数,包括0。0就表示有一块坏的,就会报错,并不表示禁止检测。
<merge_tree>
<max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</merge_tree>
https://clickhouse.com/docs/en/operations/settings/merge-tree-settings