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可修复问题

相关推荐
liuhuizuikeai2 小时前
可视化门禁---Linux/Qt+SqLite篇
linux·运维·qt
初願致夕霞2 小时前
基于系统调用的Linux网络编程——UDP与TCP
linux·网络·c++·tcp/ip·udp
charlie1145141915 小时前
嵌入式Linux驱动开发——新 API 字符设备驱动完整教程 - 从设备结构体到应用测试
linux·运维·驱动开发
消失的旧时光-19435 小时前
C语言对象模型系列(四)《Linux 内核里的 container_of 到底是什么黑魔法?》—— 一篇讲透 Linux 内核的“对象模型”核心技巧
linux·c语言·算法
SWAGGY..6 小时前
Linux系统编程:(二)基础指令详解
linux·运维·服务器
kdxiaojie6 小时前
U-Boot分析【学习笔记】(3)
linux·笔记·学习
烛衔溟6 小时前
TypeScript 接口继承与混合类型
linux·ubuntu·typescript
蜡笔婧萱6 小时前
Linux--远程登录服务ssh
linux·服务器·ssh
伏加特遇上西柚7 小时前
Loki+Alloy+Grafana日志采集部署
java·linux·服务器·spring boot·grafana·prometheus
资源分享助手7 小时前
三网H5小游戏战车向前冲搭建教程(Win+Linux)
linux·运维·服务器