Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- 应用开发
- [概览](/develop/dev-guide-overview.md)
- 快速开始
- [使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)
- [使用 TiDB 的增删改查 SQL](/develop/dev-guide-tidb-crud-sql.md)
- 示例程序
- [Golang](/develop/dev-guide-sample-application-golang.md)
Expand Down
2 changes: 1 addition & 1 deletion br/backup-and-restore-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TiDB 备份恢复功能可以用于满足以下业务的需求:

## 功能使用

根据 TiDB 部署方式的不同,使用备份恢复功能的方式也不同。本文主要介绍在 On-Premise 物理部署方式下,如何使用 br 命令行工具进行 TiDB 的备份和恢复。
根据 TiDB 部署方式的不同,使用备份恢复功能的方式也不同。本文主要介绍在本地部署方式下,如何使用 br 命令行工具进行 TiDB 的备份和恢复。

其它 TiDB 的部署方式的备份恢复功能使用,可以参考:

Expand Down
22 changes: 11 additions & 11 deletions develop/dev-guide-build-cluster-in-cloud.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---
title: 使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群
summary: 使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群,并连接 TiDB Cloud 集群。
title: 使用 TiDB Serverless 构建 TiDB 集群
summary: 使用 TiDB Serverless 构建 TiDB 集群,并连接 TiDB Serverless 集群。
---

<!-- markdownlint-disable MD029 -->

# 使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群
# 使用 TiDB Serverless 构建 TiDB 集群

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

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

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

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

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

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

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

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

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

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

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

## 第 2 步:连接到集群

