Skip to content

Commit f810b36

Browse files
chore: bump version 1.0 (#2206)
Co-authored-by: discord9 <discord9@users.noreply.github.com>
1 parent 58a6084 commit f810b36

File tree

674 files changed

+84566
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+84566
-87
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{
2+
"sidebar.docs.doc.Overview": {
3+
"message": "概述",
4+
"description": "The ZH label for Overview"
5+
},
6+
"sidebar.docs.category.Getting Started": {
7+
"message": "立即开始",
8+
"description": "The label for category Getting Started in sidebar docs"
9+
},
10+
"sidebar.docs.category.Installation": {
11+
"message": "安装",
12+
"description": "The label for category Installation in sidebar docs"
13+
},
14+
"sidebar.docs.category.User Guide": {
15+
"message": "用户指南",
16+
"description": "The label for category User Guide in sidebar docs"
17+
},
18+
"sidebar.docs.category.Concepts": {
19+
"message": "基础概念",
20+
"description": "The label for category Concepts in sidebar docs"
21+
},
22+
"sidebar.docs.category.Migrate to GreptimeDB": {
23+
"message": "迁移到 GreptimeDB",
24+
"description": "The label for category Migrate to GreptimeDB in sidebar docs"
25+
},
26+
"sidebar.docs.category.Write Data": {
27+
"message": "写入数据",
28+
"description": "The label for category Write Data in sidebar docs"
29+
},
30+
"sidebar.docs.category.Query Data": {
31+
"message": "查询数据",
32+
"description": "The label for category Query Data in sidebar docs"
33+
},
34+
"sidebar.docs.category.Flow Computation": {
35+
"message": "流计算",
36+
"description": "The label for category Flow Computation in sidebar docs"
37+
},
38+
"sidebar.docs.category.Logs": {
39+
"message": "日志",
40+
"description": "The label for category Logs in sidebar docs"
41+
},
42+
"sidebar.docs.category.Client Libraries": {
43+
"message": "客户端库",
44+
"description": "The label for category Client Libraries in sidebar docs"
45+
},
46+
"sidebar.docs.category.Administration": {
47+
"message": "运维管理",
48+
"description": "The label for category Operations in sidebar docs"
49+
},
50+
"sidebar.docs.category.Authentication": {
51+
"message": "鉴权",
52+
"description": "The label for category Authentication in sidebar docs"
53+
},
54+
"sidebar.docs.category.Deployments & Administration": {
55+
"message": "运维部署及管理",
56+
"description": "The label for category Deployments & Administration in sidebar docs"
57+
},
58+
"sidebar.docs.category.Write-Ahead Logging (WAL)": {
59+
"message": "预写日志(WAL)",
60+
"description": "The label for category Write-Ahead Logging (WAL) in sidebar docs"
61+
},
62+
"sidebar.docs.category.Performance Tuning": {
63+
"message": "性能调优",
64+
"description": "The label for category Performance Tuning in sidebar docs"
65+
},
66+
"sidebar.docs.category.Deployments": {
67+
"message": "部署",
68+
"description": "The label for category Deployments in sidebar docs"
69+
},
70+
"sidebar.docs.category.Deploy on Kubernetes": {
71+
"message": "部署到 Kubernetes",
72+
"description": "The label for category Deploy on Kubernetes in sidebar docs"
73+
},
74+
"sidebar.docs.category.Manage GreptimeDB Operator": {
75+
"message": "管理 GreptimeDB Operator",
76+
"description": "The label for category Deploy on Kubernetes in sidebar docs"
77+
},
78+
"sidebar.docs.category.Disaster Recovery": {
79+
"message": "灾难恢复",
80+
"description": "The label for category Disaster Recovery in sidebar docs"
81+
},
82+
"sidebar.docs.category.Elasticsearch Compatibility": {
83+
"message": "Elasticsearch 兼容性",
84+
"description": "The label for category Elasticsearch Compatibility in sidebar docs"
85+
},
86+
"sidebar.docs.category.Remote WAL": {
87+
"message": "Remote WAL",
88+
"description": "The label for category Remote WAL in sidebar docs"
89+
},
90+
"sidebar.docs.category.GreptimeCloud": {
91+
"message": "GreptimeCloud",
92+
"description": "The label for category GreptimeCloud in sidebar docs"
93+
},
94+
"sidebar.docs.category.Integrations": {
95+
"message": "集成",
96+
"description": "The label for category Integrations in sidebar docs"
97+
},
98+
"sidebar.docs.category.Prometheus": {
99+
"message": "Prometheus",
100+
"description": "The label for category Prometheus in sidebar docs"
101+
},
102+
"sidebar.docs.category.SDK Libraries": {
103+
"message": "SDK Libraries",
104+
"description": "The label for category SDK Libraries in sidebar docs"
105+
},
106+
"sidebar.docs.category.Migrate to GreptimeCloud": {
107+
"message": "迁移到 GreptimeCloud",
108+
"description": "The label for category Migrate to GreptimeCloud in sidebar docs"
109+
},
110+
"sidebar.docs.category.Usage & Billing": {
111+
"message": "用量及费用",
112+
"description": "The label for category Usage & Billing in sidebar docs"
113+
},
114+
"sidebar.docs.category.Tutorials": {
115+
"message": "教程",
116+
"description": "The label for category Tutorials in sidebar docs"
117+
},
118+
"sidebar.docs.category.GreptimeDB Enterprise": {
119+
"message": "GreptimeDB 企业版",
120+
"description": "The label for category GreptimeDB Enterprise in sidebar docs"
121+
},
122+
"sidebar.docs.category.Reference": {
123+
"message": "参考手册",
124+
"description": "The label for category Reference in sidebar docs"
125+
},
126+
"sidebar.docs.category.GreptimeDB Command Line Interface": {
127+
"message": "GreptimeDB 命令行工具",
128+
"description": "The label for category GreptimeDB Command Line Interface in sidebar docs"
129+
},
130+
"sidebar.docs.category.Utilities": {
131+
"message": "实用工具",
132+
"description": "The label for category Utilities in sidebar docs"
133+
},
134+
"sidebar.docs.category.SQL": {
135+
"message": "SQL",
136+
"description": "The label for category SQL in sidebar docs"
137+
},
138+
"sidebar.docs.category.Functions": {
139+
"message": "Functions",
140+
"description": "The label for category Functions in sidebar docs"
141+
},
142+
"sidebar.docs.category.Information Schema": {
143+
"message": "Information Schema",
144+
"description": "The label for category Information Schema in sidebar docs"
145+
},
146+
"sidebar.docs.category.Contributor Guide": {
147+
"message": "贡献者指南",
148+
"description": "The label for category Contributor Guide in sidebar docs"
149+
},
150+
"sidebar.docs.category.Frontend": {
151+
"message": "Frontend",
152+
"description": "The label for category Frontend in sidebar docs"
153+
},
154+
"sidebar.docs.category.Datanode": {
155+
"message": "Datanode",
156+
"description": "The label for category Datanode in sidebar docs"
157+
},
158+
"sidebar.docs.category.Metasrv": {
159+
"message": "Metasrv",
160+
"description": "The label for category Metasrv in sidebar docs"
161+
},
162+
"sidebar.docs.category.Flownode": {
163+
"message": "Flownode",
164+
"description": "The label for category Flownode in sidebar docs"
165+
},
166+
"sidebar.docs.category.Tests": {
167+
"message": "测试",
168+
"description": "The label for category Tests in sidebar docs"
169+
},
170+
"sidebar.docs.category.How To": {
171+
"message": "指南",
172+
"description": "The label for category How To in sidebar docs"
173+
},
174+
"sidebar.docs.category.FAQ and Others": {
175+
"message": "常见问题及其他",
176+
"description": "The label for category FAQ and Others in sidebar docs"
177+
},
178+
"sidebar.docs.category.Release Notes": {
179+
"message": "发版说明",
180+
"description": "The label for link Release Notes in sidebar docs, linking to /release-notes"
181+
},
182+
"sidebar.docs.link.Releases": {
183+
"message": "版本列表",
184+
"description": "The label for link Release Notes in sidebar docs, linking to /release-notes"
185+
},
186+
"sidebar.docs.category.Ingest Data": {
187+
"message": "写入数据",
188+
"description": "The label for category Ingest Data in sidebar docs"
189+
},
190+
"sidebar.docs.category.For observability": {
191+
"message": "可观测场景",
192+
"description": "The label for category For observability in sidebar docs"
193+
},
194+
"sidebar.docs.category.For IoT": {
195+
"message": "物联网(IoT)场景",
196+
"description": "The label for category For IoT in sidebar docs"
197+
},
198+
"sidebar.docs.category.gRPC SDKs": {
199+
"message": "gRPC SDKs",
200+
"description": "The label for category gRPC SDKs in sidebar docs"
201+
},
202+
"sidebar.docs.category.Manage Data": {
203+
"message": "管理数据",
204+
"description": "The label for category Manage Data in sidebar docs"
205+
},
206+
"sidebar.docs.category.Manage Metadata": {
207+
"message": "管理元数据",
208+
"description": "The label for category Manage Metadata in sidebar docs"
209+
},
210+
"sidebar.docs.category.Protocols": {
211+
"message": "协议",
212+
"description": "The label for category Manage Data in sidebar docs"
213+
},
214+
"sidebar.docs.category.Monitoring": {
215+
"message": "监控",
216+
"description": "The label for category Monitoring in sidebar docs"
217+
},
218+
"sidebar.docs.category.Maintenance": {
219+
"message": "维护",
220+
"description": "The label for category Maintenance in sidebar docs"
221+
},
222+
"sidebar.docs.category.Vector Storage": {
223+
"message": "向量存储",
224+
"description": "The label for category Vector Storage in sidebar docs"
225+
},
226+
"sidebar.docs.category.Read Replicas": {
227+
"message": "读副本",
228+
"description": "The label for category Read Replicas in sidebar docs"
229+
}
230+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
keywords: [数据持久化, 索引机制, SST 文件, 倒排索引]
3+
description: 介绍了 GreptimeDB 的数据持久化和索引机制,包括 SST 文件格式、数据持久化过程和倒排索引的实现。
4+
---
5+
6+
# 数据持久化与索引
7+
8+
与所有类似 LSMT 的存储引擎一样,MemTables 中的数据被持久化到耐久性存储,例如本地磁盘文件系统或对象存储服务。GreptimeDB 采用 [Apache Parquet][1] 作为其持久文件格式。
9+
10+
## SST 文件格式
11+
12+
Parquet 是一种提供快速数据查询的开源列式存储格式,已经被许多项目采用,例如 Delta Lake。
13+
14+
Parquet 具有层次结构,类似于“行组 - 列-数据页”。Parquet 文件中的数据被水平分区为行组(row group),在其中相同列的所有值一起存储以形成数据页(data pages)。数据页是最小的存储单元。这种结构极大地提高了性能。
15+
16+
首先,数据按列聚集,这使得文件扫描更加高效,特别是当查询只涉及少数列时,这在分析系统中非常常见。
17+
18+
其次,相同列的数据往往是同质的(比如具备近似的值),这有助于在采用字典和 Run-Length Encoding(RLE)等技术进行压缩。
19+
20+
<img src="/parquet-file-format.png" alt="Parquet file format" width="500"/>
21+
22+
## 数据持久化
23+
24+
GreptimeDB 提供了 `storage.flush.global_write_buffer_size` 的配置项来设置全局的 Memtable 大小阈值。当数据库所有 MemTable 中的数据量之和达到阈值时将自动触发持久化操作,将 MemTable 的数据 flush 到 SST 文件中。
25+
26+
27+
## SST 文件中的索引数据
28+
29+
Apache Parquet 文件格式在列块和数据页的头部提供了内置的统计信息,用于剪枝和跳过。
30+
31+
<img src="/column-chunk-header.png" alt="Column chunk header" width="350"/>
32+
33+
例如,在上述 Parquet 文件中,如果你想要过滤 `name` 等于 `Emily` 的行,你可以轻松跳过行组 0,因为 `name` 字段的最大值是 `Charlie`。这些统计信息减少了 IO 操作。
34+
35+
36+
## 索引文件
37+
38+
对于每个 SST 文件,GreptimeDB 不但维护 SST 文件内部索引,还会单独生成一个文件用于存储针对该 SST 文件的索引结构。
39+
40+
索引文件采用 [Puffin][3] 格式,这种格式具有较大的灵活性,能够存储更多的元数据,并支持更多的索引结构。
41+
42+
![Puffin](/puffin.png)
43+
44+
目前,倒排索引是 GreptimeDB 第一个支持的单独索引结构,以 Blob 的形式存储在索引文件中。
45+
46+
47+
## 倒排索引
48+
49+
在 v0.7 版本中,GreptimeDB 引入了倒排索引(Inverted Index)来加速查询。
50+
51+
倒排索引是一种常见的用于全文搜索的索引结构,它将文档中的每个单词映射到包含该单词的文档列表,GreptimeDB 把这项源自于搜索引擎的技术应用到了时间序列数据库中。
52+
53+
搜索引擎和时间序列数据库虽然运行在不同的领域,但是应用的倒排索引技术背后的原理是相似的。这种相似性需要一些概念上的调整:
54+
1. 单词:在 GreptimeDB 中,指时间线的列值。
55+
2. 文档:在 GreptimeDB 中,指包含多个时间线的数据段。
56+
57+
倒排索引的引入,使得 GreptimeDB 可以跳过不符合查询条件的数据段,从而提高扫描效率。
58+
59+
![Inverted index searching](/inverted-index-searching.png)
60+
61+
例如,上述查询使用倒排索引来定位数据段,数据段满足条件:`job` 等于 `apiserver``handler` 符合正则匹配 `.*users``status` 符合正则匹配 `4..`,然后扫描这些数据段以产生满足所有条件的最终结果,从而显着减少 IO 操作的次数。
62+
63+
### 倒排索引格式
64+
65+
![Inverted index format](/inverted-index-format.png)
66+
67+
GreptimeDB 按列构建倒排索引,每个倒排索引包含一个 FST 和多个 Bitmap。
68+
69+
FST(Finite State Transducer)允许 GreptimeDB 以紧凑的格式存储列值到 Bitmap 位置的映射,并且提供了优秀的搜索性能和支持复杂搜索(例如正则表达式匹配);Bitmap 则维护了数据段 ID 列表,每个位表示一个数据段。
70+
71+
72+
### 索引数据段
73+
74+
GreptimeDB 把一个 SST 文件分割成多个索引数据段,每个数据段包含相同行数的数据。这种分段的目的是通过只扫描符合查询条件的数据段来优化查询性能。
75+
76+
例如,当数据段的行数为 1024,如果查询条件应用倒排索引后,得到的数据段列表为 `[0, 2]`,那么只需扫描 SST 文件中的第 0 和第 2 个数据段(即第 0 行到第 1023 行和第 2048 行到第 3071 行)即可。
77+
78+
数据段的行数由引擎选项 `index.inverted_index.segment_row_count` 控制,默认为 `1024`。较小的值意味着更精确的索引,往往会得到更好的查询性能,但会增加索引存储成本。通过调整该选项,可以在存储成本和查询性能之间进行权衡。
79+
80+
81+
## 统一数据访问层:OpenDAL
82+
83+
GreptimeDB 使用 [OpenDAL][2] 提供统一的数据访问层,因此,存储引擎无需与不同的存储 API 交互,数据可以无缝迁移到基于云的存储,如 AWS S3。
84+
85+
[1]: https://parquet.apache.org
86+
[2]: https://github.com/datafuselabs/opendal
87+
[3]: https://iceberg.apache.org/puffin-spec
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
keywords: [Metric 引擎, 逻辑表, 物理表, DDL 操作]
3+
description: 介绍了 Metric 引擎的概念、架构及设计,重点描述了逻辑表与物理表的区别和批量 DDL 操作的实现。
4+
---
5+
6+
# Metric 引擎
7+
8+
## 概述
9+
10+
`Metric` 引擎是 GreptimeDB 的一个组件,属于存储引擎的一种实现,主要针对可观测 metrics 等存在大量小表的场景。
11+
12+
它的主要特点是利用合成的物理宽表来存储大量的小表数据,实现相同列复用和元数据复用等效果,从而达到减少小表的存储开销以及提高列式压缩效率等目标。表这一概念在 `Metric` 引擎下变得更更加轻量。
13+
14+
## 概念
15+
16+
`Metric` 引擎引入了两个新的概念,分别是逻辑表与物理表。从用户视角看,逻辑表与普通表完全一样。从存储视角看,物理 Region 就是一个普通的 Region。
17+
18+
### 逻辑表
19+
逻辑表,即用户定义的表。与普通的表都完全一样,逻辑表的定义包括表的名称、列的定义、索引的定义等。用户的查询、写入等操作都是基于逻辑表进行的。用户在使用过程中不需要关心逻辑表和普通表的区别。
20+
21+
从实现层面来说,逻辑表是一个虚拟的表,它并不直接读写物理的数据,而是通过将读写请求映射成对应物理表的请求来实现数据的存储与查询。
22+
23+
### 物理表
24+
物理表是真实存储数据的表,它拥有若干个由分区规则定义的物理 Region。
25+
26+
## 架构及设计
27+
28+
`Metric` 引擎的主要设计架构如下:
29+
30+
![Arch](/metric-engine-arch.png)
31+
32+
在目前版本的实现中,`Metric` 引擎复用了 `Mito` 引擎来实现物理数据的存储及查询能力,并在此之上同时提供物理表与逻辑表的访问能力。
33+
34+
在分区方面,逻辑表拥有与物理表完全一致的分区规则及 Region 分布。这是非常自然的,因为逻辑表的数据直接存储在物理表中,所以分区规则也是一致的。
35+
36+
在路由元数据方面,逻辑表的路由地址为逻辑地址,即该逻辑表所对应的物理表是什么,而后通过该物理表进行二次路由取得真正的物理地址。这一间接路由方式能够显著减少 `Metric` 引擎的 Region 发生迁移调度时所需要修改的元数据数量。
37+
38+
在操作方面,`Metric` 引擎仅对物理表的操作进行了有限的支持以防止误操作,例如通过禁止写入物理表、删除物理表等操作防止影响用户逻辑表的数据。总体上可以认为物理表是对用户只读的。
39+
40+
为了提升对大量表同时进行 DDL(Data Definition Language,数据操作语言)操作时性能,如 Prometheus Remote Write 冷启动时大量 metrics 带来的自动建表请求,以及前面提到的迁移物理 Region 时大量路由表的修改请求等,`Metric` 引擎引入了一些批量 DDL 操作。这些批量 DDL 操作能够将大量的 DDL 操作合并成一个请求,从而减少了元数据的查询及修改次数,提升了性能。
41+
42+
除了物理表的物理数据 Region 之外,`Metric` 引擎还额外为每一个物理数据 Region 创建了一个物理的元数据 Region,用于存储 `Metric` 引擎自身为了维护映射等状态所需要的一些元数据。这些元数据包括逻辑表与物理表的映射关系,逻辑列与物理列的映射关系等等。
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
keywords: [Datanode, gRPC 服务, HTTP 服务, Heartbeat Task, Region Manager]
3+
description: 介绍了 Datanode 的主要职责和组件,包括 gRPC 服务、HTTP 服务、Heartbeat Task 和 Region Manager。
4+
---
5+
6+
# Datanode
7+
8+
## Introduction
9+
10+
`Datanode` 主要的职责是为 GreptimeDB 存储数据,我们知道在 GreptimeDB 中一个 `table` 可以有一个或者多个 `Region`,
11+
`Datanode` 的职责便是管理这些 `Region` 的读写。`Datanode` 不感知 `table`,可以认为它是一个 `region server`
12+
所以 `Frontend``Metasrv` 按照 `Region` 粒度来操作 `Datanode`
13+
14+
![Datanode](/datanode.png)
15+
16+
## Components
17+
18+
一个 datanode 包含了 region server 所需的全部组件。这里列出了比较重要的部分:
19+
20+
- 一个 gRPC 服务来提供对 `Region` 数据的读写,`Frontend` 便是使用这个服务来从 `Datanode` 读写数据。
21+
- 一个 HTTP 服务,可以通过它来获得当前节点的 metrics、配置信息等
22+
- `Heartbeat Task` 用来向 `Metasrv` 发送心跳,心跳在 GreptimeDB 的分布式架构中发挥着至关重要的作用,
23+
是分布式协调和调度的基础通信通道,心跳的上行消息中包含了重要信息比如 `Region` 的负载,如果 `Metasrv` 做出了调度
24+
决定(比如 Region 转移),它会通过心跳的下行消息发送指令到 `Datanode`
25+
- `Datanode` 不包含物理规划器(Physical planner)、优化器(optimizer)等组件(这些被放置在 `Frontend` 中),用户对
26+
一个或多个 `Table` 的查询请求会在 `Frontend` 中被转换为 `Region` 的查询请求,`Datanode` 负责处理这些 `Region` 查询请求
27+
- 一个 `Region Manager` 用来管理 `Datanode` 上的所有 `Region`s
28+
- GreptimeDB 支持可插拔的多引擎架构,目前已有的 engine 包括 `File Engine``Mito Engine`

0 commit comments

Comments
 (0)