[转帖]clickHouse单机模式安装部署(RPM安装)

clickhouse,单机,模式,安装,部署,rpm · 浏览次数 : 0

小编点评

**问题一:启动报错** 启动参数:sudo clickhouse-server --config-file=/etc/clickhouse-server/config.xml 问题二:clickhouse-clict 连接失败 代码: 210. DB::NetException: Connection refused (localhost:9000) **解决方法:** 1. 修改后启动参数: ``` sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml ``` 2. 注释掉配置文件中的article标签: ``` </article> ``` 3. 重新启动服务端: ``` sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml ``` **问题三:clickhouse-clict 连接失败** 代码: 210. DB::NetException: Connection refused (localhost:9000) **解决方法:** 1. 检查配置文件中的article标签是否正确注释。 2. 尝试重新连接点击house服务器。 3. 如果连接失败,检查点击house服务器的日志文件。 4. 如果日志文件中没有错误信息,请联系点击house支持人员。

正文

关于版本和系统的选择

操作系统:Centos-7
ClickHouse: rpm 在安装,20.x

安装前的准备

CentOS7 打开文件数限

在 /etc/security/limits.conf 这个文件的末尾加入一下内容:

[hadoop@hadoop001 ~]$ sudo vim /etc/security/limits.conf
  1. * soft nofile 65536
  2. * hard nofile 65536
  3. * soft nproc 131072
  4. * hard nproc 131072

/etc/security/limits.d/20-nproc.conf (centos6 是90-nproc.conf) 这个文件的末尾加入一下内容:

[hadoop@hadoop001 ~]$ sudo vim /etc/security/limits.d/20-nproc.conf
  1. * soft nofile 65536
  2. * hard nofile 65536
  3. * soft nproc 131072
  4. * hard nproc 131072

重启服务器之后生效,用 ulimit -n 或者 ulimit -a 查看设置结果

  1. ulimit -n
  2. ulimit -a
  1. [hadoop@hadoop001 ~]$ ulimit -n
  2. 65536
  3. [hadoop@hadoop001 ~]$ ulimit -a
  4. core file size (blocks, -c) 0
  5. data seg size (kbytes, -d) unlimited
  6. scheduling priority (-e) 0
  7. file size (blocks, -f) unlimited
  8. pending signals (-i) 14994
  9. max locked memory (kbytes, -l) 64
  10. max memory size (kbytes, -m) unlimited
  11. open files (-n) 65536
  12. pipe size (512 bytes, -p) 8
  13. POSIX message queues (bytes, -q) 819200
  14. real-time priority (-r) 0
  15. stack size (kbytes, -s) 8192
  16. cpu time (seconds, -t) unlimited
  17. max user processes (-u) 131072
  18. virtual memory (kbytes, -v) unlimited
  19. file locks (-x) unlimited

CentOS7 取消 SELINUX

修改 /etc/selinux/config 中的 SELINUX=disabled 后重启

[hadoop@hadoop001 ~]$ sudo vim /etc/selinux/config 
SELINUX=disabled

关闭防火墙

  1. [hadoop@hadoop001 ~]$ sudo systemctl stop firewalld.service
  2. [hadoop@hadoop001 ~]$ sudo systemctl disable firewalld.servie
  3. [hadoop@hadoop001 ~]$ sudo systemctl status firewalld.service
  4. ● firewalld.service - firewalld - dynamic firewall daemon
  5. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  6. Active: inactive (dead)
  7. Docs: man:firewalld(1)
  8. [hadoop@hadoop001 ~]$

安装依赖

  1. [hadoop@hadoop001 ~]$ sudo yum install -y libtool
  2. [hadoop@hadoop001 ~]$ sudo yum install -y *unixODBC*

安装

官网:https://clickhouse.yandex/
具体安装细节看:https://clickhouse.tech/#quick-start

先检查是否已经安装clickhouse,如果已经安装,先卸载 clickhouse
查询是否安装 clickhouse:

[hadoop@hadoop001 software]rpm -qa | grep clickhouse

卸载 clickhouse:

  1. [hadoop@hadoop001 software]rpm -e --nodeps clickhouse-client-20.1.4.14-2.noarch
  2. [hadoop@hadoop001 software]rpm -e --nodeps clickhouse-server-20.1.4.14-2.noarch
  3. [hadoop@hadoop001 software]rpm -e --nodeps clickhouse-common-static-20.1.4.14-2-2.x86_64

删除数据目录:

[hadoop@hadoop001 software]rm -rf /var/lib/clickhouse

删除集群配置文件:

[hadoop@hadoop001 software]rm -rf /etc/metrika.xml

删除集群配置文件:

[hadoop@hadoop001 software]rm -rf /etc/metrika.xml

删除配置文件:

[hadoop@hadoop001 software]rm -rf /etc/clickhouse-*

