安装前准备工作
1.关闭防火墙
service iptables stop关闭防火墙;
2.在两个文件中分别加入以下内容
sudo vim /etc/security/limits.conf
sudo vim /etc/security/limits.d/90-nproc.conf
soft nofile 65536
hard nofile 65536
soft nproc 131072
hard nproc 131072
3. 永久关闭selinux
vi /etc/selinux/config
将:SELINUX=enforcing改为SELINUX=disabled
在线安装
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/stable/x86_64
sudo yum install clickhouse-server clickhouse-client
sudo service clickhouse-server start
clickhouse-client
离线安装
1.下载rpm安装包
地址:https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/
我下载的是如下三个包(网站包很多,直接复制名字搜索)
clickhouse-client-21.6.6.51-2.noarch.rpm
clickhouse-common-static-21.6.6.51-2.x86_64.rpm
clickhouse-server-21.6.6.51-2.noarch.rpm
2.安装
rpm -ivh *.rpm
这里会提示输入默认的密码,可以直接回车 不需要密码,后面单独对用户进行设置密码。
如果遇到提示文件不存在的情况,需要给新文件的文件添加权限。
命令: chmod +x *.rpm
服务启动和停止
service start clickhouse-server
service stop clickhouse-server
service status clickhouse-server
若service启动过程报错为:Init script is already running,则使用systemctl方式启动.(centos 7需要使用systemctl启动)
systemctl start clickhouse-server
systemctl stop clickhouse-server
5.登录
没有设置密码:clickhouse-client
设置了密码:clickhouse-client -h 127.0.0.1 -d default -m -u default --password 12345
6.配置远程登录
vi /etc/clickhouse-server/config.xml
找到<listent_host>::</listen_host> 去掉注释并重启动
systemctl stop clickhouse-server.service
systemctl start clickhouse-server.service
systemctl status clickhouse-server.service
在安装过程中给出现了rpm命令失效的问题解决方案如下
在rpm执行正常的系统的找到这三个文件并放入故障系统的放入对应目录下(注意文件权限)。
目录如下:
/bin/rpm
/usr/lib/rpm/rpmrc
/usr/lib/rpm/macros
最后执行updatedb命令 rpm命令就恢复正常了