单机安装
本文使用的版本是21.12.3.32
一、Linux系统准备工作
(1)修改配置,安装依赖
[root@172.16.131.56 ~]$ vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
[root@172.16.131.56 ~]$ yum install -y libtool
[root@172.16.131.56 ~]$ yum install -y *unixODBC*
[root@172.16.131.56 ~]$ vim /etc/selinux/config
SELINUX=disabled
(2)改完后重启服务器
二、离线安装(推荐)
(1)下载
https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
下载4个包,后面的版本号需要一致
clickhouse-client*
clickhouse-common-static*
clickhouse-common-static-dbg*
clickhouse-server*
(2)安装
[root@172.16.131.56 ~]$ rpm -ivh *.rpm
(3)修改配置
[root@172.16.131.56 ~]$ vim /etc/clickhouse-server/config.xml
# 本文使用的版本是21.12.3.32 使用<listen_host>::</listen_host>会报错
# 开启本配置后,可以使用第三方工具访问该服务
<listen_host>0.0.0.0</listen_host>
(4)启动,重启,停止,状态命令
[root@172.16.131.56 ~]$ /etc/init.d/clickhouse-server start
[root@172.16.131.56 ~]$ /etc/init.d/clickhouse-server restart
[root@172.16.131.56 ~]$ /etc/init.d/clickhouse-server stop
[root@172.16.131.56 ~]$ /etc/init.d/clickhouse-server status
(5)连接命令
# -m可以输入多行命令
[root@172.16.131.56 ~]$ clickhouse-client -m
ClickHouse client version 21.12.3.32 (official build).
Connecting to localhost:9001 as user default.
Connected to ClickHouse server version 21.12.3 revision 54452.
hadoop-master :) quit;
数据文件路径
[root@172.16.131.56 /etc/clickhouse-server]$ cd /var/lib/clickhouse/
日志文件路径
[root@172.16.131.56 /var/lib/clickhouse]$ cd /var/log/clickhouse-server
三、在线安装(不推荐)
如果有梯子的话,可以试试。
官方网站
https://clickhouse.com/#quick-start
命令
sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.com/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.com/rpm/clickhouse.repo
sudo yum install clickhouse-server clickhouse-client
sudo /etc/init.d/clickhouse-server start
clickhouse-client # or "clickhouse-client --password" if you set up a password.