删除日志文件:

[hadoop@hadoop001 software]rm -rf /var/log/clickhouse-server

删除 zookeeper 上 clickhouse 的数据:

rmr /clickhouse

也可以进行全局寻找,然后执行删除操作

[hadoop@hadoop001 software]find / -name 'clickhouse'

单机模式

ClickHouse的安装可以使用 yum在线安装,也可以使用 rpm 离线安装的方式!
具体信息见官网文档:https://clickhouse.tech/#quick-start

准备操作

需要验证当前服务器的 CPU 是否支持 SSE 4.2 指令集,因为向量化执行需要用到这项特性:

  1. [hadoop@hadoop001 clickhouse]$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
  2. SSE 4.2 supported

安装

依次执行如下命令:

  1. [hadoop@hadoop001 clickhouse]$ sudo yum install yum-utils -y
  2. [hadoop@hadoop001 clickhouse]$ sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
  3. [hadoop@hadoop001 clickhouse]$ yum-config-manager --add-repo ttps://repo.clickhouse.tech/rpm/clickhouse.repo
  4. [hadoop@hadoop001 clickhouse]$ yum install clickhouse-server clickhouse-client -y

如果您没法链接互联网,则也可以使用 rpm 的方式来进行离线安装(下载地址在:https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/https://packagecloud.io/Altinity/clickhouse)需要下载的安装包有:

  1. [hadoop@hadoop001 clickhouse]$ ll
  2. total 1212764
  3. -rw-r--r-- 1 hadoop hadoop 120430 Nov 5 18:20 clickhouse-client-20.1.4.14-2.noarch.rpm
  4. -rw-r--r-- 1 hadoop hadoop 113426346 Nov 5 18:23 clickhouse-common-static-20.1.4.14-2.x86_64.rpm
  5. -rw-r--r-- 1 hadoop hadoop 1128177078 Nov 6 09:18 clickhouse-common-static-dbg-20.1.4.14-2.x86_64.rpm
  6. -rw-r--r-- 1 hadoop hadoop 141391 Nov 5 18:20 clickhouse-server-20.1.4.14-2.noarch.rpm

rpm安装

  1. [hadoop@hadoop001 clickhouse]$ sudo rpm -ivh *.rpm
  2. warning: clickhouse-client-20.1.4.14-2.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID e0c56bd4: NOKEY
  3. Preparing... ################################# [100%]
  4. Updating / installing...
  5. 1:clickhouse-common-static-20.1.4.1################################# [ 25%]
  6. 2:clickhouse-client-20.1.4.14-2 ################################# [ 50%]
  7. 3:clickhouse-server-20.1.4.14-2 ################################# [ 75%]
  8. Created symlink from /etc/systemd/system/multi-user.target.wants/clickhouse-server.service to /etc/systemd/system/clickhouse-server.service.
  9. Path to data directory in /etc/clickhouse-server/config.xml: /var/lib/clickhouse/
  10. 4:clickhouse-common-static-dbg-20.1################################# [100%]

启动服务端

前段启动:

sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml

后端启动

nohup sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml 1>/tmp/clickhouse/clickhouse_std.log 2>/tmp/clickhouse/clickhouse_err.log &

验证测试

  1. [root@hadoop001 ~]# ps aux | grep clickhouse
  2. clickho+ 2955 0.1 3.1 2425796 122628 ? Ssl 00:55 0:01 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
  3. root 3347 0.0 0.0 112704 980 pts/1 S+ 01:08 0:00 grep --color=auto clickhouse
  4. [root@hadoop001 ~]# netstat -ntlp | grep clickhouse
  5. tcp6 0 0 :::8123 :::* LISTEN 3966/clickhouse-ser
  6. tcp6 0 0 :::9000 :::* LISTEN 3966/clickhouse-ser
  7. tcp6 0 0 :::9009 :::* LISTEN 3966/clickhouse-ser
  8. [root@hadoop001 ~]# clickhouse-client
  9. ClickHouse client version 20.1.4.14 (official build).
  10. Connecting to localhost:9000 as user default.
  11. Connected to ClickHouse server version 20.1.4 revision 54431.
  12. hadoop001 :) show databases;
  13. SHOW DATABASES
  14. ┌─name────┐
  15. default
  16. │ system │
  17. └─────────┘
  18. 2 rows in set. Elapsed: 0.012 sec.
  19. hadoop001 :) create database test;
  20. CREATE DATABASE test
  21. Ok.
  22. hadoop001 :) insert into test01 values (1, 'Russia'), (2, 'clickhouse'), (3, 'spark');
  23. INSERT INTO test01 VALUES
  24. Ok.
  25. 3 rows in set. Elapsed: 0.003 sec.
  26. hadoop001 :) select id, name from test01;
  27. SELECT
  28. id,
  29. name
  30. FROM test01
  31. ┌─id─┬─name───────┐
  32. 1 │ Russia │
  33. 2 │ clickhouse │
  34. 3 │ spark │
  35. └────┴────────────┘
  36. 3 rows in set. Elapsed: 0.012 sec.
  37. hadoop001 :)
  38. 0 rows in set. Elapsed: 0.002 sec.

