当前位置:网站首页>Clickhouse deployment and basic usage 1
Clickhouse deployment and basic usage 1
2022-06-24 11:07:00 【Tdsql-a assistant】
1. Deployment structure
stay Clickhouse in , In general, there are 2 There are two ways to deploy ,3 Method of use :
Deployment way :
- Deployment way 1: Deploy a single node Clickhouse colony , For example, the cluster used by Xiaobai .
- Deployment way 2: Deploy a multi node cluster , such as Tom and Jim Cluster used
Usage mode :
- Usage mode 1: Single node cluster , Single node execution SQL Direct manipulation . For example, Xiaobai in the above figure (sql No middle on cluster sentence )
- Usage mode 2:: Multi node cluster , And how to use it 1 equally , Like the one above Tom(sql No middle on cluster sentence ) This way, , If the user is connected to
Different nodesWhat you seeThe data may be differentOf . - Usage mode 3: Multi node cluster , user
Cluster operation, Like the one above Sam and Jim Cluster operation , SQL Statement needs to be addedon cluster XXXX, XXX Indicates the cluster name .
The following is a brief introduction to the basic functions of cluster operation and single node operation SQL.
2. Cluster operation Demo SQL
- 2.1 Create a database
create database db_test on cluster default_cluster
- 2.2. Delete a database
drop database db_test on cluster default_cluster
- 2.3. Create a table
CREATE TABLE db_test.tbl_replac_merge_test on cluster default_cluster ( id String, code String, create_time DateTime ) ENGINE = ReplacingMergeTree() PARTITION BY toYYYYMM(create_time) PRIMARY KEY id ORDER BY (id, code);
- 2.4. Delete a table
drop table db_test.tbl_replac_merge_test on cluster default_cluster
3. Single node operation Demo SQL
- 3.1. Create a database
create database db_test;
- 3.2. Delete a database
drop database db_test;
- 3.3. Create a table
CREATE TABLE db_test.tbl_replac_merge_test ( `id` String, `code` String, `create_time` DateTime ) ENGINE = ReplacingMergeTree() PARTITION BY toYYYYMM(create_time) PRIMARY KEY id ORDER BY (id, code);
- 3.4. Delete a database table
drop table db_tetbl_replac_merge_test
4. How to create distributed tables and local tables
- 4.1 Create database
CREATE DATABASE db_100 on cluster default_cluster;
- 4.2 Create local table
CREATE TABLE db_100.tb_1_local on cluster default_cluster
(
`c1` Int64,
`c2` String,
`_sign` Int8,
`_version` UInt64
)
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/5a165fe5-ab38-4bf2-a6ee-5124a65ed1aa/{shard}', '{replica}', _version)
ORDER BY (c1, c2)
SETTINGS index_granularity = 8192- 4.3 Create a distributed table
CREATE TABLE db_100.tb_1 on cluster default_cluster
(
`c1` Int64,
`c2` String,
`_sign` Int8,
`_version` UInt64
)
ENGINE = Distributed('default_cluster', 'db_1', 'tb_1_local', cityHash64(toString((c1, c2))))more Clickhouse Table creation document :
https://clickhouse.tech/docs/en/sql-reference/statements/create/table/
边栏推荐
- Which is a good CAD drawing software? How to select good software
- What are the means of network promotion?
- js中对象合并的4种方式,对象合并的4种方法
- MYSQL_精讲数据库数据类型
- Introduction to the use of splice() method
- Tencent geek challenge small - endless!
- Group policy export import
- I want 18K. Can I pass it?
- What is recursion?
- What characteristics should a good design website have?
猜你喜欢

Charles packet capturing tool tutorial

SQL Server about like operator (including the problem of field data automatically filling in spaces)

Act as you like

Canvas pipe animation JS special effect

Window function row in SQL Server_ number()rank()dense_ rank()

计组_cpu的结构和工作流程

MYSQL_精讲数据库数据类型

Plant growth H5 animation JS special effect

2D 照片变身 3D 模型,来看英伟达的 AI 新“魔法”!

Any and typevar make the automatic completion of IDE better
随机推荐
[latest in the whole network] how to start the opentsdb source code in the local ide run
I want 18K. Can I pass it?
Group policy export import
"Adobe international certification" Adobe Photoshop adjusts cropping, rotation and canvas size
A method of generating non repeated numbers in nodejs
MYSQL_精讲数据库数据类型
What are the means of network promotion?
≥ 2012r2 configure IIS FTP
What does ERP system mean
@RequestBody注解
Preparation for a series of courses on WordPress applet generation
A group of skeletons flying canvas animation JS special effect
Can text pictures be converted to word? How to extract text from pictures
126. word Solitaire II BFS
How to export only the titles in word documents? (i.e. delete all the text contents and keep only the title) stop B
Which map navigation is easy to use and accurate?
What is the function of the graphics card driver? Do you want to update the graphics card driver
腾讯开源项目「应龙」成Apache顶级项目:前身长期服务微信支付,能hold住百万亿级数据流处理...
Shape change loader loads jsjs special effect code
Anonymous Messenger: hidden communication of Trojan horse