1.1 什么是ClickHouse
ClickHouse 是俄羅斯的Yandex于2016年開源的列式存儲數(shù)據(jù)庫(DBMS)槐臀,主要用于在線分析處理查詢(OLAP)稻爬,能夠使用SQL查詢實時生成分析數(shù)據(jù)報告。
1.2 什么是列式存儲
以下面的表為例:
image.png
采用行式存儲時板熊,數(shù)據(jù)在磁盤上的組織結構為:
image.png
好處是想查某個人所有的屬性時乍构,可以通過一次磁盤查找加順序讀取就可以。但是當想查所有人的年齡時撒璧,需要不停的查找,或者全表掃描才行笨使,遍歷的很多數(shù)據(jù)都是不需要的卿樱。
而采用列式存儲時,數(shù)據(jù)在磁盤上的組織結構為:
image.png
這時想查所有人的年齡只需把年齡那一列拿出來就可以了
1.3 安裝前的準備
1.3.1 CentOS取消打開文件數(shù)限制
在/etc/security/limits.conf硫椰、/etc/security/limits.d/90-nproc.conf這2個文件的末尾加入一下內(nèi)容:
[root@hadoop102 software]# vim /etc/security/limits.conf
在文件末尾添加:
最大文件數(shù)
* soft nofile 65536
* hard nofile 65536
最大進程數(shù)
* soft nproc 131072
* hard nproc 131072
[root@hadoop102 software]# vim /etc/security/limits.d/90-nproc.conf
在文件末尾添加:
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
重啟服務器之后生效繁调,用ulimit -n 或者ulimit -a查看設置結果
[root@hadoop102 ~]# ulimit -n
65536
1.3.2 CentOS取消SELINUX
修改/etc/selinux/config中的SELINUX=disabled后重啟
[root@hadoop102 ~]# vim /etc/selinux/config
SELINUX=disabled
1.3.3 關閉防火墻
[root@hadoop102 ~]# service iptables stop
[root@hadoop102 ~]# service ip6tables stop
ip6tables:將 chains 設置為 ACCEPT 策略:filter [確定]
ip6tables:清除防火墻規(guī)則: [確定]
:正在卸載模塊: [確定]
1.3.4 安裝依賴
[root@hadoop102 ~]# yum install -y libtool
[root@hadoop102 ~]# yum install -y *unixODBC*