问题汇总

问题一:启动报错

启动参数:sudo clickhouse-server --config-file=/etc/clickhouse-server/config.xml

2020.08.20 18:49:28.189321 [ 29338 ] {} <Error> Application: DB::Exception: Effective user of the process (root) does not match the owner of the data (clickhouse). Run under 'sudo -u clickhouse'

解决办法,已经有了提示,Run under ‘sudo -u clickhouse’.
修改后启动参数: sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml

问题二:clickhouse-clict 连接失败

  1. [root@hadoop001 ~]# clickhouse-client
  2. ClickHouse client version 20.1.4.14 (official build).
  3. Connecting to localhost:9000 as user default.
  4. Code: 210. DB::NetException: Connection refused (localhost:9000)
[root@hadoop001 clickhouse]# vim /etc/clickhouse-server/config.xml

打开此处注释

   

 

 

 

 

 

 

</article>

与[转帖]clickHouse单机模式安装部署(RPM安装)相似的内容:

[转帖]clickHouse单机模式安装部署(RPM安装)

关于版本和系统的选择 操作系统:Centos-7 ClickHouse: rpm 在安装,20.x 安装前的准备 CentOS7 打开文件数限 在 /etc/security/limits.conf 这个文件的末尾加入一下内容: [hadoop@hadoop001 ~]$ sudo vim /etc

[转帖]Clickhouse单机及集群部署详解

https://www.cnblogs.com/ya-qiang/p/13540016.html 一、ClickHouse简介 ClickHouse是近年来备受关注的开源列式数据库,主要用于数据分析(OLAP)领域。目前国内社区火热,各个大厂纷纷跟进大规模使用: 今日头条 内部用ClickHouse

[转帖]ck的离线安装

下载 下载地址: https://repo.clickhouse.tech/tgz/stable/ 下载的包: clickhouse-common-static clickhouse-server clickhouse-client 单机安装 tar -zxvf clickhouse-common-

[转帖]谈谈ClickHouse性能情况以及相关优化

https://zhuanlan.zhihu.com/p/349105024 ClickHouse性能情况 主要分为4个方面 1、单个查询吞吐量 场景一: 如果数据被放置在page cache中,则一个不太复杂的查询在单个服务器上大约能够以2-10GB/s(未压缩)的速度进行处理(对于简单的查询,速

[转帖]clickhouse存储机制以及底层数据目录分布

https://www.cnblogs.com/MrYang-11-GetKnow/p/15818141.html#:~:text=%E6%AF%8F%E4%B8%80%E4%B8%AA%E6%95%B0%E6%8D%AE%E5%BA%93%E9%83%BD%E4%BC%9A%E5%9C%A8cli

[转帖]clickhouse使用clickhouse-keeper代替zookeeper

目录 异常现象: 1. clickhouse的异常日志 2. 追踪对应节点的zookeeper日志 使用clickhouse-keeper代替 zookeeper的步骤: 1: 准备 clickhouse-keeper的配置文件 1.1- 设置通信地址,以便对外通信 1.2- 在config.xml

[转帖]什么是ClickHouse?

什么是ClickHouse? ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS)。 在传统的行式数据库系统中,数据按如下顺序存储: RowWatchIDJavaEnableTitleGoodEventEventTime #0 89354350662 1 Investo

[转帖]tgz 安装clickhouse

一、什么是clickhouse ClickHouse是开源的列式存储数据库(DBMS),主要用于在线处理查询(OLAP),能够使用SQL查询实时生成数据分析报告。 下面介绍下安装clickhouse。 二、安装前的准备1、Centos取消打开文件数限制在/etc/security/limits.co

[转帖]一文快速入门 ClickHouse

https://zhuanlan.zhihu.com/p/621480049 什么是clickhouse ClickHouse是一种OLAP类型的列式数据库管理系统,这里有两个概念:OLAP、列式数据库。这两个概念会在接下来做介绍,ClickHouse完美的实现了OLAP和列式数据库的优势,因此在大

[转帖]TiDB升级、TiFlash测试及对比ClickHouse

原创 NewSQL 作者:o烟雨潇潇o 时间:2020-05-13 11:53:16 4418 0 TiDB升级、TiFlash测试及对比ClickHouse --2020-05-13 刘春雷 1、汇总 1.1、需求 测试3.0.7 升级至4.0.0-rc 测试部署TiFlash 测试TiFlash