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

相关推荐
weixin_307779133 天前
AWS云上ClickHouse数据仓库部署方案详解
开发语言·clickhouse·自动化·云计算·aws
板凳坐着晒太阳3 天前
ClickHouse 配置优化与问题解决
数据库·clickhouse
LoneEon8 天前
Ubuntu 部署 ClickHouse:高性能分析型数据库(附shell脚本一键部署↓)
数据库·clickhouse
恒悦sunsite9 天前
Ubuntu之apt安装ClickHouse数据库
数据库·clickhouse·ubuntu·列式存储·8123
问道飞鱼15 天前
【大数据技术】ClickHouse配置详细解读
大数据·clickhouse·配置信息
StarRocks_labs17 天前
StarRocks 助力印度领先即时零售平台 Zepto 构建实时洞察能力
大数据·starrocks·clickhouse·存算一体·postgres mvp
奋进的白羊18 天前
clickhouse使用问题记录
数据库·clickhouse
JeffreyGu.18 天前
clickhouse-backup备份
数据库·clickhouse
hkNaruto19 天前
【大数据】clickhouse快速上手
大数据·clickhouse