ITPub博客

首页 > 数据库 > NoSQL > clickhouse for centos7安装和使用初探

clickhouse for centos7安装和使用初探

原创 NoSQL 作者:chenfeng 时间:2019-10-10 17:27:08 0 删除 编辑


clickhouse介绍:

战斗民族开发的 olap 数据库,属于NoSQL,适用于渠道漏斗分析、app 点击行为路径分析等业务场景


安装:

按照官方文档推荐,用yum方式安装最方便

#yum install yum-utils -y


# rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG


# yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64

Loaded plugins: fastestmirror

adding repo from: https://repo.yandex.ru/clickhouse/rpm/stable/x86_64


[repo.yandex.ru_clickhouse_rpm_stable_x86_64]

name=added from: https://repo.yandex.ru/clickhouse/rpm/stable/x86_64

baseurl=https://repo.yandex.ru/clickhouse/rpm/stable/x86_64

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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
交流MySQL,MongoDB和Redis技术。 微信或QQ:410294

注册时间:2015-12-07

  • 博文量
    748
  • 访问量
    1801533