其他分享
首页 > 其他分享> > ClickHouse 安装部署

ClickHouse 安装部署

作者:互联网

1、前置环境准备

1.1、查看是否存在旧版本ClickHouse 

[hui@hadoop201 ~]$ rpm -qa |grep clickhouse

如果存在安装数据可以卸载

yum remove -y clickhouse-common-static
yum remove -y clickhouse-server-common
rm -rf /var/lib/clickhouse
rm -rf /etc/clickhouse-*
rm -rf /var/log/clickhouse-server

注意:安装卸载使用root用户

1.2、关闭防火墙

systemctl stop firewalld
systemctl disable firewalld.service

1.3、CentOS设置打开文件数限制

查看限制

[hui@hadoop201 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63372
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 131072
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
sudo vim  /etc/security/limits.conf文件的末尾加入以下内容
[hui@hadoop201 ~]$ sudo vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
sudo vim /etc/security/limits.d/20-nproc.conf文件的末尾加入以下内容

[hui@hadoop201 ~]$ sudo vim  /etc/security/limits.d/20-nproc.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

1.4、安装依赖

[hui@hadoop201 ~]$ sudo yum install -y libtool
[hui@hadoop201 ~]$  sudo yum install -y *unixODBC*

1.5、CentOS取消SELINUX

修改/etc/selinux/config中的SELINUX=disabled

[hui@hadoop201 ~]$ sudo vim /etc/selinux/config
SELINUX=disabled

 设置完毕 SELINUX 如果不方便重启机器可以使其临时生效;

setenforce 0

2、安装 ClickHouse

2.1、上传安装文件

[hui@hadoop201 clickhouse]$ ll
total 938164
-rw-rw-r-- 1 hui hui     78074 Jul 27  2021 clickhouse-client-21.7.3.14-2.noarch.rpm
-rw-rw-r-- 1 hui hui 174283244 Jul 27  2021 clickhouse-common-static-21.7.3.14-2.x86_64.rpm
-rw-rw-r-- 1 hui hui 786208040 Jul 27  2021 clickhouse-common-static-dbg-21.7.3.14-2.x86_64.rpm
-rw-rw-r-- 1 hui hui    101969 Jul 27  2021 clickhouse-server-21.7.3.14-2.noarch.rpm

2.2、安装 rpm 文件

[root@hadoop201 clickhouse]# rpm -ivh *.rpm 

2.3、配置

[hui@hadoop201 software]$ sudo vim /etc/clickhouse-server/config.xml 
把 <listen_host>::</listen_host> 的注释打开,这样的话才能让ClickHouse被除本机以外的服务器访问

2.4、启动

[root@hadoop201 clickhouse]# clickhouse start
 chown --recursive clickhouse '/var/run/clickhouse-server/'
Will run su -s /bin/sh 'clickhouse' -c '/usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon'
Waiting for server to start
Waiting for server to start
Server started

此时ClickHouse 已经启动

[root@hadoop201 clickhouse]# clickhouse status
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 3154.
The process with pid = 3154 is running.

2.5、连接测试

[root@hadoop201 clickhouse]#  clickhouse-client -m
ClickHouse client version 21.7.3.14 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.7.3 revision 54449.

hadoop201 :) show databases;

SHOW DATABASES

Query id: f052da3a-a091-4bf5-95cd-e6045db2f6cb

┌─name────┐
│ default │
│ system  │
└─────────┘

2 rows in set. Elapsed: 0.005 sec. 

至此,CLickHouse 安装完毕。

标签:hadoop201,部署,hui,server,etc,ClickHouse,--,安装,clickhouse
来源: https://www.cnblogs.com/wdh01/p/16543030.html