Expand Down Expand Up @@ -128,8 +128,8 @@ summary: 使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群,并连接 TiDB

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

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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
- [使用 TiDB 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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
- [使用 TiDB 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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
- [使用 TiDB 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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-serverless-tier-集群) 来创建一个含有 TiFlash 的集群。
> 如果你的集群,不包含 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 的集群。

随后正常进行查询即可:

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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
- [使用 TiDB 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
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 Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
- [使用 TiDB 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
2 changes: 1 addition & 1 deletion develop/dev-guide-proxysql-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ summary: 介绍 TiDB 与 ProxySQL 集成的方法。

<div label="TiDB Cloud" value="tidb-cloud">

请参考[使用 TiDB Cloud (Serverless Tier) 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。
请参考[使用 TiDB Serverless 构建 TiDB 集群](/develop/dev-guide-build-cluster-in-cloud.md)。

</div>

Expand Down
8 changes: 4 additions & 4 deletions develop/dev-guide-sample-application-django.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ summary: 给出一个 Django 构建 TiDB 应用程序示例。

<div label="TiDB Cloud" value="serverless-cluster">

[创建 Serverless Tier 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-serverless-tier-集群)。
[创建 TiDB Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-tidb-serverless-集群)。

</div>

Expand Down Expand Up @@ -72,7 +72,7 @@ summary: 给出一个 Django 构建 TiDB 应用程序示例。

### 第 4 步第 1 部分:TiDB Cloud 更改参数

若你使用 TiDB Cloud Serverless Tier 集群,更改 `example_project/settings.py` 中的 `DATABASES` 参数:
若你使用 TiDB Serverless 集群,更改 `example_project/settings.py` 中的 `DATABASES` 参数:

```python
DATABASES = {
Expand All @@ -87,9 +87,9 @@ DATABASES = {
}
```

另外,由于 TiDB Cloud Serverless Tier 需要使用 SSL 连接。因此,需要提供 CA 证书路径。你可以在 [TiDB Cloud Serverless Tier 安全连接文档](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters#where-is-the-ca-root-path-on-my-system) 中查看不同操作系统的 CA 证书路径。
另外,由于 TiDB Serverless 需要使用 SSL 连接。因此,需要提供 CA 证书路径。你可以在 [TiDB Serverless 安全连接文档](https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-tier-clusters#where-is-the-ca-root-path-on-my-system) 中查看不同操作系统的 CA 证书路径。

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand Down
10 changes: 5 additions & 5 deletions develop/dev-guide-sample-application-golang.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ summary: 给出一个 TiDB 和 Golang 的简单 CRUD 应用程序示例。

<div label="TiDB Cloud" value="serverless-cluster">

[创建 Serverless Tier 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-serverless-tier-集群)。
[创建 TiDB Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-tidb-serverless-集群)。

</div>

Expand Down Expand Up @@ -750,13 +750,13 @@ mysql --host 127.0.0.1 --port 4000 -u root<sql/dbinit.sql

<div label="使用 GORM(推荐)" value="gorm">

若你使用 TiDB Cloud Serverless Tier 集群,更改 `gorm.go` 内 `dsn` 参数值:
若你使用 TiDB Serverless 集群,更改 `gorm.go` 内 `dsn` 参数值:

```go
dsn := "root:@tcp(127.0.0.1:4000)/test?charset=utf8mb4"
```

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand All @@ -777,13 +777,13 @@ dsn := "2aEp24QWEDLqRFs.root:123456@tcp(xxx.tidbcloud.com:4000)/test?charset=utf

<div label="使用 go-sql-driver/mysql" value="sqldriver">

若你使用 TiDB Cloud Serverless Tier 集群,更改 `sqldriver.go` 内 `dsn` 参数的值:
若你使用 TiDB Serverless 集群,更改 `sqldriver.go` 内 `dsn` 参数的值:

```go
dsn := "root:@tcp(127.0.0.1:4000)/test?charset=utf8mb4"
```

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand Down
14 changes: 7 additions & 7 deletions develop/dev-guide-sample-application-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ summary: 给出一个 TiDB 和 Java 的简单 CRUD 应用程序示例。

<div label="TiDB Cloud" value="serverless-cluster">

[创建 Serverless Tier 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-serverless-tier-集群)。
[创建 TiDB Serverless 集群](/develop/dev-guide-build-cluster-in-cloud.md#第-1-步创建-tidb-serverless-集群)。

</div>

Expand Down Expand Up @@ -1462,7 +1462,7 @@ mysql --host 127.0.0.1 --port 4000 -u root<src/main/resources/dbinit.sql

<div label="使用 Mybatis(推荐)" value="mybatis">

若你使用 TiDB Cloud Serverless Tier 集群,更改 `mybatis-config.xml` 内关于 `dataSource.url`、`dataSource.username`、`dataSource.password` 的参数:
若你使用 TiDB Serverless 集群,更改 `mybatis-config.xml` 内关于 `dataSource.url`、`dataSource.username`、`dataSource.password` 的参数:

```xml
<?xml version="1.0" encoding="UTF-8" ?>
Expand Down Expand Up @@ -1505,7 +1505,7 @@ mysql --host 127.0.0.1 --port 4000 -u root<src/main/resources/dbinit.sql
</configuration>
```

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand Down Expand Up @@ -1537,7 +1537,7 @@ mysql --host 127.0.0.1 --port 4000 -u root<src/main/resources/dbinit.sql

<div label="使用 Hibernate(推荐)" value="hibernate">

若你使用 TiDB Cloud Serverless Tier 集群,更改 `hibernate.cfg.xml` 内关于 `hibernate.connection.url`、`hibernate.connection.username`、`hibernate.connection.password` 的参数:
若你使用 TiDB Serverless 集群,更改 `hibernate.cfg.xml` 内关于 `hibernate.connection.url`、`hibernate.connection.username`、`hibernate.connection.password` 的参数:

```xml
<?xml version='1.0' encoding='utf-8'?>
Expand Down Expand Up @@ -1565,7 +1565,7 @@ mysql --host 127.0.0.1 --port 4000 -u root<src/main/resources/dbinit.sql
</hibernate-configuration>
```

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand Down Expand Up @@ -1603,7 +1603,7 @@ mysql --host 127.0.0.1 --port 4000 -u root<src/main/resources/dbinit.sql

<div label="使用 JDBC" value="jdbc">

若你使用 TiDB Cloud Serverless Tier 集群,更改 `JDBCExample.java` 内关于 Host、Port、User、Password 的参数:
若你使用 TiDB Serverless 集群,更改 `JDBCExample.java` 内关于 Host、Port、User、Password 的参数:

```java
mysqlDataSource.setServerName("localhost");
Expand All @@ -1613,7 +1613,7 @@ mysqlDataSource.setUser("root");
mysqlDataSource.setPassword("");
```

若你设定的密码为 `123456`,而且从 TiDB Cloud Serverless Tier 集群面板中得到的连接信息为:
若你设定的密码为 `123456`,而且从 TiDB Serverless 集群面板中得到的连接信息为:

- Endpoint: `xxx.tidbcloud.com`
- Port: `4000`
Expand Down
Loading