Docker安装ClickHouse并初始化数据测试
clickhouse简介
创新互联公司是一家专注于网站设计制作、网站制作与策划设计,元谋网站建设哪家好?创新互联公司做网站,专注于网站建设10年,网设计领域的专业建站公司;建站业务涵盖:元谋等地区。元谋做网站价格咨询:18980820575
ClickHouse是一个面向列存储的数据库管理系统,可以使用SQL查询实时生成分析数据报告,主要用于OLAP(在线分析处理查询)场景。关于clickhouse原理以及基础知识在以后学习中慢慢总结。
1、Docker安装ClickHouse
docker run -d --name some-clickhouse-server \-p 8123:8123 -p 9009:9009 -p 9091:9000 \--ulimit nofile=262144:262144 \-v /home/clickhouse:/var/lib/clickhouse \yandex/clickhouse-server2、下载SSBM工具
1、git clone https://github.com/vadimtk/ssb-dbgen.git2、cd ssb-dbgen3、make3、生成数据
./dbgen -s 100 -T c./dbgen -s 100 -T p./dbgen -s 100 -T s./dbgen -s 100 -T l./dbgen -s 100 -T d查看下数据
4、建表
CREATE TABLE default.customer( C_CUSTKEY UInt32, C_NAME String, C_ADDRESS String, C_CITY LowCardinality(String), C_NATION LowCardinality(String), C_REGION LowCardinality(String), C_PHONE String, C_MKTSEGMENT LowCardinality(String))ENGINE = MergeTree ORDER BY (C_CUSTKEY);CREATE TABLE default.lineorder( LO_ORDERKEY UInt32, LO_LINENUMBER UInt8, LO_CUSTKEY UInt32, LO_PARTKEY UInt32, LO_SUPPKEY UInt32, LO_ORDERDATE Date, LO_ORDERPRIORITY LowCardinality(String), LO_SHIPPRIORITY UInt8, LO_QUANTITY UInt8, LO_EXTENDEDPRICE UInt32, LO_ORDTOTALPRICE UInt32, LO_DISCOUNT UInt8, LO_REVENUE UInt32, LO_SUPPLYCOST UInt32, LO_TAX UInt8, LO_COMMITDATE Date, LO_SHIPMODE LowCardinality(String))ENGINE = MergeTree PARTITION BY toYear(LO_ORDERDATE) ORDER BY (LO_ORDERDATE, LO_ORDERKEY);CREATE TABLE default.part( P_PARTKEY UInt32, P_NAME String, P_MFGR LowCardinality(String), P_CATEGORY LowCardinality(String), P_BRAND LowCardinality(String), P_COLOR LowCardinality(String), P_TYPE LowCardinality(String), P_SIZE UInt8, P_CONTAINER LowCardinality(String))ENGINE = MergeTree ORDER BY P_PARTKEY;CREATE TABLE default.supplier( S_SUPPKEY UInt32, S_NAME String, S_ADDRESS String, S_CITY LowCardinality(String), S_NATION LowCardinality(String), S_REGION LowCardinality(String), S_PHONE String)ENGINE = MergeTree ORDER BY S_SUPPKEY;5、导入数据
准备工作:
先把ssb-dbgen(lineorder.tbl,customer.tbl,part.tbl,supplier.tbl)考到clickhouse-server容器里面
注意:如果此处报错,检查clickhouse的配置(端口是否占用,是否设置用户和密码)
6、测试
官网参考:
https://clickhouse.tech/docs/zh/getting-started/example-datasets/star-schema/#star-schema-benchmark
以上就是Docker创建ClickHouse 并初始化数据测试的详细内容,更多关于Docker的资料请关注脚本之家其它相关文章!
本文标题:Docker安装ClickHouse并初始化数据测试
转载来源:http://ybzwz.com/article/iogsps.html