centos7安装clickhouse(单机安装)
1.关闭防火墙
systemctl stop firewalld.service
禁用开启启动项
systemctl disable firewalld.service
2.检查服务器cpu是否支持SSE4.2指令集(向量化执行需要)
代码语言:javascript复制grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
3.调整操作系统最大进程数和文件句柄
代码语言:javascript复制vim /etc/systemd/system.conf
DefaultLimitNOFILE=65535
#DefaultLimitAS=
DefaultLimitNPROC=65535
修改需要重启才能生效
最大打开文件数立即生效:
ulimit -n 65535
4.创建目录
代码语言:javascript复制mkdir -p /data/clickhouse/data
mkdir -p /data/clickhouse/tmp
5.yum安装:
代码语言:javascript复制sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/clickhouse.repo
sudo yum install clickhouse-server clickhouse-client
6.修改配置
代码语言:javascript复制
<!-- Path to data directory, with trailing slash. -->
<path>/data/clickhouse/data</path>
<!-- Path to temporary data for processing hard queries. -->
<tmp_path>/data/clickhouse/tmp/</tmp_path>
7.设置目录权限
chown clickhouse:clickhouse -R /data/clickhouse
8.启动clickhouse
systemctl start clickhouse-serve
rpm安装:
1.下载相应的rpm包
https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/
例如:
代码语言:javascript复制[root@localhost clickhouserpm]# ll
total 112164
-rw-r--r-- 1 root root 120447 May 25 23:38 clickhouse-client-20.1.16.120-2.noarch.rpm
-rw-r--r-- 1 root root 114588203 May 25 23:40 clickhouse-common-static-20.1.16.120-2.x86_64.rpm
-rw-r--r-- 1 root root 141210 May 25 23:40 clickhouse-server-20.1.16.120-2.noarch.rpm
保持包版本一致
安装执行:
代码语言:javascript复制rpm -ivh clickhouse-*.rpm
[root@localhost clickhouserpm]# rpm -ivh clickhouse-*.rpm
Preparing... ################################# [100%]
Updating / installing...
1:clickhouse-common-static-20.1.16.################################# [ 33%]
2:clickhouse-client-20.1.16.120-2 ################################# [ 67%]
3:clickhouse-server-20.1.16.120-2 ################################# [100%]
Path to data directory in /etc/clickhouse-server/config.xml: /var/lib/clickhouse/
其余步骤和yum安装一样
卸载clickhouse
1.先停止clickhouse
[root@localhost ck]# systemctl stop clickhouse-server.service
2.检查安装包并删除
代码语言:javascript复制[root@localhost ck]# rpm -qa |grep clickhouse
clickhouse-server-21.5.5.12-2.noarch
clickhouse-common-static-21.5.5.12-2.x86_64
clickhouse-client-21.5.5.12-2.noarch
rpm -e clickhouse-server-21.5.5.12-2.noarch --nodeps
rpm -e clickhouse-common-static-21.5.5.12-2.x86_64 --nodeps
rpm -e clickhouse-client-21.5.5.12-2.noarch --nodeps
[root@localhost ck]# rpm -qa |grep clickhouse
3.删除相关的目录
代码语言:javascript复制[root@localhost ck]# rm -rf /etc/clickhouse-server/
[root@localhost ck]# rm -rf /etc/clickhouse-client/
[root@localhost ck]# rm -rf /var/lib/clickhouse/
[root@localhost ck]# rm -rf /var/log/clickhouse-server/
[root@localhost ck]# rm -rf /home/ck/