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

相关推荐
MMMMMMMMMMemory3 天前
clickhouse迁移工具clickhouse-copier
clickhouse
securitor3 天前
【clickhouse】设置密码
clickhouse
天道有情战天下5 天前
ClickHouse使用Docker部署
clickhouse·docker·容器
冷雨夜中漫步7 天前
ClickHouse常见问题——ClickHouseKeeper配置listen_host后不生效
java·数据库·clickhouse
qq_339191147 天前
docker 启动一个clickhouse , docker 创建ck数据库
clickhouse·docker·容器
Kookoos9 天前
ABP + ClickHouse 实时 OLAP:物化视图与写入聚合
clickhouse·c#·linq·abp vnext·实时olap
喂完待续10 天前
【Big Data】AI赋能的ClickHouse 2.0:从JIT编译到LLM查询优化,下一代OLAP引擎进化路径
大数据·数据库·clickhouse·数据分析·olap·big data·序列晋升
阿里云大数据AI技术18 天前
鹰角网络基于阿里云 EMR Serverless StarRocks 的实时分析工程实践
starrocks·clickhouse·阿里云·emr·实时分析
更深兼春远21 天前
flink+clinkhouse安装部署
大数据·clickhouse·flink