说明:该操作针对文件损坏后,不能正常启动clickhouse,通过暴力方式解决。
背景:服务器重启后,服务器出现故障,文件挂载出现异常现象,经过处理后个别路面依然存在问题。
原始情况:
经过修复后:clickhouse中数据文件依然存在这种问题(文件已损坏,无法修复,无法用rm命令删除),通过cp命令,复制到其他目录下(自动跳过已损坏文件),再用软连接的方式,将store连接到复制过去的目录。
后续步骤1: 在清理掉损坏的文件目录后,依然不能正常启动,修改/etc/clickhouse-server/config.xml文件中max_suspicious_broken_parts的值,将其改为1000,重启clickhouse(一般情况下这个操作就可以启动服务了)。
后续步骤2: /var/log/clickhouse-server/clickhouse-server.err.log 下一直提示错误信息。
{} void DB::MergeTreeBackgroundExecutorDB::MergeMutateRuntimeQueue::routine(DB::TaskRuntimeDataPtr) [Queue = DB::MergeMutateRuntimeQueue]: Code: 40. DB::Exception: Checksum doesn’t match: corrupted data. Reference: 7847238a918d6d6ad678ca139463a660. Actual: 91f2032aaa00a3fd1049238e24a25e20. Size of compressed block: 15993: (while reading column event_time_microseconds): While executing MergeTreeSequentialSource. (CHECKSUM_DOESNT_MATCH), Stack trace (when copying this message, always include the lines below):
DB::MergeTreeBackgroundExecutorDB::MergeMutateRuntimeQueue::routine(DB::TaskRuntimeDataPtr) [Queue = DB::MergeMutateRuntimeQueue]: Code: 432. DB::Exception: Unknown codec family code: 0: (while reading column event_date): While executing MergeTreeSequentialSource. (UNKNOWN_CODEC), Stack trace (when copying this message, always include the lines below):
通过排查路径分析,提示出错的数据属于system库下的log表,如果日志不是很重要,直接删除该表中的数据即可,删除后,日志文件不再继续输出报错信息。