Skip to content

Commit 4300ddf

Browse files
authored
Merge branch 'main' into migrate-from-dbs
2 parents df635bc + 2777110 commit 4300ddf

File tree

8 files changed

+327
-33
lines changed

8 files changed

+327
-33
lines changed

docs/cn/guides/20-cloud/10-using-databend-cloud/01-warehouses.md

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PlaySVG from '@site/static/img/icon/play.svg'
66
import SuspendSVG from '@site/static/img/icon/suspend.svg'
77
import CheckboxSVG from '@site/static/img/icon/checkbox.svg'
88
import EllipsisSVG from '@site/static/img/icon/ellipsis.svg'
9-
import { Button } from 'antd'
9+
import { Button } from 'antd'
1010

1111
计算集群是 Databend Cloud 的核心组件。一个计算集群代表一组包括 CPU、内存和本地缓存的计算资源。您必须运行一个计算集群来执行 SQL 任务,例如:
1212

@@ -20,14 +20,14 @@ import { Button } from 'antd'
2020

2121
在 Databend Cloud 中,计算集群有多种大小,每种大小由其可以处理的最大并发查询数量定义。创建计算集群时,您可以从以下大小中选择:
2222

23-
| 大小 | 最大并发数 | 推荐使用场景 |
24-
|-----------------------|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
25-
| XSmall | 2 | 最适合用于测试或运行轻量级查询等简单任务。适用于小型数据集(约 50GB)。 |
26-
| Small | 4 | 非常适合运行常规报告和中等负载。适用于中等大小的数据集(约 200GB)。 |
27-
| Medium | 8 | 适合处理更复杂查询和高并发的团队。适用于较大的数据集(约 1TB)。 |
28-
| Large | 16 | 非常适合运行许多并发查询的组织。适用于大型数据集(约 5TB)。 |
29-
| XLarge | 32 | 为企业级高并发工作负载构建。适用于非常大的数据集(超过 10TB)。 |
30-
| 多集群扩展 | 最多无限 | 根据工作负载需求自动扩展和缩减,提供最经济高效的方式来根据需求提高并发性。 |
23+
| 大小 | 最大并发数 | 推荐使用场景 |
24+
| ---------- | ---------- | -------------------------------------------------------------------------- |
25+
| XSmall | 2 | 最适合用于测试或运行轻量级查询等简单任务。适用于小型数据集(约 50GB)。 |
26+
| Small | 4 | 非常适合运行常规报告和中等负载。适用于中等大小的数据集(约 200GB)。 |
27+
| Medium | 8 | 适合处理更复杂查询和高并发的团队。适用于较大的数据集(约 1TB)。 |
28+
| Large | 16 | 非常适合运行许多并发查询的组织。适用于大型数据集(约 5TB)。 |
29+
| XLarge | 32 | 为企业级高并发工作负载构建。适用于非常大的数据集(超过 10TB)。 |
30+
| 多集群扩展 | 最多无限 | 根据工作负载需求自动扩展和缩减,提供最经济高效的方式来根据需求提高并发性。 |
3131

3232
为了选择合适的计算集群大小,Databend 建议从较小的尺寸开始。较小的计算集群可能比中等或大型计算集群执行 SQL 任务的时间更长。如果您发现查询执行时间过长(例如,几分钟),请考虑升级到中等或大型计算集群以获得更快的查询结果。
3333

@@ -46,39 +46,46 @@ import { Button } from 'antd'
4646

4747
您可以对计算集群执行批量操作,包括批量重启、批量暂停、批量恢复和批量删除。为此,通过在计算集群列表中勾选复选框 <CheckboxSVG/> 选择要进行批量操作的计算集群,然后点击椭圆按钮 <EllipsisSVG/> 以执行所需的操作。
4848

49-
![alt text](../../../../../static/img/cloud/bulk.png)
49+
![alt text](../../../../../static/img/cloud/bulk.gif)
5050

5151
### 最佳实践
5252

5353
为了有效管理您的计算集群并确保最佳性能和成本效益,请考虑以下最佳实践。这些指南将帮助您为各种工作负载和环境调整计算集群的大小、组织和微调:
5454

55-
- **选择合适的大小**
56-
- 对于**开发和测试**,使用较小的计算集群(XSmall、Small)。
57-
- 对于**生产环境**,选择较大的计算集群(Medium、Large、XLarge)。
55+
- **选择合适的大小**
5856

59-
- **分离计算集群**
60-
-**数据加载****查询执行**使用单独的计算集群。
61-
-**开发****测试****生产**环境创建不同的计算集群。
57+
- 对于**开发和测试**,使用较小的计算集群(XSmall、Small)。
58+
- 对于**生产环境**,选择较大的计算集群(Medium、Large、XLarge)。
6259

