Skip to content

Commit

Permalink
This is an automated cherry-pick of #18520
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
lilin90 authored and ti-chi-bot committed Sep 10, 2024
1 parent 51cb4bc commit d1cf80c
Show file tree
Hide file tree
Showing 38 changed files with 575 additions and 209 deletions.
2 changes: 1 addition & 1 deletion TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- 应用开发
- [概览](/develop/dev-guide-overview.md)
- 快速开始
- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB 的增删改查 SQL](/develop/dev-guide-tidb-crud-sql.md)
- 示例程序
- Java
Expand Down
24 changes: 15 additions & 9 deletions develop/dev-guide-build-cluster-in-cloud.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
---
<<<<<<< HEAD
title: 使用 TiDB Serverless 构建 TiDB 集群
summary: 使用 TiDB Serverless 构建 TiDB 集群,并连接 TiDB Serverless 集群。
=======
title: 使用 TiDB Cloud Serverless 构建 TiDB 集群
summary: 使用 TiDB Cloud Serverless 构建 TiDB 集群,并连接 TiDB Cloud Serverless 集群。
aliases: ['/zh/tidb/dev/build-cluster-in-cloud']
>>>>>>> 476afb307b (*: update TiDB product names (#18520))
---

<!-- markdownlint-disable MD029 -->

# 使用 TiDB Serverless 构建 TiDB 集群
# 使用 TiDB Cloud Serverless 构建 TiDB 集群

本文将介绍如何以最快的方式开始使用 TiDB。你将创建并启动一个 [TiDB Serverless](https://www.pingcap.com/tidb-serverless/) 集群,使用 TiDB SQL 客户端,插入数据。随后将从示例程序读取出数据。
本文将介绍如何以最快的方式开始使用 TiDB。你将创建并启动一个 [TiDB Cloud Serverless](https://www.pingcap.com/tidb-serverless/) 集群,使用 TiDB SQL 客户端,插入数据。随后将从示例程序读取出数据。

若你需要在本地计算机上启动 TiDB,请参阅[本地启动 TiDB](/quick-start-with-tidb.md)

## 第 1 步:创建 TiDB Serverless 集群
## 第 1 步:创建 TiDB Cloud Serverless 集群

1. 如果你还未拥有 TiDB Cloud 账号,请先在此[注册](https://tidbcloud.com/free-trial)
2. 使用你的 TiDB Cloud 账号[登录](https://tidbcloud.com/)

登录后,默认进入 [**Clusters**](https://tidbcloud.com/console/clusters) 页面。

3. 对于新注册的用户,TiDB Cloud 会自动为你创建一个 TiDB Serverless 集群 `Cluster0`。你可以使用这个默认集群进行后续操作,也可以自行创建一个新的 TiDB Serverless 集群。
3. 对于新注册的用户,TiDB Cloud 会自动为你创建一个 TiDB Cloud Serverless 集群 `Cluster0`。你可以使用这个默认集群进行后续操作,也可以自行创建一个新的 TiDB Cloud Serverless 集群。

如果你想创建一个新的 TiDB Serverless 集群,请进行以下操作:
如果你想创建一个新的 TiDB Cloud Serverless 集群,请进行以下操作:

1. 点击 **Create Cluster**
2. **Create Cluster** 页面默认选择 **Serverless**。你可以根据需要修改集群名称、选择可用区,然后点击 **Create**。你的 TiDB Serverless 集群将于 30 秒后创建完毕。
2. **Create Cluster** 页面默认选择 **Serverless**。你可以根据需要修改集群名称、选择可用区,然后点击 **Create**。你的 TiDB Cloud Serverless 集群将于 30 秒后创建完毕。

4. 点击目标集群名称,进入集群概览页面,然后点击右上角的 **Connect** 按钮,弹出连接对话框。

Expand All @@ -33,7 +39,7 @@ summary: 使用 TiDB Serverless 构建 TiDB 集群,并连接 TiDB Serverless

> **注意:**
>
> 在连接到 [TiDB Serverless](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-serverless-beta) 集群时,你需要给用户名加上前缀并使用单引号包裹用户名。你可以在 [TiDB Cloud 用户名前缀](https://docs.pingcap.com/tidbcloud/select-cluster-tier#user-name-prefix) 中获得更多信息。
> 在连接到 [TiDB Cloud Serverless](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-serverless) 集群时,你需要给用户名加上前缀并使用单引号包裹用户名。你可以在 [TiDB Cloud Serverless 用户名前缀](https://docs.pingcap.com/tidbcloud/select-cluster-tier#user-name-prefix) 中获得更多信息。
## 第 2 步:连接到集群

Expand Down Expand Up @@ -116,8 +122,8 @@ summary: 使用 TiDB Serverless 构建 TiDB 集群,并连接 TiDB Serverless

> **注意:**
>
> - 在连接 TiDB Serverless 集群时,[必须使用 TLS 连接](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters)。
> - 如果你在连接时遇到问题,可阅读 [TiDB Serverless 集群安全连接](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters) 来获得更多信息。
> - 在连接 TiDB Cloud Serverless 集群时,[必须使用 TLS 连接](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters)。
> - 如果你在连接时遇到问题,可阅读 [TiDB Cloud Serverless 集群安全连接](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters) 来获得更多信息。

3. 填写密码,完成登录。

Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-create-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ summary: 创建数据库的方法、规范及例子。

在阅读本页面之前,你需要准备以下事项:

- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- 阅读[数据库模式概览](/develop/dev-guide-schema-design-overview.md)

## 什么是数据库
Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-create-secondary-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ summary: 创建二级索引的方法、规范及例子。

在阅读本页面之前,你需要准备以下事项:

- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- 阅读[数据库模式概览](/develop/dev-guide-schema-design-overview.md)
- [创建一个数据库](/develop/dev-guide-create-database.md)
- [创建表](/develop/dev-guide-create-table.md)
Expand Down
4 changes: 2 additions & 2 deletions develop/dev-guide-create-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ summary: 创建表的方法、规范及例子。

在阅读本页面之前,你需要准备以下事项:

- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- 阅读[数据库模式概览](/develop/dev-guide-schema-design-overview.md)
- [创建一个数据库](/develop/dev-guide-create-database.md)

Expand Down Expand Up @@ -262,7 +262,7 @@ ALTER TABLE `bookshop`.`ratings` SET TIFLASH REPLICA 1;

> **注意:**
>
> 如果你的集群,不包含 TiFlash 节点,此 SQL 语句将会报错:`1105 - the tiflash replica count: 1 should be less than the total tiflash server count: 0` 你可以[使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-tidb-serverless-集群) 来创建一个含有 TiFlash 的集群。
> 如果你的集群,不包含 TiFlash 节点,此 SQL 语句将会报错:`1105 - the tiflash replica count: 1 should be less than the total tiflash server count: 0` 你可以[使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-tidb-cloud-serverless-集群) 来创建一个含有 TiFlash 的集群。
随后正常进行查询即可:

Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-delete-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ summary: 删除数据、批量删除数据的方法、最佳实践及例子。

在阅读本页面之前,你需要准备以下事项:

- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- 阅读[数据库模式概览](/develop/dev-guide-schema-design-overview.md),并[创建数据库](/develop/dev-guide-create-database.md)[创建表](/develop/dev-guide-create-table.md)[创建二级索引](/develop/dev-guide-create-secondary-indexes.md)
- 需先[插入数据](/develop/dev-guide-insert-data.md)才可删除。

Expand Down
30 changes: 15 additions & 15 deletions develop/dev-guide-gui-mysql-workbench.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TiDB 是一个兼容 MySQL 的数据库。[MySQL Workbench](https://www.mysql.co

> **注意**
>
> 本文档适用于 TiDB Serverless、TiDB Dedicated 和本地部署的 TiDB。
> 本文档适用于 TiDB Cloud Serverless、TiDB Cloud Dedicated 和本地部署的 TiDB。
## 前置需求

Expand All @@ -27,15 +27,15 @@ TiDB 是一个兼容 MySQL 的数据库。[MySQL Workbench](https://www.mysql.co

**如果你还没有 TiDB 集群,可以按如下方式创建一个:**

- (推荐方式)参考[创建 TiDB Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md),创建一个 TiDB Cloud 集群。
- (推荐方式)参考[创建 TiDB Cloud Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md),创建一个 TiDB Cloud 集群。
- 参考[部署本地测试 TiDB 集群](/quick-start-with-tidb.md#部署本地测试集群)[部署正式 TiDB 集群](/production-deployment-using-tiup.md),创建一个本地集群。

## 连接到 TiDB

根据你选择的 TiDB 部署方式连接到 TiDB 集群。

<SimpleTab>
<div label="TiDB Serverless">
<div label="TiDB Cloud Serverless">

1. 在 TiDB Cloud 的 [**Clusters**](https://tidbcloud.com/console/clusters) 页面中,点击你目标集群的名字,进入集群的 **Overview** 页面。

Expand Down Expand Up @@ -64,20 +64,20 @@ TiDB 是一个兼容 MySQL 的数据库。[MySQL Workbench](https://www.mysql.co
- **Hostname**:输入从 TiDB Cloud 连接对话框中的得到的 `HOST` 参数。
- **Port**:输入从 TiDB Cloud 连接对话框中的得到的 `PORT` 参数。
- **Username**:输入从 TiDB Cloud 连接对话框中的得到的 `USERNAME` 参数。
- **Password**:点击 **Store in Keychain ...****Store in Vault**,输入 TiDB Serverless 集群的密码,然后点击 **OK** 保存密码。
- **Password**:点击 **Store in Keychain ...****Store in Vault**,输入 TiDB Cloud Serverless 集群的密码,然后点击 **OK** 保存密码。

![MySQL Workbench: store the password of TiDB Serverless in keychain](/media/develop/mysql-workbench-store-password-in-keychain.png)
![MySQL Workbench: store the password of TiDB Cloud Serverless in keychain](/media/develop/mysql-workbench-store-password-in-keychain.png)

下图显示了连接参数的示例:

![MySQL Workbench: configure connection settings for TiDB Serverless](/media/develop/mysql-workbench-connection-config-serverless-parameters.png)
![MySQL Workbench: configure connection settings for TiDB Cloud Serverless](/media/develop/mysql-workbench-connection-config-serverless-parameters.png)

7. 点击 **Test Connection** 以验证与 TiDB Serverless 集群的连接。
7. 点击 **Test Connection** 以验证与 TiDB Cloud Serverless 集群的连接。

8. 如果连接测试成功,你可以看到 **Successfully made the MySQL connection** 信息。点击 **OK** 保存连接配置。

</div>
<div label="TiDB Dedicated">
<div label="TiDB Cloud Dedicated">

1. 在 TiDB Cloud 的 [**Clusters**](https://tidbcloud.com/console/clusters) 页面中,点击你目标集群的名字,进入集群的 **Overview** 页面。

Expand All @@ -99,20 +99,20 @@ TiDB 是一个兼容 MySQL 的数据库。[MySQL Workbench](https://www.mysql.co
- **Hostname**: 输入从 TiDB Cloud 连接对话框中的得到的 `HOST` 参数。
- **Port**:输入从 TiDB Cloud 连接对话框中的得到的 `PORT` 参数。
- **Username**:输入从 TiDB Cloud 连接对话框中的得到的 `USERNAME` 参数。
- **Password**:点击 **Store in Keychain ...**,输入 TiDB Dedicated 集群的密码,然后点击 **OK** 保存密码。
- **Password**:点击 **Store in Keychain ...**,输入 TiDB Cloud Dedicated 集群的密码,然后点击 **OK** 保存密码。

![MySQL Workbench: store the password of TiDB Dedicated in keychain](/media/develop/mysql-workbench-store-dedicated-password-in-keychain.png)
![MySQL Workbench: store the password of TiDB Cloud Dedicated in keychain](/media/develop/mysql-workbench-store-dedicated-password-in-keychain.png)

下图显示了连接参数的示例:

![MySQL Workbench: configure connection settings for TiDB Dedicated](/media/develop/mysql-workbench-connection-config-dedicated-parameters.png)
![MySQL Workbench: configure connection settings for TiDB Cloud Dedicated](/media/develop/mysql-workbench-connection-config-dedicated-parameters.png)

6. 点击 **Test Connection** 以验证与 TiDB Dedicated 集群的连接。
6. 点击 **Test Connection** 以验证与 TiDB Cloud Dedicated 集群的连接。

7. 如果连接测试成功,你可以看到 **Successfully made the MySQL connection** 信息。点击 **OK** 保存连接配置。

</div>
<div label="TiDB Self-Hosted">
<div label="本地部署 TiDB">

1. 启动 MySQL Workbench,并点击 **MySQL Connections** 标题旁边的 **+**

Expand All @@ -126,11 +126,11 @@ TiDB 是一个兼容 MySQL 的数据库。[MySQL Workbench](https://www.mysql.co
- **Username**:输入用于连接到 TiDB 的用户名。
- **Password**:点击 **Store in Keychain ...**,输入用于连接 TiDB 集群的密码,然后点击 **OK** 保存密码。

![MySQL Workbench: store the password of TiDB Self-Hosted in keychain](/media/develop/mysql-workbench-store-self-hosted-password-in-keychain.png)
![MySQL Workbench: store the password of TiDB Self-Managed in keychain](/media/develop/mysql-workbench-store-self-hosted-password-in-keychain.png)

下图显示了连接参数的示例:

![MySQL Workbench: configure connection settings for TiDB Self-Hosted](/media/develop/mysql-workbench-connection-config-self-hosted-parameters.png)
![MySQL Workbench: configure connection settings for TiDB Self-Managed](/media/develop/mysql-workbench-connection-config-self-hosted-parameters.png)

3. 点击 **Test Connection** 以验证与本地部署 TiDB 集群的连接。

Expand Down
26 changes: 13 additions & 13 deletions develop/dev-guide-gui-navicat.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TiDB 是一个兼容 MySQL 的数据库。[Navicat](https://www.navicat.com) 是

> **注意**
>
> 本文档适用于 TiDB Serverless、TiDB Dedicated 和本地部署的 TiDB。
> 本文档适用于 TiDB Cloud Serverless、TiDB Cloud Dedicated 和本地部署的 TiDB。
## 前置需求

Expand All @@ -28,15 +28,15 @@ TiDB 是一个兼容 MySQL 的数据库。[Navicat](https://www.navicat.com) 是

**如果你还没有 TiDB 集群,可以按如下方式创建一个:**

- (推荐方式)参考[创建 TiDB Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md),创建一个 TiDB Cloud 集群。
- (推荐方式)参考[创建 TiDB Cloud Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md),创建一个 TiDB Cloud 集群。
- 参考[部署本地测试 TiDB 集群](/quick-start-with-tidb.md#部署本地测试集群)[部署正式 TiDB 集群](/production-deployment-using-tiup.md),创建一个本地集群。

## 连接到 TiDB

根据你选择的 TiDB 部署方式连接到 TiDB 集群。

<SimpleTab>
<div label="TiDB Serverless">
<div label="TiDB Cloud Serverless">

1. 在 TiDB Cloud 的 [**Clusters**](https://tidbcloud.com/console/clusters) 页面中,点击你目标集群的名字,进入集群的 **Overview** 页面。

Expand Down Expand Up @@ -65,20 +65,20 @@ TiDB 是一个兼容 MySQL 的数据库。[Navicat](https://www.navicat.com) 是
- **Host**:输入从 TiDB Cloud 连接对话框中的得到的 `HOST` 参数。
- **Port**:输入从 TiDB Cloud 连接对话框中的得到的 `PORT` 参数。
- **User Name**:输入从 TiDB Cloud 连接对话框中的得到的 `USERNAME` 参数。
- **Password**:输入 TiDB Serverless 集群的密码。
- **Password**:输入 TiDB Cloud Serverless 集群的密码。

![Navicat: configure connection general panel for TiDB Serverless](/media/develop/navicat-connection-config-serverless-general.png)
![Navicat: configure connection general panel for TiDB Cloud Serverless](/media/develop/navicat-connection-config-serverless-general.png)

7. 点击 **SSL** 选项卡,选择 **Use SSL****Use authentication** 以及 **Verify server certificate against CA** 复选框。并在 **CA Certificate** 字段中填入从 TiDB Cloud 连接对话框中获取的 `CA` 文件路径。

![Navicat: configure connection SSL panel for TiDB Serverless](/media/develop/navicat-connection-config-serverless-ssl.png)
![Navicat: configure connection SSL panel for TiDB Cloud Serverless](/media/develop/navicat-connection-config-serverless-ssl.png)

8. 点击 **Test Connection** 以验证与 TiDB Serverless 集群的连接。
8. 点击 **Test Connection** 以验证与 TiDB Cloud Serverless 集群的连接。

9. 如果连接测试成功,你可以看到 **Connection Successful** 信息。点击 **Save** 完成连接配置。

</div>
<div label="TiDB Dedicated">
<div label="TiDB Cloud Dedicated">

1. 在 TiDB Cloud 的 [**Clusters**](https://tidbcloud.com/console/clusters) 页面中,点击你目标集群的名字,进入集群的 **Overview** 页面。

Expand All @@ -102,20 +102,20 @@ TiDB 是一个兼容 MySQL 的数据库。[Navicat](https://www.navicat.com) 是
- **Host**: 输入从 TiDB Cloud 连接对话框中的得到的 `HOST` 参数。
- **Port**:输入从 TiDB Cloud 连接对话框中的得到的 `PORT` 参数。
- **User Name**: 输入从 TiDB Cloud 连接对话框中的得到的 `USERNAME` 参数。
- **Password**:输入 TiDB Dedicated 集群的密码。
- **Password**:输入 TiDB Cloud Dedicated 集群的密码。

![Navicat: configure connection general panel for TiDB Dedicated](/media/develop/navicat-connection-config-dedicated-general.png)
![Navicat: configure connection general panel for TiDB Cloud Dedicated](/media/develop/navicat-connection-config-dedicated-general.png)

7. 点击 **SSL** 选项卡,选择 **Use SSL****Use authentication** 以及 **Verify server certificate against CA** 复选框。然后,在 **CA Certificate** 字段中选择第 4 步下载的 CA 文件。

![Navicat: configure connection SSL panel for TiDB Dedicated](/media/develop/navicat-connection-config-dedicated-ssl.jpg)
![Navicat: configure connection SSL panel for TiDB Cloud Dedicated](/media/develop/navicat-connection-config-dedicated-ssl.jpg)

8. 点击 **Test Connection** 以验证与 TiDB Dedicated 集群的连接。
8. 点击 **Test Connection** 以验证与 TiDB Cloud Dedicated 集群的连接。

9. 如果连接测试成功,你可以看到 **Connection Successful** 信息。点击 **Save** 完成连接配置。

</div>
<div label="TiDB Self-Hosted">
<div label="本地部署 TiDB">

1. 启动 Navicat for MySQL,点击左上角的 **Connection**,并从下拉列表中选择 **MySQL**

Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-insert-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ summary: 插入数据、批量导入数据的方法、最佳实践及例子。

在阅读本页面之前,你需要准备以下事项:

- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Cloud Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- 阅读[数据库模式概览](/develop/dev-guide-schema-design-overview.md),并[创建数据库](/develop/dev-guide-create-database.md)[创建表](/develop/dev-guide-create-table.md)[创建二级索引](/develop/dev-guide-create-secondary-indexes.md)

## 插入行
Expand Down
Loading

0 comments on commit d1cf80c

Please sign in to comment.