ClickHouse安装及部署

文章目录

Docker快速安装

本地pull镜像

shell 复制代码
docker run -d --name ch-server --ulimit nofile=262144:262144 -p 9000:9000 -p
8123:8123 yandex/clickhouse-server

保存docker镜像

shell 复制代码
docker run -d --name ch-server --ulimit nofile=262144:262144 -p 9000:9000 -p
8123:8123 yandex/clickhouse-server

进入docker容器,这里的id根据自己运行的docker id来,docker ps来查

shell 复制代码
docker exec -it 9b63 /bin/bash

更新vim

shell 复制代码
apt-get update
apt-get install vim -y

修改密码

shell 复制代码
cd /etc/clickhouse-server
vim users.xml

找到下面标签,并填充自己的密码

xml 复制代码
<password>xxx</password>

Ubuntu预编译安装包安装

检查是否支持SSE4.2

shell 复制代码
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

出现supported表示支持,可以继续按照教程操作,不支持的话,需要通过源码编译特定的版本进行安装

使用预编译安装包

shell 复制代码
sudo apt-get install clickhouse-client clickhouse-server

安装server以及client,如果比较慢,可以更新源

Tgz安装包

上面通过源的方式下载的,可能不是最新的版本。tgz安装包是通过官网来下载安装包,可以安装最新
稳定版本列表

这里使用的是23.1.2.9版本,可以选择其他版本。先下载四个需要用到的安装包:

shell 复制代码
wget https://packages.clickhouse.com/tgz/stable/clickhouse-common-static-dbg-23.1.2.9-amd64.tgz
wget https://packages.clickhouse.com/tgz/stable/clickhouse-common-static-23.1.2.9-amd64.tgz
wget https://packages.clickhouse.com/tgz/stable/clickhouse-client-23.1.2.9-amd64.tgz
wget https://packages.clickhouse.com/tgz/stable/clickhouse-server-23.1.2.9-amd64.tgz

下载完成后,解压这四个文件

shell 复制代码
tar -xzvf clickhouse-common-static-dbg-23.1.2.9-amd64.tgz
tar -xzvf clickhouse-common-static-23.1.2.9-amd64.tgz
tar -xzvf clickhouse-client-23.1.2.9-amd64.tgz
tar -xzvf clickhouse-server-23.1.2.9-amd64.tgz

解压如果报错,检查文件网络传输是否有问题,没有问题尝试其他版本

解压完成后开始安装

shell 复制代码
sudo "clickhouse-common-static-23.1.2.9/install/doinst.sh"
sudo "clickhouse-common-static-dbg-23.1.2.9/install/doinst.sh"
sudo "clickhouse-server-23.1.2.9/install/doinst.sh" configure
sudo "clickhouse-client-23.1.2.9/install/doinst.sh"

server包在安装的时候,需要输入default的密码

启动server:

shell 复制代码
sudo clickhouse start

配置文件修改

docker中的路径可能不同,其他方式配置文件路径都在/etc/clickhouse-server/

修改密码

修改users.xml

shell 复制代码
sudo vi users.xml

找到password标签,并修改内容

xml 复制代码
<password>xxx</password>

配置远程访问

上面主要讲述了安装服务端,当其他主机需要访问当前服务端时,需要在服务端配置文件中,配置开放host

修改config.xml

shell 复制代码
sudo vi config.xml

找到下面标签并取消注释

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

重启服务

shell 复制代码
systemctl clickhouse restart

其他主机访问

shell 复制代码
clickhouse-client -h 192.168.x.xxx -d default -m -u default --password 'xxx'

-h:host地址
-d: 具体某个数据库
-u:用户
--password:密码

文章参考

https://blog.csdn.net/daerzei/article/details/113818931

https://clickhouse.com/docs/zh/getting-started/install

相关推荐
狮歌~资深攻城狮1 天前
ClickHouse和TiDB怎么选型
数据库·clickhouse
wending-Y2 天前
记录clickhouse记录一次性能优化,从60s到1s
前端·clickhouse·性能优化
跳跳的向阳花3 天前
08、Docker学习,常用安装:ClickHouse
学习·clickhouse·docker
狮歌~资深攻城狮3 天前
ClickHouse与Doris对比:数据处理领域的“华山论剑”
clickhouse
那些乐趣3 天前
已经使用中的clickhouse更改数据目录
java·服务器·clickhouse
狮歌~资深攻城狮5 天前
ClickHouse和Doris怎么选型
clickhouse
叶域24 天前
ClickHouse总体学习
学习·clickhouse
时空无限24 天前
clickhouse清除system 表数据释放磁盘空间
数据库·clickhouse
angryshan24 天前
ClickHouse合并任务与查询延迟专项测试
数据库·clickhouse·php
fusugongzi25 天前
spring boot连接clickhouse集群,实现故障节点自动切换
java·spring boot·clickhouse