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 一次Schema修改造成的Merge阻塞问题的分析和解决过程
clickhouse
bigdata-rookie5 天前
StarRocks(2.5.1)vs Clickhouse(21.7.3.14)集群 SSB 性能测试
clickhouse
CTO Plus技术服务中5 天前
ClickHouse原理解析与应用实践教程
clickhouse
zhangyifang_0097 天前
ClickHouse查询报错:Code: 62. DB::Exception: Max query size exceeded:
数据库·clickhouse
HideInTime7 天前
Clickhouse进阶分组复合排序查询
clickhouse
memgLIFE8 天前
clickhouse
clickhouse
Arbori_262159 天前
clickhouse 实现mysql GROUP_CONCAT() 函数
数据库·mysql·clickhouse
斯普信专业组10 天前
Nomad组件部署clickhouse-job
clickhouse·nomad
麦兜和小可的舅舅10 天前
ClickHouse Drop Table On Cluster 故障分析和原理解析
clickhouse·kafka
重生之绝世牛码12 天前
Linux软件安装 —— ClickHouse单节点安装(rpm安装、tar安装两种安装方式)
大数据·linux·运维·数据库·clickhouse·软件安装·clickhouse单节点