linux-clickhouse启动报错- Unit clickhouse-server.service entered failed state

systemctl start clickhouse-server
systemctl status clickhouse-server
clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: disabled)Active: activating (auto-restart) (Result: exit-code) since 二 2023-08-21 11:46:41 CST; 10s agoProcess: 9688 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid (code=exited, status=70)Main PID: 9688 (code=exited, status=70)8月 21 11:46:41 localhost.localdomain systemd[1]: clickhouse-server.service: main process exited, code=exited, status=70/n/a
8月 21 11:46:41 localhost.localdomain systemd[1]: Unit clickhouse-server.service entered failed state.
8月 21 11:46:41 localhost.localdomain systemd[1]: clickhouse-server.service failed.

1.查询.log为什么启动失败

  journalctl -xe
Jun 30 10:03:21 hantest.com polkitd[751]: Unregistered Authentication Agent for unix-process:5673:185017 (system bus name :1.164, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en
Jun 30 10:03:22 hantest.com clickhouse-server[5711]: Processing configuration file '/etc/clickhouse-server/config.xml'.
Jun 30 10:03:22 hantest.com clickhouse-server[5711]: Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Jun 30 10:03:22 hantest.com clickhouse-server[5711]: Poco::Exception. Code: 1000, e.code() = 13, e.displayText() = Access to file denied: /var/log/clickhouse-server/clickhouse-server.log, Stack trace 

注意这行报错:

e.displayText() = Access to file denied: /var/log/clickhouse-server/clickhouse-server.log, Stack trace

找到日志目录

cd /var/log/clickhouse-server/

在这里插入图片描述
假如报警日志很大的话 就查看最近500 1000条就好了

tail -500f clickhouse-server.err.log

2.在日志里面找到报警信息

 <Error> system.asynchronous_metric_log (7d7655bb-7e5a-4413-a29f-ad181bf15ba7): 
 Detaching broken part /var/lib/clickhouse/store/7d7/7d7655bb-7e5a-4413-a29f-ad181bf15ba7/202308_930387_930387_0 
 (size: 0.00 B). If it happened after update, it is likely because of backward incompability.
  You need to resolve this manually

linux-clickhouse启动报错- Unit clickhouse-server.service entered failed state_第1张图片
提示这个202308_930387_930387_0文件损坏,结构需要清理

3.删除日志

进入文件夹

  cd /var/lib/clickhouse/store/7d7/7d7655bb-7e5a-4413-a29f-ad181bf15ba7/


找到提示的文件夹
linux-clickhouse启动报错- Unit clickhouse-server.service entered failed state_第2张图片

执行删除命令 !!!!需要谨慎,第一次执行的时候服务器直接死机了,建议还是不要执行了 然后想着改名字,发现也一样会死机。

4. 修改日志文件

虽然文件命名成功了,但是clickhouse还是无法启动,还是类似报错,应该是clickhouse还是会使用这个文件
想着怎么才能让clickhouse忽略这个文件夹,试着把上面层级的文件夹7d7改了下,改成7d7a,
执行
linux-clickhouse启动报错- Unit clickhouse-server.service entered failed state_第3张图片

systemctl start clickhouse-server
systemctl status clickhouse-server

linux-clickhouse启动报错- Unit clickhouse-server.service entered failed state_第4张图片

5.分析原因

断电

你可能感兴趣的:(clickhouse,java,linux,linux,clickhouse,java)