Clickhouse Introduction ClickHouse is a column-oriented database management system that can generate analytical data reports in real time using SQL queries. It is mainly used in OLAP (online analytical processing) scenarios. The principles and basic knowledge of ClickHouse will be slowly summarized in future studies. 1. Install ClickHouse with Docker 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-server 2. Download SSBM tool 1. git clone https://github.com/vadimtk/ssb-dbgen.git 2. cd ssb-dbgen 3. make 3. Generate data ./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 View the following data 4. Create a table 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. Import data Preparation: clickhouse-client --query "INSERT INTO customer FORMAT CSV" < customer.tbl clickhouse-client --query "INSERT INTO part FORMAT CSV" < part.tbl clickhouse-client --query "INSERT INTO supplier FORMAT CSV" < supplier.tbl clickhouse-client --query "INSERT INTO lineorder FORMAT CSV" < lineorder.tbl Note: If an error occurs here, check the configuration of ClickHouse (whether the port is occupied, whether the user and password are set) 6. Testing
Official website reference: The above is the details of Docker creating ClickHouse and initializing data testing. For more information about Docker, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: A brief discussion on Python's function knowledge
>>: Stealing data using CSS in Firefox
The <link> tag defines the relationship bet...
This article describes how to install MySQL 5.7 f...
IMG tag basic analysis In HTML5, the img tag has ...
This article records the installation and configu...
The ".zip" format is used to compress f...
There are two types of web page box models: 1: Sta...
1. Environmental preparation: Operating system: C...
1. How to monitor MySQL deadlocks in production e...
<br />Before browsers can handle the next ge...
Preface Since the most important data structure i...
Preface When we forget the MySQL database passwor...
Table of contents Installation Prerequisites Step...
Table of contents Achieve results Rolling load kn...
Table of contents 1. What is scrapy_splash? 2. Th...
The <marquee> tag is a tag that appears in ...