一、CentOS安装
1. 登陆官网
https://clickhouse.tech/#quick-start
2. 安装
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo yum install -y clickhouse-server clickhouse-client
sudo /etc/init.d/clickhouse-server start # 启动服务端
clickhouse-client # or "clickhouse-client --password" if you set up a password. # 连接客户端
3.配置修改
config.xml 打开监听地址
<listen_host>0.0.0.0</listen_host>
<path>/opt/data/</path>
有时9000端口被其他组件占用,需修改config.xml,执行
sed -i "s/9000/5566/g" /etc/clickhouse-server/config.xml
users.xml 设置密码
<password>password</password>
4.启动
sudo clickhouse-server --config-file=/etc/clickhouse-server/config.xml
## 其他命令
systemctl start clickhouse-server
systemctl stop clickhouse-server
systemctl status clickhouse-server
二、安装包安装
1、下载地址
https://packages.clickhouse.com/
安装包如下:
2、安装
上传到linux环境,依次将这四个安装包解压,并且每解压一个,执行一下解压文件夹下的install下的doinst.sh脚本。
解压顺序:
clickhouse-common-static-22.3.2.2.tgz
clickhouse-common-static-dbg-22.3.2.2.tgz
clickhouse-server-22.3.2.2.tgz
clickhouse-client-22.3.2.2.tgz
解压执行doinst.sh脚本:
------------------------------------------------------------
# 解压
tar -zxvf clickhouse-common-static-22.3.2.2.tgz
cd clickhouse-common-static-22.3.2.2/install/
# 运行doinst.sh
./doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-common-static-dbg-22.3.2.2.tgz
./clickhouse-common-static-dbg-22.3.2.2/install/doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-server-22.3.2.2.tgz
./clickhouse-server-22.3.2.2/install/doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-client-22.3.2.2.tgz
./clickhouse-client-22.3.2.2/install/doinst.sh
------------------------------------------------------------
在解压clickhouse-serve并安装./clickhouse-server-21.9.4.35/install/doinst.sh
后,clickhouse会默认创建一个default的用户,让你设置密码,不设置密码可以按回车
3、配置文件
config.xml 打开监听地址
<listen_host>0.0.0.0</listen_host>
<path>/opt/data/</path>
users.xml 设置密码
<password>password</password>
4.启动
sudo clickhouse-server --config-file=/etc/clickhouse-server/config.xml
## 其他命令
systemctl start clickhouse-server
systemctl stop clickhouse-server
systemctl status clickhouse-server
5.连接客户端
clickhouse-client
## -m 支持多行语句
clickhouse-client -m
## 密码连接
clickhouse-client --password