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

相关推荐
XueminXu3 天前
ClickHouse数据库的表引擎
数据库·clickhouse·log·表引擎·mergetree·special·integrations
MQ不会写文章3 天前
Clickhouse语法及配置
clickhouse
songroom8 天前
dbpystream webapi: 一次clickhouse数据从系统盘迁至数据盘的尝试
后端·clickhouse·阿里云
weixin_307779139 天前
Linux 下 Docker 与 ClickHouse 的安装配置及 MySQL 数据同步指南
linux·数据库·mysql·clickhouse·运维开发
bigdata-rookie10 天前
ClickHouse 介绍
clickhouse
MARSERERER13 天前
ClickHouse迁移Starrocks脚本工具
starrocks·clickhouse
赤月幼狼13 天前
clickhouse学习笔记(一)基础概念与架构
笔记·学习·clickhouse
草明14 天前
clickhouse 检查是否有删除语句在执行
数据库·clickhouse
StarRocks_labs14 天前
从 ClickHouse 到 StarRocks 存算分离: 携程 UBT 架构升级实践
starrocks·clickhouse·存算分离·ubt架构·湖仓查询
大数据0018 天前
CLICKHOUSE分布式表初体验
分布式·clickhouse