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

相关推荐
Championship.23.241 小时前
Linux 3.0 锁机制与故障排查详解
linux·运维·服务器
天疆说2 小时前
Zotero Connector 在 Edge 里找不到桌面 Zotero(Linux / Zotero 9.0.6 / Edge 150)
linux·前端·edge
风123456789~3 小时前
【Linux专栏】ls 排除某个文件
linux·运维·服务器
IT曙光4 小时前
ubuntu apt-get离线源制作
linux·ubuntu
其实防守也摸鱼4 小时前
运维--学习阶段问题解答(1)(自测)
linux·运维·服务器·数据库·学习·自动化·命令模式
懒鸟一枚4 小时前
深入理解 Linux 内存、Swap 交换分区与分页机制的关系
java·linux·数据库
Darkwanderor6 小时前
对Linux的进程控制的研究
linux·运维·c++
bksczm8 小时前
linux之线程概念和控制
linux·开发语言·c++
爱网络爱Linux9 小时前
Linux proc 目录安全加固
linux·运维·rhce·rhca·红帽认证·proc 目录安全加固
hehelm9 小时前
Linux网络编程—TCP字典翻译系统
linux·开发语言·网络·c++·tcp/ip