1.安装前准备工作
1.1确定防火墙是否关闭状态
systemctl firewalld stop
systemctl firewalld status
1.2 取消打开文件数限制
#在 /etc/security/limits.conf文件的末尾加入以下内容
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
#在/etc/security/limits.d/20-nproc.conf文件的末尾加入以下内容
vim /etc/security/limits.d/20-nproc.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
1.3 安装依赖
yum install -y libtool
yum install -y *unixODBC*
CentOS取消SELINUX 修改/etc/selinux/config中的SELINUX=disabled
vim /etc/selinux/config
SELINUX=disabled
2.下载安装包
下载地址:https://packages.clickhouse.com/rpm/stable/
#创建ck的目录
mkdir -p /apps/clickhouse
#进入改目录下
cd /apps/clickhouse/
###
wget https://packages.clickhouse.com/rpm/stable/clickhouse-client-22.6.3.35.noarch.rpm
wget https://packages.clickhouse.com/rpm/stable/clickhouse-common-static-22.6.3.35.x86_64.rpm
wget https://packages.clickhouse.com/rpm/stable/clickhouse-server-22.6.3.35.noarch.rpm
wget https://packages.clickhouse.com/rpm/stable/clickhouse-common-static-dbg-22.6.3.35.x86_64.rpm
3.安装
rpm -ivh *.rpm
3.1 验证安装
rpm -qa | grep clickhouse
3.2 修改配置文件
把 <listen_host>::</listen_host> 的注释打开,让ClickHouse被除本机以外的服务器访问
vim /etc/clickhouse-server/config.xml
4.启动Server
systemctl start clickhouse-server
5.使用client连接server
无密码连接:
clickhouse-client -m
有密码连接:
clickhouse-client --host=你的IP --port=9000 --user=default --password=你的密码
6.ck相关的操作
#查看命令
clickhouse --help
#启动
clickhouse start
#重启
clickhouse restar
# 命令目录
/usr/bin
# 配置文件目录
cd /etc/clickhouse-server/
# 日志目录
cd /var/log/clickhouse-server/
# 数据文件目录
cd /var/lib/clickhouse/