CentOS7 linux系統多種方式安裝ClickHouse數據庫

  clickhouse是由俄羅斯Yandex公司開發的列式存儲數據庫,於2016年開源,clickhouse的定位是快速的數據分析,對於處理海量數據的狀況性能很是好,在網上也有不少測試的案例,在大數據的狀況下性能遠超過其餘數據庫,而且不依賴於hadoop的生態系統,都是獨立使用,在大數據存儲業務上仍是能夠考慮的.mysql

  clickhouse官網地址:https://clickhouse.yandex/,文檔地址:https://clickhouse.yandex/docs/en/linux

    另外推薦單頁文檔,更方便:https://clickhouse.yandex/docs/en/singlegit

下面開始安裝

  安裝依賴項

  安裝過程須要curl下載包。此外,ClickHouse測試包在EPEL中有一些依賴關係,所以epel-release必須安裝,以防您想要安裝ClicKhouse測試包確保curl安裝在系統上github

sudo yum install -y curl
 #若是安裝了測試包,添加epel-release 
sudo yum install -y epel-release 

讓咱們下載並運行packagecloud.io提供的安裝shell腳本sql

對於CentOS 6和7shell

curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh | sudo bash

腳本後安裝包

首先,確保咱們有可用於安裝的ClickHouse軟件包數據庫

sudo yum list 'clickhouse*'

ClickHouse包應該列爲可用,以下所示:緩存

#可用包組
clickhouse-client.x86_64 18.1.0-1.el7 Altinity_clickhouse
clickhouse-common-static.x86_64 18.1.0-1.el7 Altinity_clickhouse
clickhouse-compressor.x86_64 1.1.54336-3.el7 Altinity_clickhouse
clickhouse-debuginfo.x86_64 18.1.0-1.el7 Altinity_clickhouse
clickhouse-mysql.noarch 0.0.20180319-1 Altinity_clickhouse
clickhouse-server.x86_64 18.1.0-1.el7 Altinity_clickhouse
clickhouse-server-common.x86_64 18.1.0-1.el7 Altinity_clickhouse
clickhouse-test.x86_64 18.1.0-1.el7 Altinity_clickhouse

  

有多個軟件包可用(新版本和舊工具),其中一些已經棄用,所以無需安裝全部可用的RPM。bash

如今讓咱們安裝ClickHouse主要部件 - 服務器和客戶端應用程序。服務器

sudo yum install -y clickhouse-server clickhouse-client

 並驗證它是否已列爲已安裝

 sudo yum list installed 'clickhouse*'

  ClickHouse軟件包應列爲已安裝,以下所示:

Installed Packages
clickhouse-client.x86_64                 18.1.0-1.el7           @Altinity_clickhouse
clickhouse-common-static.x86_64          18.1.0-1.el7           @Altinity_clickhouse
clickhouse-server.x86_64                 18.1.0-1.el7           @Altinity_clickhouse
clickhouse-server-common.x86_64          18.1.0-1.el7           @Altinity_clickhouse

  確保ClickHouse服務器正在運行

sudo /etc/init.d/clickhouse-server restart

  而後鏈接到它 clickhouse-client

clickhouse-client

  ClickHouse服務器應該響應,以下所示:

ClickHouse客戶端版本18.1.0。
鏈接到localhost:9000做爲用戶默認值。
鏈接到ClickHouse服務器版本18.1.54396。

:)

  

 

 

第二種方式手動安裝:

讓咱們手動添加Altinity的repo

安裝所需的包

咱們須要在beforehands以前安裝如下軟件包:

  • pygpgme - 幫助處理gpg簽名
  • yum-utils - 包含用於處理源RPM的工具
  • coreutils- 包含核心工具,咱們稍後須要tee命令
  • epel-release - 包含ClickHouse測試包依賴項
  • sudo yum install -y pygpgme yum-utils coreutils epel-release

     

  • 如今讓咱們建立yum存儲庫配置文件:/etc/yum.repos.d/altinity_clickhouse.repo根據您運行的CentOS版本,您可能須要EL 6或7版本的文件

EL6 repo file

cat <<"EOF" | sudo tee /etc/yum.repos.d/altinity_clickhouse.repo
[altinity_clickhouse]
name=altinity_clickhouse
baseurl=https://packagecloud.io/altinity/clickhouse/el/6/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[altinity_clickhouse-source]
name=altinity_clickhouse-source
baseurl=https://packagecloud.io/altinity/clickhouse/el/6/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOF

  

EL7 repo file

cat <<"EOF" | sudo tee /etc/yum.repos.d/altinity_clickhouse.repo
[altinity_clickhouse]
name=altinity_clickhouse
baseurl=https://packagecloud.io/altinity/clickhouse/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[altinity_clickhouse-source]
name=altinity_clickhouse-source
baseurl=https://packagecloud.io/altinity/clickhouse/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

  

更新緩存

建立repo文件後,讓咱們yum使用新添加的altinity_clickhouserepo中的包更新緩存

sudo yum -q makecache -y --disablerepo = ' * ' - enablerepo = ' altinity_clickhouse '

  安裝到此結束:)

 

 

第三種方法爲離線安裝:

查看系統版本爲CentOS7.6

執行命令查看是否支持安裝: 

grep -q sse4_2 /proc/cpuinfo && echo 「SSE 4.2 supported」 || echo 「SSE 4.2 not supported」

  

而後下載ClickHouse所需的離線安裝包,下載地址:http://repo.red-soft.biz/repos/clickhouse/stable/el7/

wget http://repo.red-soft.biz/repos/clickhouse/stable/el7/clickhouse-client-1.1.54236-4.el7.x86_64.rpm
wget http://repo.red-soft.biz/repos/clickhouse/stable/el7/clickhouse-compressor-1.1.54236-4.el7.x86_64.rpm
wget http://repo.red-soft.biz/repos/clickhouse/stable/el7/clickhouse-debuginfo-1.1.54236-4.el7.x86_64.rpm
wget http://repo.red-soft.biz/repos/clickhouse/stable/el7/clickhouse-server-1.1.54236-4.el7.x86_64.rpm
wget http://repo.red-soft.biz/repos/clickhouse/stable/el7/clickhouse-server-common-1.1.54236-4.el7.x86_64.rpm

  下載完畢開始安裝

    rpm -ivh clickhouse-server-common-1.1.54236-4.el7.x86_64.rpm
    rpm -ivh clickhouse-server-1.1.54236-4.el7.x86_64.rpm
  報錯:錯誤:依賴檢測失敗:libodbc.so.2()(64bit) 被 clickhouse-server-1.1.54236-4.el7.x86_64 須要 解決辦法:yum install *ODBC*
    rpm -ivh clickhouse-debuginfo-1.1.54236-4.el7.x86_64.rpm
    rpm -ivh clickhouse-compressor-1.1.54236-4.el7.x86_64.rpm
    rpm -ivh clickhouse-client-1.1.54236-4.el7.x86_64.rpm  

 安裝完成後關閉防火牆和Selinux

systemctl stop firewalld.service #中止firewall 
systemctl disable firewalld.service #禁止firewall開機啓動
setenforce 0 #關閉selinux

 啓動clickhouse服務端 

service clickhouse-server start

  經過客戶端鏈接 

clickhouse-client –m 

  

出現笑臉表明成功:)

相關文章
相關標籤/搜索