CentOS7單機快速安裝clickhouse
Centos(CommunityEnterprise Operating System)是社區(qū)企業(yè)操作系統(tǒng),是Linux發(fā)行版之一。 centos是由Red Hat Enterprise Linux依照開放源代碼規(guī)定釋出的源代碼所編譯而成,但它并不包含封閉源代碼軟件。
國內鏡像站
Clickhouse 官方的下載地址在國外,下載速度比較慢,可以使用國內鏡像站進行安裝比較快。
Debian/Ubuntu 用戶
新建/etc/apt/sources.list.d/clickhouse.list,內容為
- deb https://mirrors.tuna.tsinghua.edu.cn/clickhouse/deb/stable/ main/
 
RHEL/CentOS 用戶
新建 /etc/yum.repos.d/clickhouse.repo,內容為
- [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
 
啟動服務并設置開機啟動
- systemctl start clickhouse-server
 - systemctl enable clickhouse-server
 
測試
直接使用clickhouse-client進行連接
- clickhouse-client
 
創(chuàng)建數(shù)據(jù)庫和一張表測試
- 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 :)
 

















 
 
 








 
 
 
 