1. 程式人生 > 實用技巧 >Clickhouse單機版的安裝

Clickhouse單機版的安裝

公司專案上需求使用Clickhouse,記錄下單機版的安裝步驟,選擇的是rpm包方式安裝
本例是在CentOS7上安裝部署到/app目錄下

1、下載所需安裝包

下載地址中下載所需版本的安裝包,一般是5個安裝包。

2、以如下順序,rpm方式安裝

rpm -ivh clickhouse-common-static-20.3.11.97-1.el7.x86_64.rpm
rpm -ivh clickhouse-server-common-20.3.11.97-1.el7.x86_64.rpm
rpm -ivh clickhouse-server-20.3.11.97-1.el7.x86_64.rpm
rpm -ivh clickhouse-client-20.3.11.97-1.el7.x86_64.rpm

3、建立目錄

mkdir -p /app/clickhouse/log
mkdir -p /app/clickhouse/data
mkdir -p /app/clickhouse/data_old
mkdir -p /app/clickhouse/tmp/
mkdir -p /app/clickhouse/format_schemas/
mkdir -p /app/clickhouse/user_files/

4、修改啟動指令碼vim /etc/init.d/clickhouse-server 修改以下引數:

CLICKHOUSE_LOGDIR=/app/clickhouse/log
CLICKHOUSE_LOGDIR_USER=root
CLICKHOUSE_DATADIR_OLD=/app/clickhouse/data_old
CLICKHOUSE_DATADIR=/app/clickhouse/data

5、修改config.xml中的目錄地址,vim /etc/clickhouse-server/config.xml:

<path>/app/clickhouse/data/</path>
<tmp_path>/app/clickhouse/tmp/</tmp_path>
<user_files_path>/app/clickhouse/user_files/</user_files_path>
<format_schema_path>/app/clickhouse/format_schemas/</format_schema_path>

6、啟動和驗證ClickHouse服務

service clickhouse-server start
clickhouse-client -m

7、新增開機自啟動

chkconfig clickhouse-server on