forked from Oreoxmt/pingcap-docsite-preview
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preview PR pingcap/docs#19717 and this preview is triggered from commit
- Loading branch information
Docsite Preview Bot
committed
Jan 7, 2025
1 parent
5db6248
commit 69e629c
Showing
4 changed files
with
211 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
markdown-pages/en/tidbcloud/master/tidb-cloud/api-overview.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: TiDB Cloud API Overview | ||
summary: Learn about what is TiDB Cloud API, its features, and how to use API to manage your TiDB Cloud clusters. | ||
--- | ||
|
||
# TiDB Cloud API Overview (Beta) | ||
|
||
> **Note:** | ||
> | ||
> TiDB Cloud API is in beta. | ||
The TiDB Cloud API is a [REST interface](https://en.wikipedia.org/wiki/Representational_state_transfer) that provides you with programmatic access to manage administrative objects within TiDB Cloud. Through this API, you can automatically and efficiently manage resources such as Projects, Clusters, Backups, Restores, Imports, Billings, and resources in the [Data Service](/tidb-cloud/data-service-overview.md). | ||
|
||
The API has the following features: | ||
|
||
- **JSON entities.** All entities are expressed in JSON. | ||
- **HTTPS-only.** You can only access the API via HTTPS, ensuring all the data sent over the network is encrypted with TLS. | ||
- **Key-based access and digest authentication.** Before you access TiDB Cloud API, you must generate an API key, refer to [API Key Management](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Authentication/API-key-management). All requests are authenticated through [HTTP Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication), ensuring the API key is never sent over the network. | ||
|
||
To start using TiDB Cloud API, refer to the following resources in TiDB Cloud API Documentation: | ||
|
||
- [Get Started](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Get-Started) | ||
- [Authentication](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Authentication) | ||
- [Rate Limiting](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Rate-Limiting) | ||
- API Full References | ||
- v1beta1 | ||
- [Billing](https://docs.pingcap.com/tidbcloud/api/v1beta1/billing) | ||
- [Data Service](https://docs.pingcap.com/tidbcloud/api/v1beta1/dataservice) | ||
- [IAM](https://docs.pingcap.com/tidbcloud/api/v1beta1/iam) | ||
- [MSP (Deprecated)](https://docs.pingcap.com/tidbcloud/api/v1beta1/msp) | ||
- [v1beta](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project) | ||
- [Changelog](https://docs.pingcap.com/tidbcloud/api/v1beta#section/API-Changelog) |
129 changes: 129 additions & 0 deletions
129
markdown-pages/en/tidbcloud/master/tidb-cloud/cli-reference.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
--- | ||
title: TiDB Cloud CLI Reference | ||
summary: Provides an overview of TiDB Cloud CLI. | ||
--- | ||
|
||
# TiDB Cloud CLI Reference (Beta) | ||
|
||
> **Note:** | ||
> | ||
> TiDB Cloud CLI is in beta. | ||
TiDB Cloud CLI is a command line interface, which allows you to operate TiDB Cloud from your terminal with a few lines of commands. In the TiDB Cloud CLI, you can easily manage your TiDB Cloud clusters, import data to your clusters, and perform more operations. | ||
|
||
## Before you begin | ||
|
||
Make sure to first [set up your TiDB Cloud CLI environment](/tidb-cloud/get-started-with-cli.md). Once you have installed the `ticloud` CLI, you can use it to manage your TiDB Cloud clusters from the command lines. | ||
|
||
## Commands available | ||
|
||
The following table lists the commands available for the TiDB Cloud CLI. | ||
|
||
To use the `ticloud` CLI in your terminal, run `ticloud [command] [subcommand]`. If you are using [TiUP](https://docs.pingcap.com/tidb/stable/tiup-overview), use `tiup cloud [command] [subcommand]` instead. | ||
|
||
| Command | Subcommand | Description | | ||
|-----------------------|-----------------------------------------------------------------------|------------------------------------------------| | ||
| auth | login, logout, whoami | Login and logout | | ||
| serverless (alias: s) | create, delete, describe, list, update, spending-limit, region, shell | Manage TiDB Cloud Serverless clusters | | ||
| serverless branch | create, delete, describe, list, shell | Manage TiDB Cloud Serverless branches | | ||
| serverless import | cancel, describe, list, start | Manage TiDB Cloud Serverless import tasks | | ||
| serverless export | create, describe, list, cancel, download | Manage TiDB Cloud Serverless export tasks | | ||
| serverless sql-user | create, list, delete, update | Manage TiDB Cloud Serverless SQL users | | ||
| ai | - | Chat with TiDB Bot | | ||
| completion | bash, fish, powershell, zsh | Generate completion script for specified shell | | ||
| config | create, delete, describe, edit, list, set, use | Configure user profiles | | ||
| project | list | Manage projects | | ||
| upgrade | - | Update the CLI to the latest version | | ||
| help | auth, config, serverless, ai, project, upgrade, help, completion | View help for any command | | ||
|
||
## Command modes | ||
|
||
The TiDB Cloud CLI provides two modes for some commands for easy use: | ||
|
||
- Interactive mode | ||
|
||
You can run a command without flags (such as `ticloud config create`), and the CLI prompts you for input. | ||
|
||
- Non-interactive mode | ||
|
||
You must provide all arguments and flags that are required when running a command, such as `ticloud config create --profile-name <profile-name> --public-key <public-key> --private-key <private-key>`. | ||
|
||
## User profile | ||
|
||
For the TiDB Cloud CLI, a user profile is a collection of properties associated with a user, including the profile name, public key, private key, and OAuth token. To use TiDB Cloud CLI, you must have a user profile. | ||
|
||
### Create a user profile with TiDB Cloud API key | ||
|
||
Use [`ticloud config create`](/tidb-cloud/ticloud-config-create.md) to create a user profile. | ||
|
||
### Create a user profile with OAuth token | ||
|
||
Use [`ticloud auth login`](/tidb-cloud/ticloud-auth-login.md) to assign OAuth token to the current profile. If no profiles exist, a profile named `default` will be created automatically. | ||
|
||
> **Note:** | ||
> | ||
> In the preceding two methods, the TiDB Cloud API key takes precedence over the OAuth token. If both are available in the current profile, the API key will be used. | ||
### List all user profiles | ||
|
||
Use [`ticloud config list`](/tidb-cloud/ticloud-config-list.md) to list all user profiles. | ||
|
||
An example output is as follows: | ||
|
||
``` | ||
Profile Name | ||
default (active) | ||
dev | ||
staging | ||
``` | ||
|
||
In this example output, the user profile `default` is currently active. | ||
|
||
### Describe a user profile | ||
|
||
Use [`ticloud config describe`](/tidb-cloud/ticloud-config-describe.md) to get the properties of a user profile. | ||
|
||
An example output is as follows: | ||
|
||
```json | ||
{ | ||
"private-key": "xxxxxxx-xxx-xxxxx-xxx-xxxxx", | ||
"public-key": "Uxxxxxxx" | ||
} | ||
``` | ||
|
||
### Set properties in a user profile | ||
|
||
Use [`ticloud config set`](/tidb-cloud/ticloud-config-set.md) to set properties in a user profile. | ||
|
||
### Switch to another user profile | ||
|
||
Use [`ticloud config use`](/tidb-cloud/ticloud-config-use.md) to switch to another user profile. | ||
|
||
An example output is as follows: | ||
|
||
``` | ||
Current profile has been changed to default | ||
``` | ||
|
||
### Edit the config file | ||
|
||
Use [`ticloud config edit`](/tidb-cloud/ticloud-config-edit.md) to open the configuration file for editing. | ||
|
||
### Delete a user profile | ||
|
||
Use [`ticloud config delete`](/tidb-cloud/ticloud-config-delete.md) to delete a user profile. | ||
|
||
## Global flags | ||
|
||
The following table lists the global flags for the TiDB Cloud CLI. | ||
|
||
| Flag | Description | Required | Note | | ||
|----------------------|---------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| | ||
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | | ||
| -P, --profile string | Specifies the active user profile used in this command. | No | Works in both non-interactive and interactive modes. | | ||
| -D, --debug | Enable debug mode | No | Works in both non-interactive and interactive modes. | | ||
|
||
## Feedback | ||
|
||
If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. |
39 changes: 39 additions & 0 deletions
39
markdown-pages/en/tidbcloud/master/tidb-cloud/transaction-concepts.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: Transactions | ||
summary: Learn about transactions concepts for TiDB Cloud. | ||
--- | ||
|
||
# Transactions | ||
|
||
TiDB provides complete distributed transactions and the model has some optimizations on the basis of [Google Percolator](https://research.google.com/pubs/pub36726.html). | ||
|
||
## Optimistic transaction mode | ||
|
||
TiDB's optimistic transaction model does not detect conflicts until the commit phase. If there are conflicts, the transaction needs retry. But this model is inefficient if the conflict is severe, because operations before retry are invalid and need to repeat. | ||
|
||
Assume that the database is used as a counter. High access concurrency might lead to severe conflicts, resulting in multiple retries or even timeouts. Therefore, in the scenario of severe conflicts, it is recommended to use the pessimistic transaction mode or to solve problems at the system architecture level, such as placing counter in Redis. Nonetheless, the optimistic transaction model is efficient if the access conflict is not very severe. | ||
|
||
For more information, see [TiDB Optimistic Transaction Model](/optimistic-transaction.md). | ||
|
||
## Pessimistic transaction mode | ||
|
||
In TiDB, the pessimistic transaction mode has almost the same behavior as in MySQL. The transaction applies a lock during the execution phase, which avoids retries in conflict situations and ensures a higher success rate. By applying the pessimistic locking, you can also lock data in advance using `SELECT FOR UPDATE`. | ||
|
||
However, if the application scenario has fewer conflicts, the optimistic transaction model has better performance. | ||
For more information, see [TiDB Pessimistic Transaction Mode](/pessimistic-transaction.md). | ||
|
||
## Transaction isolation levels | ||
|
||
Transaction isolation is one of the foundations of database transaction processing. Isolation is one of the four key properties of a transaction (commonly referred as [ACID](/tidb-cloud/tidb-cloud-glossary.md#acid)). | ||
|
||
TiDB implements Snapshot Isolation (SI) consistency, which it advertises as `REPEATABLE-READ` for compatibility with MySQL. This differs from the [ANSI Repeatable Read isolation level](/transaction-isolation-levels.md#difference-between-tidb-and-ansi-repeatable-read) and the [MySQL Repeatable Read level](/transaction-isolation-levels.md#difference-between-tidb-and-mysql-repeatable-read). | ||
|
||
For more information, see [TiDB Transaction Isolation Levels](/transaction-isolation-levels.md). | ||
|
||
## Non-transactional DML statements | ||
|
||
A non-transactional DML statement is a DML statement split into multiple SQL statements (which is, multiple batches) to be executed in sequence. It enhances the performance and ease of use in batch data processing at the expense of transactional atomicity and isolation. | ||
|
||
Usually, memory-consuming transactions need to be split into multiple SQL statements to bypass the transaction size limit. Non-transactional DML statements integrate this process into the TiDB kernel to achieve the same effect. It is helpful to understand the effect of non-transactional DML statements by splitting SQL statements. The `DRY RUN` syntax can be used to preview the split statements. | ||
|
||
For more information, see [Non-Transactional DML Statements](/non-transactional-dml.md). |