Ubuntu下ClickHouse安装

用 root 身份运行, 注意在install那一步, 不要设置密码

bash 复制代码
# 使用官方安装源,跳过签名验证。(因为使用 gpg 完全通过代理获取签名的问题至今没有解决。)
echo 'deb [trusted=yes] https://packages.clickhouse.com/deb stable main' > /etc/apt/sources.list.d/clickhouse.list
apt update

# 安装最新版
apt install -y clickhouse-{server,client}

# 也可以指定安装精确的版本号
apt list -a clickhouse-server | head
apt install -y clickhouse-{server,client}=23.12.2.59

# 启动服务并配置开机自动启动
systemctl start clickhouse-server
systemctl enable clickhouse-server

如果不小心设置了密码, 设置/etc/clickhouse-server/users.d/default-password.xml为如下内容

复制代码
<clickhouse>
<users>
<default>
<password></password>
</default>
</users>
</clickhouse>

另外, 检查/etc/clickhouse-server/config.d/listen.xml文件是否存在

如果没有, 创建该文件, 添加如下内容

复制代码
<clickhouse>
<listen_host>::</listen_host>
</clickhouse>

再重启clickhouse

复制代码
systemctl restart clickhouse-server

这样同内网的其他机器即可通过远程9000端口来访问该clickhouse, 否则其只能提供本地访问服务

复制代码
clickhouse-client --host 10.0.0.X

如果service启动不了, 可以手动启动clickhouse-server --config-file=/etc/clickhouse-server/config.xml查看原因

若遇到报错

复制代码
Effective user of the process (root) does not match the owner of the data (clickhouse). Run under 'sudo -u clickhouse'

则使用chown -R clickhouse:clickhouse /var/lib/clickhouse可修复问题

相关推荐
正在学习前端的---小方同学2 小时前
Harbor部署教程
linux·运维
Sean X4 小时前
Ubuntu24.04安装向日葵
linux·ubuntu
IT 乔峰5 小时前
脚本部署MHA集群
linux·shell
dz小伟5 小时前
execve() 系统调用深度解析:从用户空间到内核的完整加载过程
linux
Mr_Xuhhh5 小时前
博客标题:深入理解Shell:从进程控制到自主实现一个微型Shell
linux·运维·服务器
JoyCheung-6 小时前
Free底层是怎么释放内存的
linux·c语言
旖旎夜光6 小时前
Linux(9)
linux·学习
喵了meme7 小时前
Linux学习日记24:Linux网络编程基础
linux·网络·学习
whlqjn_12117 小时前
linux下使用SHC对Shell脚本进行封装和源码隐藏
linux·centos
weixin_462446238 小时前
K8s 集群部署基础:Linux 三节点 SSH 互信(免密登录)配置指南
linux·kubernetes·ssh