Skip to content

Commit 4e72494

Browse files
authored
add dumpling-lightning-job (#2732) (#2750)
1 parent 432cc64 commit 4e72494

11 files changed

+945
-17
lines changed

zh/TOC.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,24 @@
6161
- [备份与恢复 CR 介绍](backup-restore-cr.md)
6262
- [远程存储访问授权](grant-permissions-to-remote-storage.md)
6363
- 使用 Amazon S3 兼容的存储
64-
- [使用 BR 备份 TiDB 集群数据到兼容 S3 的存储](backup-to-aws-s3-using-br.md)
65-
- [使用 BR 恢复 S3 兼容存储上的备份数据](restore-from-aws-s3-using-br.md)
66-
- [使用 Dumpling 备份 TiDB 集群数据到兼容 S3 的存储](backup-to-s3.md)
67-
- [使用 TiDB Lightning 恢复 S3 兼容存储上的备份数据](restore-from-s3.md)
64+
- [使用 BR 备份 TiDB 集群数据到兼容 Amazon S3 的存储](backup-to-aws-s3-using-br.md)
65+
- [使用 BR 恢复 Amazon S3 兼容存储上的备份数据](restore-from-aws-s3-using-br.md)
66+
- [使用 Dumpling 备份 TiDB 集群数据到兼容 Amazon S3 的存储](backup-to-s3-using-job.md)
67+
- [使用 TiDB Lightning 恢复 Amazon S3 兼容存储上的备份数据](restore-from-s3-using-job.md)
68+
- [使用 Dumpling 备份 TiDB 集群数据到兼容 Amazon S3 的存储(已弃用)](backup-to-s3.md)
69+
- [使用 TiDB Lightning 恢复 Amazon S3 兼容存储上的备份数据(已弃用)](restore-from-s3.md)
6870
- 使用 Google Cloud Storage
6971
- [使用 BR 备份 TiDB 集群数据到 GCS](backup-to-gcs-using-br.md)
7072
- [使用 BR 恢复 GCS 上的备份数据](restore-from-gcs-using-br.md)
71-
- [使用 Dumpling 备份 TiDB 集群数据到 GCS](backup-to-gcs.md)
72-
- [使用 TiDB Lightning 恢复 GCS 上的备份数据](restore-from-gcs.md)
73+
- [使用 Dumpling 备份 TiDB 集群数据到 GCS](backup-to-gcs-using-job.md)
74+
- [使用 TiDB Lightning 恢复 GCS 上的备份数据](restore-from-gcs-using-job.md)
75+
- [使用 Dumpling 备份 TiDB 集群数据到 GCS(已弃用)](backup-to-gcs.md)
76+
- [使用 TiDB Lightning 恢复 GCS 上的备份数据(已弃用)](restore-from-gcs.md)
7377
- 使用 Azure Blob Storage
74-
- [使用 BR 备份 TiDB 集群数据到 Azblob](backup-to-azblob-using-br.md)
75-
- [使用 BR 恢复 Azblob 上的备份数据](restore-from-azblob-using-br.md)
78+
- [使用 BR 备份 TiDB 集群数据到 Azure Blob Storage](backup-to-azblob-using-br.md)
79+
- [使用 BR 恢复 Azure Blob Storage 上的备份数据](restore-from-azblob-using-br.md)
80+
- [使用 Dumpling 备份 TiDB 集群数据到 Azure Blob Storage](backup-to-blob-using-job.md)
81+
- [使用 TiDB Lightning 恢复 Azure Blob Storage 的备份数据](restore-from-blob-using-job.md)
7682
- 使用持久卷
7783
- [使用 BR 备份 TiDB 集群数据到持久卷](backup-to-pv-using-br.md)
7884
- [使用 BR 恢复持久卷上的备份数据](restore-from-pv-using-br.md)

zh/backup-to-blob-using-job.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
title: 使用 Dumpling 备份 TiDB 数据到 Azure Blob Storage
3+
summary: 本文介绍如何使用 Dumpling 将 TiDB 集群数据备份到 Azure Blob Storage。
4+
---
5+
6+
# 使用 Dumpling 备份 TiDB 数据到 Azure Blob Storage
7+
8+
本文档介绍如何使用 [Dumpling](https://docs.pingcap.com/zh/tidb/stable/dumpling-overview/) 将部署在 Azure AKS 上的 TiDB 集群数据备份到 Azure Blob Storage。Dumpling 是一款数据导出工具,可将 TiDB 或 MySQL 中的数据导出为 SQL 或 CSV 格式,用于全量数据备份或导出。
9+
10+
## 准备 Dumpling 节点池
11+
12+
你可以在现有节点池中运行 Dumpling,也可以创建一个专用节点池。以下命令示例展示了如何创建一个新的节点池。使用前,请根据实际情况替换以下变量:
13+
14+
- `${clusterName}`:AKS 集群名称
15+
- `${resourceGroup}`:资源组名称
16+
17+
```shell
18+
az aks nodepool add --name dumpling \
19+
--cluster-name ${clusterName} \
20+
--resource-group ${resourceGroup} \
21+
--zones 1 2 3 \
22+
--node-count 1 \
23+
--labels dedicated=dumpling
24+
```
25+
26+
## 部署 Dumpling Job
27+
28+
本章节介绍如何配置、部署以及监控 Dumpling Job。
29+
30+
### 配置 Dumpling Job
31+
32+
Dumpling Job 的配置文件 (`dumpling_job.yaml`) 示例如下。使用前,请替换以下变量:
33+
34+
- `${name}`:Job 名称
35+
- `${namespace}`:Kubernetes 命名空间
36+
- `${version}`:Dumpling 镜像版本
37+
- Dumpling 的相关参数,请参考 [Dumpling 主要选项表](https://docs.pingcap.com/zh/tidb/stable/dumpling-overview/#dumpling-主要选项表)
38+
39+
```yaml
40+
# dumpling_job.yaml
41+
---
42+
apiVersion: batch/v1
43+
kind: Job
44+
metadata:
45+
name: ${name}
46+
namespace: ${namespace}
47+
labels:
48+
app.kubernetes.io/component: dumpling
49+
spec:
50+
template:
51+
spec:
52+
nodeSelector:
53+
dedicated: dumpling
54+
affinity:
55+
podAntiAffinity:
56+
requiredDuringSchedulingIgnoredDuringExecution:
57+
- labelSelector:
58+
matchExpressions:
59+
- key: app.kubernetes.io/component
60+
operator: In
61+
values:
62+
- dumpling
63+
topologyKey: kubernetes.io/hostname
64+
containers:
65+
- name: ${name}
66+
image: pingcap/dumpling:${version}
67+
command:
68+
- /bin/sh
69+
- -c
70+
- |
71+
/dumpling \
72+
--host=basic-tidb \
73+
--port=4000 \
74+
--user=root \
75+
--password='' \
76+
--s3.region=us-west-2 \
77+
--threads=16 \
78+
--rows=20000 \
79+
--filesize=256MiB \
80+
--database=test \
81+
--filetype=csv \
82+
--output=azure://external/testfolder?account-name=${accountname}&account-key=${accountkey}
83+
restartPolicy: Never
84+
backoffLimit: 0
85+
```
86+
87+
### 创建 Dumpling Job
88+
89+
执行以下命令创建 Dumpling Job:
90+
91+
```shell
92+
export name=dumpling
93+
export version=v8.5.1
94+
export namespace=tidb-cluster
95+
export accountname=<your-account-name>
96+
export accountkey=<your-account-key>
97+
98+
envsubst < dumpling_job.yaml | kubectl apply -f -
99+
```
100+
101+
### 查看 Dumpling Job 状态
102+
103+
运行以下命令查看 Dumpling Job 的 Pod 状态:
104+
105+
```shell
106+
kubectl -n ${namespace} get pod ${name}
107+
```
108+
109+
### 查看 Dumpling Job 日志
110+
111+
运行以下命令查看 Dumpling Job 的日志输出:
112+
113+
```shell
114+
kubectl -n ${namespace} logs pod ${name}
115+
```

zh/backup-to-gcs-using-job.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: 使用 Dumpling 备份 TiDB 数据到 Google Cloud Storage (GCS)
3+
summary: 本文介绍如何使用 Dumpling 将 TiDB 集群数据备份到 Google Cloud Storage (GCS)。
4+
---
5+
6+
# 使用 Dumpling 备份 TiDB 数据到 Google Cloud Storage (GCS)
7+
8+
本文档介绍如何使用 [Dumpling](https://docs.pingcap.com/zh/tidb/stable/dumpling-overview/) 将部署在 Google GKE 上的 TiDB 集群数据备份到 [Google Cloud Storage (GCS)](https://cloud.google.com/storage/docs)。Dumpling 是一款数据导出工具,可将 TiDB 或 MySQL 中的数据导出为 SQL 或 CSV 格式,用于全量数据备份或导出。
9+
10+
## 准备 Dumpling 节点池
11+
12+
你可以在现有节点池中运行 Dumpling,也可以创建一个专用节点池。以下命令示例展示了如何创建一个新的节点池。请根据实际情况替换以下变量:
13+
14+
- `${clusterName}`:GKE 集群名称
15+
16+
```shell
17+
gcloud container node-pools create dumpling \
18+
--cluster ${clusterName} \
19+
--machine-type n2-standard-4 \
20+
--num-nodes=1 \
21+
--node-labels=dedicated=dumpling
22+
```
23+
24+
## 部署 Dumpling Job
25+
26+
### 创建凭证 ConfigMap
27+
28+
将从 Google Cloud Console 下载的 `service account key` 文件保存为 `google-credentials.json`,然后使用以下命令创建 ConfigMap:
29+
30+
```shell
31+
kubectl -n ${namespace} create configmap google-credentials --from-file=google-credentials.json
32+
```
33+
34+
### 配置 Dumpling Job
35+
36+
Dumpling Job 的配置文件 (`dumpling_job.yaml`) 示例如下。使用前,请替换以下变量:
37+
38+
- `${name}`:Job 名称
39+
- `${namespace}`:Kubernetes 命名空间
40+
- `${version}`:Dumpling 镜像版本
41+
- Dumpling 的相关参数,请参考 [Dumpling 主要选项表](https://docs.pingcap.com/zh/tidb/stable/dumpling-overview/#dumpling-主要选项表)
42+
43+
```yaml
44+
# dumpling_job.yaml
45+
---
46+
apiVersion: batch/v1
47+
kind: Job
48+
metadata:
49+
name: ${name}
50+
namespace: ${namespace}
51+
labels:
52+
app.kubernetes.io/component: dumpling
53+
spec:
54+
template:
55+
spec:
56+
nodeSelector:
57+
dedicated: dumpling
58+
affinity:
59+
podAntiAffinity:
60+
requiredDuringSchedulingIgnoredDuringExecution:
61+
- labelSelector:
62+
matchExpressions:
63+
- key: app.kubernetes.io/component
64+
operator: In
65+
values:
66+
- dumpling
67+
topologyKey: kubernetes.io/hostname
68+
containers:
69+
- name: ${name}
70+
image: pingcap/dumpling:${version}
71+
command:
72+
- /bin/sh
73+
- -c
74+
- |
75+
/dumpling \
76+
--host=basic-tidb \
77+
--port=4000 \
78+
--user=root \
79+
--password='' \
80+
--threads=16 \
81+
--rows=20000 \
82+
--filesize=256MiB \
83+
--database=test \
84+
--filetype=csv \
85+
--output=gcs://external/testfolder?credentials-file=/etc/config/google-credentials.json
86+
volumeMounts:
87+
- name: google-credentials
88+
mountPath: /etc/config
89+
volumes:
90+
- name: google-credentials
91+
configMap:
92+
name: google-credentials
93+
restartPolicy: Never
94+
backoffLimit: 0
95+
```
96+
97+
### 创建 Dumpling Job
98+
99+
执行以下命令创建 Dumpling Job:
100+
101+
```shell
102+
export name=dumpling
103+
export version=v8.5.1
104+
export namespace=tidb-cluster
105+
106+
envsubst < dumpling_job.yaml | kubectl apply -f -
107+
```
108+
109+
### 查看 Dumpling Job 状态
110+
111+
运行以下命令查看 Dumpling Job 的 Pod 状态:
112+
113+
```shell
114+
kubectl -n ${namespace} get pod ${name}
115+
```
116+
117+
### 查看 Dumpling Job 日志
118+
119+
运行以下命令查看 Dumpling Job 的日志输出:
120+
121+
```shell
122+
kubectl -n ${namespace} logs pod ${name}
123+
```

zh/backup-to-gcs.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
---
2-
title: 使用 Dumpling 备份 TiDB 集群数据到 GCS
3-
summary: 介绍如何使用 Dumpling 将 TiDB 集群数据备份到 Google Cloud Storage (GCS)。
2+
title: 使用 Dumpling 备份 TiDB 集群数据到 GCS (Helm)
3+
summary: 介绍如何使用 Helm 部署 Dumpling 将 TiDB 集群数据备份到 Google Cloud Storage (GCS)。
4+
aliases: ['/docs-cn/tidb-in-kubernetes/dev/backup-to-gcs/']
45
---
56

6-
# 使用 Dumpling 备份 TiDB 集群数据到 GCS
7+
# 使用 Dumpling 备份 TiDB 集群数据到 GCS (Helm)
8+
9+
> **警告:**
10+
>
11+
> 本文介绍的 Helm 部署方式已弃用,建议使用 [Job 方式](backup-to-gcs-using-job.md)进行备份操作。
712
813
本文档介绍如何将 Kubernetes 上 TiDB 集群的数据备份到 [Google Cloud Storage (GCS)](https://cloud.google.com/storage/docs/) 上。本文档中的“备份”,均是指全量备份(即 Ad-hoc 全量备份和定时全量备份)。
914

0 commit comments

Comments
 (0)