clickhouse下载和安装

来源:这里教程网 时间:2026-03-01 15:33:45 作者:

clickhouse下载和安装

1.安装包下载

wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-common-20.8.3.18-1.el7.x86_64.rpm/download.rpm

wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-20.8.3.18-1.el7.x86_64.rpm/download.rpm

wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-client-20.8.3.18-1.el7.x86_64.rpm/download.rpm

wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-common-static-20.8.3.18-1.el7.x86_64.rpm/download.rpm

下载好的安装包

[root@mdb01 clickhouse]# ll

total 103412

-rw-r--r-- 1 clickhouse clickhouse     6384 Oct  6 06:32 clickhouse-client-20.8.3.18-1.el7.x86_64.rpm

-rw-r--r-- 1 clickhouse clickhouse 69093220 Oct  6 06:32 clickhouse-common-static-20.8.3.18-1.el7.x86_64.rpm

-rw-r--r-- 1 clickhouse clickhouse 36772044 Oct  6 06:36 clickhouse-server-20.8.3.18-1.el7.x86_64.rpm

-rw-r--r-- 1 clickhouse clickhouse    14472 Oct  6 06:36 clickhouse-server-common-20.8.3.18-1.el7.x86_64.rpm

也可以直接配置yum源的方式

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

2.安装clickhouse

[root@mdb01 clickhouse]# rpm -ivh clickhouse*

Preparing...                          ################################# [100%]

Updating / installing...

   1:clickhouse-server-common-20.8.3.1################################# [ 25%]

   2:clickhouse-common-static-20.8.3.1################################# [ 50%]

   3:clickhouse-server-20.8.3.18-1.el7################################# [ 75%]

Create user clickhouse.clickhouse with datadir /var/lib/clickhouse

   4:clickhouse-client-20.8.3.18-1.el7################################# [100%]

Create user clickhouse.clickhouse with datadir /var/lib/clickhouse

修改数据目录:

# cd /etc/clickhouse-server/

# ll

total 44

-rw-r--r-- 1 root root 33738 Oct  6 06:05 config.xml

-rw-r--r-- 1 root root  5587 Oct  6 06:05 users.xml

# more config.xml |grep -B1 '/u01/clickhouse'

    <!-- Path to data directory, with trailing slash. -->

    <path>/u01/clickhouse/data/</path>

--

    <!-- Path to temporary data for processing hard queries. -->

    <tmp_path>/u01/clickhouse/tmp/</tmp_path>

--

    <!-- Directory with user provided files that are accessible by 'file' table function. -->

    <user_files_path>/u01/clickhouse/user_files/</user_files_path>

--

      -->

    <format_schema_path>/u01/clickhouse/format_schemas/</format_schema_path>

3.启动clickhouse

nohup clickhouse-server --config-file=/etc/clickhouse-server/config.xml &

4.连接clickhouse

[clickhouse@mdb01 clickhouse]$ clickhouse-client 

ClickHouse client version 20.8.3.18.

Connecting to localhost:9000 as user default.

Connected to ClickHouse server version 20.8.3 revision 54438.




mdb01 :) show databases;




SHOW DATABASES




┌─name───────────────────────────┐

│ _temporary_and_external_tables │

│ default                        │

│ system                         │

└────────────────────────────────┘




3 rows in set. Elapsed: 0.002 sec. 

相关推荐