CentOS7單機(jī)快速安裝clickhouse
Centos(CommunityEnterprise Operating System)是社區(qū)企業(yè)操作系統(tǒng),是Linux發(fā)行版之一。 centos是由Red Hat Enterprise Linux依照開(kāi)放源代碼規(guī)定釋出的源代碼所編譯而成,但它并不包含封閉源代碼軟件。
國(guó)內(nèi)鏡像站
Clickhouse 官方的下載地址在國(guó)外,下載速度比較慢,可以使用國(guó)內(nèi)鏡像站進(jìn)行安裝比較快。
Debian/Ubuntu 用戶
新建/etc/apt/sources.list.d/clickhouse.list,內(nèi)容為
- deb https://mirrors.tuna.tsinghua.edu.cn/clickhouse/deb/stable/ main/
RHEL/CentOS 用戶
新建 /etc/yum.repos.d/clickhouse.repo,內(nèi)容為
- [clickhouse]
- name=clickhouse stable
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64
- enabled=1
- gpgcheck=0
安裝
在CentOS7上直接使用yum直接安裝就可以。
- yum install clickhouse-server clickhouse-client -y
啟動(dòng)服務(wù)并設(shè)置開(kāi)機(jī)啟動(dòng)
- systemctl start clickhouse-server
- systemctl enable clickhouse-server
測(cè)試
直接使用clickhouse-client進(jìn)行連接
- clickhouse-client
創(chuàng)建數(shù)據(jù)庫(kù)和一張表測(cè)試
- create database metrics;
- use metrics
- create table servers( id UInt64 ,ip String ,count UInt64) engine=TinyLog;
- insert into servers (id , ip , count) values (1,'127.0.0.1',100);
- select * from servers;
- centos7 :) select * from servers;
-
- SELECT *
- FROM servers
-
- ┌─id─┬─ip────────┬─count─┐
- │ 1 │ 127.0.0.1 │ 100 │
- └────┴───────────┴───────┘
-
- 1 rows in set. Elapsed: 0.002 sec.
-
- centos7 :)