系统版本:centos7.6
clickhouse版本:21.9.4.35
1、安装
yum install yum-utils
rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
yum install clickhouse-server clickhouse-client
2、启动
简单粗暴的修改文件所有者为root用户
chown -R root:root /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client
启动clickhouse服务
clickhouse-server --config-file=/etc/clickhouse-server/config.xml
3、可能遇到的问题
需要注意以下文件夹的所有者是否统一为clickhouse用户
/var/lib/clickhouse
/var/log/clickhouse-server
/etc/clickhouse-server
/etc/clickhouse-client
如果没有修改文件夹的所有者,执行启动命令# clickhouse-server --config-file=/etc/clickhouse-server/config.xml可能会遇到如下错误
Application: DB::Exception: Effective user of the process (root) does not match the owner of the data (clickhouse). Run under ‘sudo -u clickhouse’.
提示使用clickhouse用户启动
sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml
执行后又报错
Couldn’t save preprocessed config to /var/lib/clickhouse/preprocessed_configs/config.xml: Access to file denied: /var/lib/clickhouse/preprocessed_configs/config.xml
此时修改以下几个文件夹用户为clickhouse
chown -R root:root /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client
启动时依然报错
Application: DB::ErrnoException: Could not calculate available disk space (statvfs), errno: 13, strerror: Permission denied
然后添加clickhouse用户到root用户组重新启动即可
usermod -a -G root clickhouse
参考
https://clickhouse.com/docs/zh/getting-started/install/
https://github.com/ClickHouse/ClickHouse/issues/7902
————————————————
版权声明:本文为CSDN博主「hhf…」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/haohaifeng002/article/details/120486494