63-
- **数据加载技巧**
64-
- 较小的计算集群(Small、Medium)适合数据加载。
65-
- 优化文件大小和文件数量以提高性能。
60+
- **分离计算集群**
6661

67-
- **优化成本和性能**
68-
- 避免运行简单的查询,如 `SELECT 1`,以最小化积分使用。
69-
- 使用批量加载(`COPY`)而不是单个 `INSERT` 语句。
70-
- 监控长时间运行的查询并优化它们以提高性能。
62+
-**数据加载****查询执行**使用单独的计算集群。
63+
-**开发****测试****生产**环境创建不同的计算集群。
7164

72-
- **自动暂停**
73-
- 启用自动暂停以在计算集群空闲时节省积分。
65+
- **数据加载技巧**
7466

75-
- **频繁查询时禁用自动暂停**
76-
- 保持计算集群活跃以进行频繁或重复的查询,以保持缓存并避免延迟。
67+
- 较小的计算集群(Small、Medium)适合数据加载。
68+
- 优化文件大小和文件数量以提高性能。
7769

78-
- **使用自动扩展(仅限商业和专属计划)**
79-
- 多集群扩展根据工作负载需求自动调整资源。
70+
- **优化成本和性能**
8071

81-
- **监控和调整使用情况**
72+
- 避免运行简单的查询,如 `SELECT 1`,以最小化积分使用。
73+
- 使用批量加载(`COPY`)而不是单个 `INSERT` 语句。
74+
- 监控长时间运行的查询并优化它们以提高性能。
75+
76+
- **自动暂停**
77+
78+
- 启用自动暂停以在计算集群空闲时节省积分。
79+
80+
- **频繁查询时禁用自动暂停**
81+
82+
- 保持计算集群活跃以进行频繁或重复的查询,以保持缓存并避免延迟。
83+
84+
- **使用自动扩展(仅限商业和专属计划)**
85+
86+
- 多集群扩展根据工作负载需求自动调整资源。
87+
88+
- **监控和调整使用情况**
8289
- 定期审查计算集群使用情况并根据需要调整大小以平衡成本和性能。
8390

8491
## 计算集群访问控制
@@ -137,4 +144,4 @@ Databend Cloud 允许您通过为计算集群分配特定角色来管理计算
137144

138145
1. 点击 **概览** 页面上的 **连接**
139146
2. 选择您希望连接的数据库和计算集群。连接信息将根据您的选择更新。
140-
3. 连接详细信息包括一个名为 `cloudapp` 的 SQL 用户,其密码是随机生成的。Databend Cloud 不存储此密码。请务必复制并安全保存。如果您忘记了密码,请点击 **重置** 以生成一个新密码。
147+
3. 连接详细信息包括一个名为 `cloudapp` 的 SQL 用户,其密码是随机生成的。Databend Cloud 不存储此密码。请务必复制并安全保存。如果您忘记了密码,请点击 **重置** 以生成一个新密码。

docs/en/guides/20-cloud/10-using-databend-cloud/01-warehouses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A suspended warehouse does not consume any credits. You can manually suspend or
4646

4747
You can perform bulk operations on warehouses, including bulk restart, bulk suspend, bulk resume, and bulk delete. To do so, select the warehouses for bulk operations by checking the checkboxes <CheckboxSVG/> in the warehouse list, and then click the ellipse button <EllipsisSVG/> for the desired operation.
4848

49-
![alt text](../../../../../static/img/cloud/bulk.png)
49+
![alt text](../../../../../static/img/cloud/bulk.gif)
5050

