Centos7安裝clickhouse
1.下載安裝包
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-test-18.12.14-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-common-18.12.14-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-18.12.14-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-debuginfo-18.12.14-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-common-static-18.12.14-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-client-18.12.14-1.el7.x86_64.rpm/download.rpm
2.安裝順序
rpm -ivh clickhouse-server-common-18.12.14-1.el7.x86_64.rpm
rpm -ivh clickhouse-common-static-18.12.14-1.el7.x86_64.rpm
rpm -ivh clickhouse-server-18.12.14-1.el7.x86_64.rpm
rpm -ivh clickhouse-debuginfo-18.12.14-1.el7.x86_64.rpm
rpm -ivh clickhouse-test-18.12.14-1.el7.x86_64.rpm
rpm -ivh clickhouse-client-18.12.14-1.el7.x86_64.rpm
3.啟動
啟動clickhouse服務端
service clickhouse-server start
通過客戶端連接
clickhouse-client –m
show databases;
4.參數配置
1 放開遠程訪問
vi /etc/clickhouse-server/config.xml
第65行脂男,放開注釋即可
<listen_host>
2 內存限制設置
vi /etc/clickhouse-server/users.xml
<max_memory_usage>
3 設置數據目錄
vi /etc/clickhouse-server/config.xml
<path>/data/clickhouse/</path>
<tmp_path>/data/clickhouse/tmp/</tmp_path>
5.創(chuàng)建用戶設置密碼
http://www.reibang.com/p/e339336e7bb9
配置文件:user.xml
核心配置3部分:
- profile配置懊蒸,最大內存、負載方式等(沒有特別關注询一,可見官方文檔)
- 配額設置杯聚,單個用戶最大能用的資源多少(沒有特別關注昨忆,可見官方文檔)
- 用戶設置惶洲,包括用戶名和密碼
密碼有2種,一種是明文裹粤,一種是寫sha256sum的Hash值
官方不建議直接寫明文密碼
PASSWORD=$(base64 < /dev/urandom | head -c8);
echo "$PASSWORD";
echo -n "$PASSWORD" | sha256sum | tr -d '-'
6lYaUiFi967f3bf355dddfabfca1c9f5cab39352b2ec1cd0b05f9e1e6b8f629705fe7d6e
用戶:clickhouse
clickhouse-client -h 127.0.0.1 -d mela -m -u clickhouse --password 12345
建表
CREATE DATABASE IF NOT EXISTS mela;
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] [db.]name AS [db2.]name2 [ENGINE = engine]
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] [db.]name ENGINE = engine AS SELECT ...