Host OS: Ubuntu 22.04
ClickHouse version: 22.6.3.35
Using the pre-compiled packages is the recommended way for installing ClickHouse. The ClickHouse Server is configured to run as a systemd service and it will automatically start with every host OS reboot. Failures can happen while starting the ClickHouse as systemd service or after a reboot. Possible solutions for such scenarios are discussed in this article.
Scenario 1:
ClickHouse server won’t start as a service (even by manually executing sudo service clickhouse-server start) but can be run by invoking clickhouse-server from the terminal.
Possible Root Cause: ClickHouse folders have incorrect permissions
Steps to troubleshoot:
- Check the systemd logs using the below command ina terminal window
sudo journalctl -u clickhouse-server
- Check if a similar error message is displayed (Access to file denied: /var/lib/clickhouse*)
- Change the ownership of the following directories to Clickhouse user instead of other users (root)
sudo chown -R clickhouse /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client
- Start the server and verify the status using the below commands
sudo service clickhouse-server start sudo service clickhouse-server status
- Now, the server should be started as a service. The expected output is below.
Scenario 2:
ClickHouse server is not started automatically after every reboot, but the service can be started manually using sudo service clickhouse-server start command.
Possible Root Cause: ClickHouse service is disabled
Steps to Troubleshoot
- Run the following command after the host OS reboot
sudo service clickhouse-server status
- The service status is shown as disabled (similar to below).
- Re-enable Clickhouse systems service
sudo systemctl enable clickhouse-server.service
- Reload systemd services
sudo systemctl daemon-reload service
- Reload the clickhouse server and the service should run even after reboot.
sudo clickhouse-server restart
Conclusion:
This article will be updated as and when new issues are encountered and solved.
References:
https://stackoverflow.com/questions/65442339/cant-launch-clickhouse-exit-code-203