clickhouse for centos7安裝和使用初探

chenfeng發表於2019-10-10


clickhouse介紹:

戰鬥民族開發的 olap 資料庫,屬於NoSQL,適用於渠道漏斗分析、app 點選行為路徑分析等業務場景


安裝:

按照官方文件推薦,用yum方式安裝最方便

#yum install yum-utils -y


# rpm --import


# yum-config-manager --add-repo

Loaded plugins: fastestmirror

adding repo from:


[repo.yandex.ru_clickhouse_rpm_stable_x86_64]

name=added from:

baseurl=

enabled=1


# yum install clickhouse-server clickhouse-client -y  (此步時間有點長,多等會)


啟動clickhouse:

# service clickhouse-server start

Start clickhouse-server service: Path to data directory in /etc/clickhouse-server/config.xml: /var/lib/clickhouse/

DONE



連線和使用測試:

# clickhouse-client 

ClickHouse client version 19.15.3.6 (official build).

Connecting to localhost:9000 as user default.

Connected to ClickHouse server version 19.15.3 revision 54426.


test-110-81 :) 

test-110-81 :) 

test-110-81 :) 

test-110-81 :) select 1


SELECT 1


┌─1─┐

│ 1 │

└───┘


1 rows in set. Elapsed: 0.002 sec. 


test-110-81 :) CREATE TABLE wikistat(date Date,time DateTime,project String,subproject String,path String,hits UInt64,size UInt64) ENGINE = MergeTree(date, (path, time), 8192);


CREATE TABLE wikistat

(

    `date` Date, 

    `time` DateTime, 

    `project` String, 

    `subproject` String, 

    `path` String, 

    `hits` UInt64, 

    `size` UInt64

)

ENGINE = MergeTree(date, (path, time), 8192)


Ok.


0 rows in set. Elapsed: 0.032 sec. 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2659408/,如需轉載,請註明出處,否則將追究法律責任。

相關文章