5151
### Best Practices
5252

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
---
2+
title: Disaster Recovery
3+
description: Enable Databend to recover from disasters involving the loss of either metadata or data.
4+
---
5+
6+
- RFC PR: [databendlabs/databend-docs#1546](https://github.com/databendlabs/databend-docs/pull/1546)
7+
- Tracking Issue: [datafuselabs/databend#17234](https://github.com/databendlabs/databend/issues/17234)
8+
9+
## Summary
10+
11+
Enable databend to recover from disasters involving the loss of either metadata or data.
12+
13+
## Motivation
14+
15+
Databend is designed to be highly available and fault-tolerant. Its metadata is served by Databend MetaSrv, which is powered by [OpenRaft](https://github.com/databendlabs/openraft). The data is stored in object storage systems such as S3, GCS, and others, which guarantee 99.99% availability and 99.999999999% durability.
16+
17+
However, it is insufficient for our enterprise users who require a robust disaster recovery plan. These users either have significant needs for cross-continent disaster recovery or must comply with stringent regulatory requirements.
18+
19+
For example, [The Health Insurance Portability and Accountability Act (HIPAA)](https://www.hhs.gov/hipaa/index.html) mandates that healthcare organizations develop and implement contingency plans. Such planning ensures that, in the event of a natural or man-made disaster disrupting operations, the business can continue functioning until regular services are restored.
20+
21+
This RFC proposes a solution to enable Databend to recover from disasters involving the loss of metadata or data.
22+
23+
## Guide-Level Explanation
24+
25+
This RFC introduces the first step toward enabling Databend to recover from disasters, such as metadata or data loss, by providing a robust backup and restore solution. Our proposed product, tentatively named `bendsave`, will allow users to back up and restore both metadata and data efficiently.
26+
27+
*The name of this product is not decided yet, let's call it `bendsave`*
28+
29+
### 1. Backup
30+
31+
Create backups of cluster data and metadata using the `bendsave backup` command. Incremental backups are supported, ensuring that only changes since the last backup are saved. This simplifies daily backups.
32+
33+
Example:
34+
35+
```shell
36+
bendsave backup --from /path/to/query-node-1.toml --to s3://backup/
37+
```
38+
39+
Key Points:
40+
- Metadata and data are stored in the backup location.
41+
- Enables complete cluster recovery, even in cases of total failure.
42+
43+
### 2. List Backups
44+
45+
To view all backups stored in a specified location, use the `bendsave list` command.
46+
47+
Example:
48+
49+
```shell
50+
bendsave list s3://backup/
51+
```
52+
53+
### 3. Restore
54+
55+
Restore a Databend cluster from a backup using the `bendsave restore` command. By default, this operates in dry-run mode to prevent accidental restoration. For automatic restoration, use the `--confirm` flag.
56+
57+
Example:
58+
59+
```shell
60+
# Dry-run mode (default)
61+
bendsave restore --from s3://backup/path/to/backup/manifest --to /path/to/query-node-1.toml
62+
63+
# Perform the restoration immediately
64+
bendsave restore --from s3://backup/path/to/backup/manifest --to /path/to/query-node-1.toml --confirm
65+
```
66+
67+
### 4. Vacuum
68+
69+
Manage backup retention using the `bendsave vacuum` command. This ensures backups adhere to your retention policies by removing old or unnecessary backups.
70+
71+
Example:
72+
73+
```shell
74+
bendsave vacuum s3://backup \
75+
--retention-days 30 \
76+
--min-retention-days 7 \
77+
--max-backups 5 \
78+
--min-backups 2
79+
```
80+
81+
The `bendsave` tool will provide a simple yet powerful way to secure Databend clusters through backup and restore operations. With features like incremental backups, dry-run restore mode, and vacuum-based retention management, it offers users control and reliability in disaster recovery scenarios.
82+
83+
## Reference-level explanation
84+
85+
`bendsave` will introduce an `BackupManifest` in which stores the following things:
86+
87+
- metadata of given backup: like backup time, backup location, backup type (full or incremental), etc.
88+
- the locations of metadata backup: the locations which points to the metadata backup.
89+
- the locations of data backup: the locations which contains all table data.
90+
91+
```rust
92+
struct BackupManifest {
93+
backup_meta: BackupMeta,
94+
95+
metasrv: BackupFile,
96+
storage: Vec<BackupFile>,
97+
...
98+
}
99+
100+
struct BackupMeta {
101+
backup_time: DateTime<Utc>,
102+
...
103+
}
104+
105+
struct BackupFile {
106+
blocks: Vec<Block>,
107+
etag: String,
108+
}
109+
110+
struct BackupBlock {
111+
block_id: String,
112+
block_size: u64,
113+
...
114+
}
115+
```
116+
117+
The `BackupManifest` will be encoded by protobuf and stored inside backup storage along with the backup metadata and data.
118+
119+
The protobuf definition of `BackupManifest` will be versioned to ensure both backward and forward compatibility. This will enable Databend Query to restore backups created using different versions of Databend.
120+
121+
### Backup Storage Layout
122+
123+
The backup storage layout will be as follows:
124+
125+
```
126+
s3://backup/bendsave.md
127+
s3://backup/manifests/20250114_201500.manifest
128+
s3://backup/manifests/20250115_201500.manifest
129+
s3://backup/manifests/20250116_201500.manifest
130+
s3://backup/data/<block_id_0>
131+
s3://backup/data/<block_id_1>
132+
s3://backup/data/<block_id_....>
133+
s3://backup/data/<block_id_N>
134+
```
135+
136+
- `bendsave.md` serves as a quick reference guide to help users understand backup storage and recover the cluster.
137+
- Each manifest in the `manifests/` directory includes everything needed to restore the cluster.
138+
- The `data/` directory stores all the data blocks. Bendsave splits the source data into fixed-size blocks (e.g., 8 MiB) and uses their SHA-256 checksum as the block ID.
139+
140+
### Backup Process
141+
142+
- Export all metasrv data and save it to the backup storage.
143+
- Enumerate the source backend storage services to create a `BackupManifest` file.
144+
- Copy all data files to the backup storage.
145+
146+
For incremental backups, Databend examines the existing `BackupManifest` file and transfers only the modified data files to the backup storage, along with a new `BackupManifest` file.
147+
148+
For example:
149+
150+
The first time users perform a backup like:
151+
152+
```shell
153+
bendsave backup --from /path/to/query-node-1.toml --to s3://backup/
154+
```
155+
156+
they will see the following files created:
157+
158+
```shell
159+
s3://backup/bendsave.md
160+
s3://backup/manifests/20250114_201500.manifest
161+
s3://backup/data/<sha256_of_block_0>
162+
s3://backup/data/<sha256_of_block_1>
163+
s3://backup/data/<sha256_of_block_....>
164+
s3://backup/data/<sha256_of_block_N>
165+
```
166+
167+
The second time users perform a backup, bendsave will generate the following files and omit existing blocks:
168+
169+
```shell
170+
s3://backup/bendsave.md
171+
s3://backup/manifests/20250114_201500.manifest
172+
s3://backup/manifests/20250115_201500.manifest
173+
s3://backup/data/<sha256_of_block_0>
174+
s3://backup/data/<sha256_of_block_1>
175+
s3://backup/data/<sha256_of_block_....>
176+
s3://backup/data/<sha256_of_block_N>
177+
s3://backup/data/<sha256_of_block_....>
178+
s3://backup/data/<sha256_of_block_M>
179+
```
180+
181+
The block id is generated by the SHA-256 checksum of the block content. So we can reuse the same block if it has been backed up before.
182+
183+
### Restore Process
184+
185+
- Read the `BackupManifest` file from the backup storage.
186+
- Copies all related data files to their original location.
187+
- Read the backed up metasrv data and import into new metasrv cluster.
188+
189+
Please note that the restore process will overwrite the entire MetaSrv cluster. All existing metadata in the backup target MetaSrv cluster will be permanently lost.
190+
191+
Users can restore from a backup using the following command:
192+
193+
```shell
194+
bendsave restore --from s3://backup/manifests/20250114_201500.manifest --to /path/to/query-node-1.toml
195+
```
196+
197+
Users can also restore incrementally by specifying the latest manifest file:
198+
199+
```shell
200+
bendsave restore --from s3://backup/manifests/20250115_201500.manifest --to /path/to/query-node-1.toml
201+
```
202+
203+
## Drawbacks
204+
205+
None.
206+
207+
## Rationale and alternatives
208+
209+
None.
210+
211+
## Prior art
212+
213+
### Databricks Clone
214+
215+
Databricks allows users to perform shadow and deep cloning of a table.
216+
217+
For example:
218+
219+
Use clone for data archiving
220+
221+
```sql
222+
CREATE OR REPLACE TABLE archive_table CLONE my_prod_table;
223+
```
224+
225+
Or use clone for short-term experiments on a production table
226+
227+
```sql
228+
-- Perform shallow clone
229+
CREATE OR REPLACE TABLE my_test SHALLOW CLONE my_prod_table;
230+
231+
UPDATE my_test WHERE user_id is null SET invalid=true;
232+
-- Run a bunch of validations. Once happy:
233+
234+
-- This should leverage the update information in the clone to prune to only
235+
-- changed files in the clone if possible
236+
MERGE INTO my_prod_table
237+
USING my_test
238+
ON my_test.user_id <=> my_prod_table.user_id
239+
WHEN MATCHED AND my_test.user_id is null THEN UPDATE *;
240+
241+
DROP TABLE my_test;
242+
```
243+
244+
## Unresolved questions
245+
246+
None.
247+
248+
## Future possibilities
249+
250+
### Replication
251+
252+
In the future, we could extend the backup and restore functionality to support replication. This would allow users to replicate databases or tables across different databend clusters for disaster recovery or data distribution purposes.
253+
254+
Databend can also implement a warm standby to ensure high availability and fault tolerance.

docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const config: Config = {
115115
"docusaurus-plugin-sass",
116116
"./src/plugins/global-sass-var-inject",
117117
"./src/plugins/fetch-databend-releases",
118+
"./src/plugins/gurubase-widget",
118119
[
119120
"@docusaurus/plugin-content-docs",
120121
/** @type {import('@docusaurus/plugin-content-docs').Options} */

lychee.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ exclude = [
102102
'https://singup.snowflake.com/',
103103
'https://www.uber.com/',
104104
'https://www.cse.iitb.ac.in/infolab/Data/Courses/CS632/Papers/Cascades-graefe.pdf',
105-
'^https://repo\.databend\.com/databend/'
105+
'^https://repo\.databend\.com/databend/',
106+
'https://www.hhs.gov',
106107
]
107108

108109
# URLs to check (supports regex). Has preference over all excludes.

0 commit comments

Comments
 (0)