diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index c82edcba66b19..4403b9d3a6dcf 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -31,6 +31,6 @@ jobs: curl \ -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ secrets.PR_TRIGGER_BUILD_TOKEN }}" \ + -H "Authorization: token ${{ secrets.DOCS_STAGING }}" \ https://api.github.com/repos/pingcap/docs-staging/actions/workflows/update.yml/dispatches \ -d '{"ref":"main","inputs":{"full": "false", "repo":"${{ github.repository }}","branch":"${{ github.ref_name }}"}}' diff --git a/TOC-tidb-cloud.md b/TOC-tidb-cloud.md deleted file mode 100644 index 54d649209bf2f..0000000000000 --- a/TOC-tidb-cloud.md +++ /dev/null @@ -1,74 +0,0 @@ - - - -- About TiDB Cloud - - [Why TiDB Cloud](/tidb-cloud/tidb-cloud-intro.md) - - [Architecture](/tidb-cloud/tidb-cloud-intro.md#architecture) - - [High Availability](/tidb-cloud/high-availability-with-multi-az.md) -- Get Started - - [Quick Start](/tidb-cloud/tidb-cloud-quickstart.md) - - [Perform a PoC](/tidb-cloud/tidb-cloud-poc.md) -- Manage Cluster - - Plan Your Cluster - - [Select Your Cluster Tier](/tidb-cloud/select-cluster-tier.md) - - [Determine Your TiDB Size](/tidb-cloud/size-your-cluster.md) - - [Create a TiDB Cluster](/tidb-cloud/create-tidb-cluster.md) - - Connect to Your TiDB Cluster - - [Connect via a SQL Client](/tidb-cloud/connect-to-tidb-cluster.md) - - [Connect via SQL Shell](/tidb-cloud/connect-to-tidb-cluster.md#connect-via-sql-shell) - - [Set Up VPC Peering Connections](/tidb-cloud/set-up-vpc-peering-connections.md) - - [Use an HTAP Cluster](/tidb-cloud/use-htap-cluster.md) - - [Scale a TiDB Cluster](/tidb-cloud/scale-tidb-cluster.md) - - Tune Performance - - [Statement Analysis](/tidb-cloud/tune-performance.md) - - [Key Visualizer](/tidb-cloud/tune-performance.md#key-visualizer) - - [Upgrade a TiDB Cluster](/tidb-cloud/upgrade-tidb-cluster.md) - - [Delete a TiDB Cluster](/tidb-cloud/delete-tidb-cluster.md) -- Migrate Data - - [Import Sample Data](/tidb-cloud/import-sample-data.md) - - Migrate Data into TiDB - - [Migrate from MySQL-Compatible Databases](/tidb-cloud/migrate-data-into-tidb.md) - - [Migrate from Amazon Aurora MySQL in Bulk](/tidb-cloud/migrate-from-aurora-bulk-import.md) - - [Import or Migrate from Amazon S3 or GCS to TiDB Cloud](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md) - - [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](/tidb-cloud/import-csv-files.md) - - [Import Apache Parquet Files from Amazon S3 or GCS into TiDB Cloud](/tidb-cloud/import-parquet-files.md) - - [Export Data from TiDB](/tidb-cloud/export-data-from-tidb-cloud.md) -- Back Up and Restore Data - - [Automatic Backup](/tidb-cloud/backup-and-restore.md) - - [Manual Backup](/tidb-cloud/backup-and-restore.md#manual-backup) - - [Restore](/tidb-cloud/backup-and-restore.md#restore) -- Monitor and Alert - - [Overview](/tidb-cloud/monitor-tidb-cluster.md) - - [Built-in Alerting](/tidb-cloud/monitor-built-in-alerting.md) - - Third-Party Monitoring Integrations - - [Datadog Integration](/tidb-cloud/monitor-datadog-integration.md) - - [Prometheus and Grafana Integration](/tidb-cloud/monitor-prometheus-and-grafana-integration.md) -- Manage User Access - - [Sign In](/tidb-cloud/manage-user-access.md) - - [Sign Out](/tidb-cloud/manage-user-access.md#sign-out) - - [Manage User Passwords](/tidb-cloud/manage-user-access.md#manage-user-passwords) - - [Manage User Profiles](/tidb-cloud/manage-user-access.md#manage-user-profiles) - - [View the Organization and Project](/tidb-cloud/manage-user-access.md#view-the-organization-and-project) - - [Invite an Organization Member](/tidb-cloud/manage-user-access.md#invite-an-organization-member) - - [Invite a Project Member](/tidb-cloud/manage-user-access.md#invite-a-project-member) - - [Configure Member Roles](/tidb-cloud/manage-user-access.md#configure-member-roles) - - [Remove an Organization Member](/tidb-cloud/manage-user-access.md#remove-an-organization-member) - - [Remove a Project Member](/tidb-cloud/manage-user-access.md#remove-a-project-member) - - [Set the Local Time Zone](/tidb-cloud/manage-user-access.md#set-the-local-time-zone) -- Billing - - [Node Cost](/tidb-cloud/tidb-cloud-billing.md) - - [Backup Storage Cost](/tidb-cloud/tidb-cloud-billing.md#backup-storage-cost) - - [Data Transfer Cost](/tidb-cloud/tidb-cloud-billing.md#data-transfer-cost) - - [Invoices](/tidb-cloud/tidb-cloud-billing.md#invoices) - - [Billing Details](/tidb-cloud/tidb-cloud-billing.md#billing-details) - - [Trial Points](/tidb-cloud/tidb-cloud-billing.md#trial-points) - - [Payment Method Setting](/tidb-cloud/tidb-cloud-billing.md#payment-method) -- Reference - - [Explore SQL with TiDB](/basic-sql-operations.md) - - [Support](/tidb-cloud/tidb-cloud-support.md) - - [Glossary](/tidb-cloud/tidb-cloud-glossary.md) -- [FAQs](/tidb-cloud/tidb-cloud-faq.md) -- Release Notes - - [2022](/tidb-cloud/release-notes-2022.md) - - [2021](/tidb-cloud/release-notes-2021.md) - - [2020](/tidb-cloud/release-notes-2020.md) diff --git a/TOC.md b/TOC.md index f580b20ad20bc..29482229c3caa 100644 --- a/TOC.md +++ b/TOC.md @@ -1,6 +1,7 @@ +- [Docs Home](/_docHome.md) - About TiDB - [TiDB Introduction](/overview.md) - [TiDB 6.1 Release Notes](/releases/release-6.1.0.md) @@ -22,7 +23,7 @@ - Develop - [Overview](/develop/dev-guide-overview.md) - Quick Start - - [Build a TiDB Cluster in TiDB Cloud (DevTier)](/develop/dev-guide-build-cluster-in-cloud.md) + - [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md) - [CRUD SQL in TiDB](/develop/dev-guide-tidb-crud-sql.md) - Build a Simple CRUD App with TiDB - [Java](/develop/dev-guide-sample-application-java.md) @@ -83,6 +84,8 @@ - [For mysql-connector-python](/develop/dev-guide-outdated-for-python-mysql-connector.md) - Cloud Native Development Environment - [Gitpod](/develop/dev-guide-playground-gitpod.md) + - Third-party Support + - [Third-Party Libraries Support](/develop/dev-guide-third-party-support.md) - Deploy - [Software and Hardware Requirements](/hardware-and-software-requirements.md) - [Environment Configuration Checklist](/check-before-deployment.md) @@ -349,6 +352,8 @@ - [Table Filter](/table-filter.md) - [CSV Support](/tidb-lightning/migrate-from-csv-using-tidb-lightning.md) - [Backends](/tidb-lightning/tidb-lightning-backends.md) + - [Physical Import Mode](/tidb-lightning/tidb-lightning-physical-import-mode.md) + - [Physical Import Mode Usage](/tidb-lightning/tidb-lightning-physical-import-mode-usage.md) - [Import Data in Parallel](/tidb-lightning/tidb-lightning-distributed-import.md) - [Error Resolution](/tidb-lightning/tidb-lightning-error-resolution.md) - [Web Interface](/tidb-lightning/tidb-lightning-web-interface.md) diff --git a/_docHome.md b/_docHome.md new file mode 100644 index 0000000000000..d2a3645b446e8 --- /dev/null +++ b/_docHome.md @@ -0,0 +1,156 @@ +--- +title: PingCAP Documentation +hide_sidebar: true +hide_commit: true +hide_leftNav: true +--- + + + + + +TiDB Cloud is a fully-managed Database-as-a-Service (DBaaS) that brings everything great about TiDB to your cloud, and lets you focus on your applications, not the complexities of your database. + + + + + +See the documentation of TiDB Cloud + + + + + +Guides you through an easy way to get started with TiDB Cloud + + + + + +Helps you quickly complete a Proof of Concept (PoC) of TiDB Cloud + + + + + +Get the power of a cloud-native, distributed SQL database built for real-time analytics in a fully-managed service. + +Try Free + + + + + +TiDB is an open-source, distributed, NewSQL database that supports Hybrid Transactional and Analytical Processing (HTAP) workloads. It is MySQL compatible and features horizontal scalability, strong consistency, and high availability. You can deploy TiDB on premises or in the cloud. + + + + + +See the documentation of TiDB + + + + + +Walks you through the quickest way to get started with TiDB + + + + + +Learn how to deploy TiDB locally in production + + + + + +The open-source TiDB platform is released under the Apache 2.0 license, and supported by the community. + +Download + + + + + + + + + +Documentation for application developers + + + + + +Java applications can connect to and communicate with TiDB through JDBC or Swing, or with ORM frameworks like Hibernate + + + + + +Golang applications can connect to and communicate with TiDB through a native driver and ORM frameworks + + + + + + + + + + + + + +Learn TiDB and TiDB Cloud through well-designed online courses and instructor-led training + + + + + +Join us on Slack or become a contributor + + + + + +Learn great articles about TiDB and TiDB Cloud + + + + + +See a compilation of short videos describing TiDB and a variety of use cases + + + + + +Learn events about PingCAP and the community + + + + + +Download eBooks and papers + + + + + +A powerful insight tool that analyzes in depth any GitHub repository, powered by TiDB Cloud + + + + + +Let’s work together to make the documentation better! + + + + + + + + diff --git a/_index.md b/_index.md index ef48fbd250184..e8ed70d82bfe8 100644 --- a/_index.md +++ b/_index.md @@ -1,118 +1,124 @@ --- title: TiDB Introduction -summary: Learn about the NewSQL database TiDB that supports HTAP workloads. -aliases: ['/docs/dev/','/docs/dev/adopters/','/tidb/dev/adopters'] +aliases: ["/docs/dev/", "/docs/dev/adopters/", "/tidb/dev/adopters"] +hide_sidebar: true +hide_commit: true --- -# TiDB Introduction + -[TiDB](https://github.com/pingcap/tidb) (/’taɪdiːbi:/, "Ti" stands for Titanium) is an open-source, distributed, NewSQL database that supports Hybrid Transactional and Analytical Processing (HTAP) workloads. It is MySQL compatible and features horizontal scalability, strong consistency, and high availability. TiDB can be deployed on-premise or in-cloud. + -Designed for the cloud, TiDB provides flexible scalability, reliability and security on the cloud platform. Users can elastically scale TiDB to meet the requirements of their changing workloads. [TiDB Operator](https://docs.pingcap.com/tidb-in-kubernetes/stable/tidb-operator-overview) helps manage TiDB on Kubernetes and automates operating tasks, which makes TiDB easier to deploy on any cloud that provides managed Kubernetes. [TiDB Cloud](https://pingcap.com/tidb-cloud/), the fully-managed TiDB service, is the easiest, most economical, and most resilient way to unlock the full power of [TiDB in the cloud](https://docs.pingcap.com/tidbcloud/), allowing you to deploy and run TiDB clusters with just a few clicks. +[What is TiDB](https://docs.pingcap.com/tidb/dev/overview) - - -About TiDB +[Features](https://docs.pingcap.com/tidb/dev/basic-features) -- [TiDB Introduction](/overview.md) -- [Basic Features](/basic-features.md) -- [TiDB 6.1 Release Notes](/releases/release-6.1.0.md) -- [TiDB Release Timeline](/releases/release-timeline.md) -- [Compatibility with MySQL](/mysql-compatibility.md) -- [Usage Limitations](/tidb-limitations.md) +[TiFlash](https://docs.pingcap.com/tidb/dev/tiflash-overview) - + - -Quick Start + -- [Quick Start with TiDB](/quick-start-with-tidb.md) -- [Quick Start with HTAP](/quick-start-with-htap.md) -- [Explore SQL with TiDB](/basic-sql-operations.md) -- [Explore HTAP](/explore-htap.md) +[Try Out TiDB](https://docs.pingcap.com/tidb/dev/quick-start-with-tidb) - +[Try Out HTAP](https://docs.pingcap.com/tidb/dev/quick-start-with-htap) - -Deploy and Use +[Import Example Database](https://docs.pingcap.com/tidb/dev/import-example-data) -- [Hardware and Software Requirements](/hardware-and-software-requirements.md) -- [Check Environment and Configuration](/check-before-deployment.md) -- [Deploy a TiDB Cluster Using TiUP](/production-deployment-using-tiup.md) -- [Use TiFlash for Analytical Processing](/tiflash/tiflash-overview.md) -- [Deploy TiDB in Kubernetes](https://docs.pingcap.com/tidb-in-kubernetes/stable) + - + - -Migrate Data +[Developer Guide Overview](https://docs.pingcap.com/tidb/dev/dev-guide-overview) -- [Migration Overview](/migration-overview.md) -- [Migrate Data from CSV Files to TiDB](/migrate-from-csv-files-to-tidb.md) -- [Migrate Data from SQL Files to TiDB](/migrate-from-sql-files-to-tidb.md) -- [Migrate Data from Amazon Aurora to TiDB](/migrate-aurora-to-tidb.md) +[Quick Start](https://docs.pingcap.com/tidb/dev/dev-guide-build-cluster-in-cloud) - +[Example Application](https://docs.pingcap.com/tidb/dev/dev-guide-sample-application-spring-boot) - -Maintain + -- [Upgrade TiDB Using TiUP](/upgrade-tidb-using-tiup.md) -- [Scale TiDB Using TiUP](/scale-tidb-using-tiup.md) -- [Back up and Restore Data](/br/backup-and-restore-overview.md) -- [Deploy and Manage TiCDC](/ticdc/manage-ticdc.md) -- [Maintain TiDB Using TiUP](/maintain-tidb-using-tiup.md) -- [Maintain TiFlash](/tiflash/maintain-tiflash.md) + - +[Software and Hardware Requirements](https://docs.pingcap.com/tidb/dev/hardware-and-software-requirements) - -Monitor and Alert +[Deploy a TiDB Cluster Using TiUP (Recommended)](https://docs.pingcap.com/tidb/dev/production-deployment-using-tiup) -- [Monitoring Framework](/tidb-monitoring-framework.md) -- [Monitoring API](/tidb-monitoring-api.md) -- [Deploy Monitoring Services](/deploy-monitoring-services.md) -- [Export Grafana Snapshots](/exporting-grafana-snapshots.md) -- [Alert Rules and Solutions](/alert-rules.md) -- [TiFlash Alert Rules and Solutions](/tiflash/tiflash-alert-rules.md) +[Deploy a TiDB Cluster in Kubernetes](https://docs.pingcap.com/tidb/dev/tidb-in-kubernetes) - + - -Troubleshoot + -- [TiDB Troubleshooting Map](/tidb-troubleshooting-map.md) -- [Identify Slow Queries](/identify-slow-queries.md) -- [Analyze Slow Queries](/analyze-slow-queries.md) -- [SQL Diagnostics](/information-schema/information-schema-sql-diagnostics.md) -- [Troubleshoot Hotspot Issues](/troubleshoot-hot-spot-issues.md) -- [Troubleshoot the TiDB Cluster](/troubleshoot-tidb-cluster.md) -- [Troubleshoot TiCDC](/ticdc/troubleshoot-ticdc.md) -- [Troubleshoot TiFlash](/tiflash/troubleshoot-tiflash.md) +[Migration Overview](https://docs.pingcap.com/tidb/dev/migration-overview) - +[Migration Tools](https://docs.pingcap.com/tidb/dev/migration-tools) - -Reference +[Typical Scenarios](https://docs.pingcap.com/tidb/dev/migrate-aurora-to-tidb) -- [TiDB Architecture](/tidb-architecture.md) -- [Key Monitoring Metrics](/grafana-overview-dashboard.md) -- [Enable TLS](/enable-tls-between-clients-and-servers.md) -- [Privilege Management](/privilege-management.md) -- [Role-Based Access Control](/role-based-access-control.md) -- [Certificate-Based Authentication](/certificate-authentication.md) + - + - -FAQs +[Upgrade a Cluster](https://docs.pingcap.com/tidb/dev/upgrade-tidb-using-tiup) -- [Product FAQs](/faq/tidb-faq.md) -- [High Availability FAQs](/faq/high-availability-faq.md) -- [SQL FAQs](/faq/sql-faq.md) -- [Deploy and Maintain FAQs](/faq/deploy-and-maintain-faq.md) -- [Upgrade and After Upgrade FAQs](/faq/upgrade-faq.md) -- [Migration FAQs](/faq/migration-tidb-faq.md) +[Scale a Cluster](https://docs.pingcap.com/tidb/dev/scale-tidb-using-tiup) - - +[Back Up Cluster Data](https://docs.pingcap.com/tidb/dev/br-usage-backup) + +[Restore Cluster Data](https://docs.pingcap.com/tidb/dev/br-usage-restore) + +[Daily Check](https://docs.pingcap.com/tidb/dev/daily-check) + +[Maintain TiDB Using TiUP](https://docs.pingcap.com/tidb/dev/maintain-tidb-using-tiup) + + + + + +[Use Prometheus and Grafana](https://docs.pingcap.com/tidb/dev/tidb-monitoring-framework) + +[Monitoring API](https://docs.pingcap.com/tidb/dev/tidb-monitoring-api) + +[Alert Rules](https://docs.pingcap.com/tidb/dev/alert-rules) + + + + + +[Tuning Overview](https://docs.pingcap.com/tidb/dev/performance-tuning-overview) + +[Tuning Methods](https://docs.pingcap.com/tidb/dev/performance-tuning-methods) + +[Tune OLTP Performance](https://docs.pingcap.com/tidb/dev/performance-tuning-practices) + +[Tune Operating System](https://docs.pingcap.com/tidb/dev/tune-operating-system) + +[Tune Configurations](https://docs.pingcap.com/tidb/dev/configure-memory-usage) + +[Tune SQL Performance](https://docs.pingcap.com/tidb/dev/sql-tuning-overview) + + + + + +[TiUP](https://docs.pingcap.com/tidb/dev/tiup-overview) + +[Dumpling](https://docs.pingcap.com/tidb/dev/dumpling-overview) + +[TiDB Lightning](https://docs.pingcap.com/tidb/dev/tidb-lightning-overview) + +[Data Migration](https://docs.pingcap.com/tidb/dev/dm-overview) + +[Backup & Restore (BR)](https://docs.pingcap.com/tidb/dev/backup-and-restore-overview) + +[TiCDC](https://docs.pingcap.com/tidb/dev/ticdc-overview) + +[PingCAP Clinic](https://docs.pingcap.com/tidb/dev/clinic-introduction) + +[TiDB Operator](https://docs.pingcap.com/tidb/dev/tidb-operator-overview) + +[TiSpark](https://docs.pingcap.com/tidb/dev/tispark-overview) + + + + diff --git a/basic-features.md b/basic-features.md index 9694853e00ddc..ef0fbcc0adcc4 100644 --- a/basic-features.md +++ b/basic-features.md @@ -92,7 +92,7 @@ This document lists the features supported in each TiDB version. Note that suppo | [Auto increment](/auto-increment.md) | Y | Y | Y | Y | Y | Y | Y | Y | | [Auto random](/auto-random.md) | Y | Y | Y | Y | Y | Y | Y | Y | | [DDL algorithm assertions](/sql-statements/sql-statement-alter-table.md) | Y | Y | Y | Y | Y | Y | Y | Y | -| Multi schema change: add column(s) | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | +| [Multi-schema change: add columns](/system-variables.md#tidb_enable_change_multi_schema) | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | | [Change column type](/sql-statements/sql-statement-modify-column.md) | Y | Y | Y | Y | Y | Y | N | N | | [Temporary tables](/temporary-tables.md) | Y | Y | Y | Y | N | N | N | N | @@ -125,7 +125,7 @@ This document lists the features supported in each TiDB version. Note that suppo | ------------------------------------------------------------ | :--: | :--: | ------------ | :----------: | :----------: | :----------: | :----------: | :----------: | | [CMSketch](/statistics.md) | Disabled by default | Disabled by default | Disabled by default | Disabled by default | Y | Y | Y | Y | | [Histograms](/statistics.md) | Y | Y | Y | Y | Y | Y | Y | Y | -| [Extended statistics (multiple columns)](/statistics.md) | Experimental | Experimental| Experimental | Experimental | Experimental | Experimental | Experimental | N | +| Extended statistics (multiple columns) | Experimental | Experimental| Experimental | Experimental | Experimental | Experimental | Experimental | N | | [Statistics feedback](/statistics.md#automatic-update) | Deprecated | Deprecated | Deprecated | Experimental | Experimental | Experimental | Experimental | Experimental | | [Automatically update statistics](/statistics.md#automatic-update) | Y | Y | Y | Y | Y | Y | Y | Y | | [Fast Analyze](/system-variables.md#tidb_enable_fast_analyze) | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | @@ -175,7 +175,7 @@ This document lists the features supported in each TiDB version. Note that suppo | [Built-in physical backup](/br/backup-and-restore-use-cases.md) | Y | Y | Y | Y | Y | Y | Y | Y | | [Global Kill](/sql-statements/sql-statement-kill.md) | Y | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | | [Lock View](/information-schema/information-schema-data-lock-waits.md) | Y | Y | Y | Y | Y | Experimental | Experimental | Experimental | -| [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md) | Experimental | Experimental| Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | +| [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md) | Y | Y | Y | Y | Y | Y | Y | Y | | [`SET CONFIG`](/dynamic-config.md) | Y | Experimental| Experimental | Experimental | Experimental | Experimental | Experimental | Experimental | | [DM WebUI](/dm/dm-webui-guide.md) | Experimental | Experimental | N | N | N | N | N | N | diff --git a/br/rawkv-backup-and-restore.md b/br/rawkv-backup-and-restore.md index 84e7ee037fa9f..1bd7446b2c961 100644 --- a/br/rawkv-backup-and-restore.md +++ b/br/rawkv-backup-and-restore.md @@ -5,11 +5,11 @@ summary: Learn how to back up and restore RawKV using BR. # Back Up and Restore RawKV -Backup & Restore (BR) supports backing up and restoring RawKV (used by TiKV and PD) in particular. This document describes how to back up and restore RawKV. - > **Warning:** > -> This feature is in the experiment, without being thoroughly tested. It is **NOT** recommended that you use it in the production environment. +> This feature is deprecated since TiDB v6.2.0. + +TiKV and PD can constitute a KV database when used without TiDB, which is called RawKV. Backup & Restore (BR) supports data backup and restore for products that use RawKV. This document describes how to back up and restore RawKV. ## Back up RawKV diff --git a/command-line-flags-for-tikv-configuration.md b/command-line-flags-for-tikv-configuration.md index 5e2c63568c7b2..86c5e8e810e70 100644 --- a/command-line-flags-for-tikv-configuration.md +++ b/command-line-flags-for-tikv-configuration.md @@ -50,6 +50,31 @@ TiKV supports some readable unit conversions for command line parameters. - Default: `0` (unlimited) - PD uses this flag to determine how to balance the TiKV servers. (Tip: you can use 10GB instead of 1073741824) +## `--config-info ` + +- When this flag is used, available configuration values are listed according to `FORMAT` and then exit. +- Value option for `FORMAT`: `json`. Currently, only JSON format is supported. +- Only the configuration name (Name), default value (DefaultValue) and current value (ValueInFile) are listed in the output JSON. If the `-C` or `--config` is specified, the current value and the default value of configuration items in the file are listed together, and other items without `-C` or `--config` specified only have default values. The following is an example: + + ```json + { + "Component": "TiKV Server", + "Version": "6.2.0", + "Parameters": [ + { + "Name": "log-level", + "DefaultValue": "info", + "ValueInFile": "warn" + }, + { + "Name": "log-file", + "DefaultValue": "" + }, + ... + ] + } + ``` + ## `--data-dir` - The path to the data directory diff --git a/configure-load-base-split.md b/configure-load-base-split.md index 1e264047bdb09..334cb4cea542f 100644 --- a/configure-load-base-split.md +++ b/configure-load-base-split.md @@ -23,15 +23,25 @@ Previously, the solution to this problem was to manually execute a command to sp ## Implementation principles -Load Base Split automatically splits the Region based on statistics. It identifies the Regions whose read load consistently exceeds the threshold for 10 seconds, and splits these Regions at a proper position. When choosing the split position, Load Base Split tries to balance the access load of both Regions after the split and avoid access across Regions. +Load Base Split automatically splits the Region based on statistics. It identifies the Regions whose read load or CPU usage consistently exceeds the threshold for 10 seconds, and splits these Regions at a proper position. When choosing the split position, Load Base Split tries to balance the access load of both Regions after the split and avoid access across Regions. The Region split by Load Base Split will not be merged quickly. On the one hand, PD's `MergeChecker` skips the hot Regions; on the other hand, PD also determines whether to merge two Regions according to `QPS` in the heartbeat information, to avoid the merging of two Regions with high `QPS`. ## Usage -The Load Base Split feature is currently controlled by the `split.qps-threshold` parameter (QPS threshold) and `split.byte-threshold` parameter (traffic threshold). If the sum of all types of read requests per second for a Region exceeds the QPS threshold or traffic threshold for 10 consecutive seconds, PD splits the Region. +The Load Base Split feature is currently controlled by the following parameters: -Load Base Split is enabled by default, but the parameter is set to a rather high value. `split.qps-threshold` defaults to `3000` and `split.byte-threshold` defaults to 30MB/s. If you want to disable this feature, set the two thresholds high enough at the same time. +- `split.qps-threshold`: The QPS threshold at which a Region is identified as a hotspot. The default value is `3000` per second. +- `split.byte-threshold`: The traffic threshold at which a Region is identified as a hotspot. The unit is byte and the default value is 30 MiB per second. (Introduced in v5.0) +- `split.region-cpu-overload-threshold-ratio`: The CPU usage threshold (the percentage of CPU time of the read thread pool) at which a Region is identified as a hotspot. The default value is `0.25`. (Introduced in v6.2.0) + +If a Region meets one of the following conditions for 10 consecutive seconds, TiKV tries to split the Region: + +- the sum of its read requests exceeds `split.qps-threshold`. +- its traffic exceeds `split.byte-threshold`. +- its CPU usage in the Unified Read Pool exceeds `split.region-cpu-overload-threshold-ratio`. + +Load Base Split is enabled by default, but the parameter is set to a rather high value. If you want to disable this feature, set `split.qps-threshold` and `split.byte-threshold` high enough and set `split.region-cpu-overload-threshold-ratio` to `0` at the same time. To modify the parameter, take either of the following two methods: diff --git a/develop/dev-guide-build-cluster-in-cloud.md b/develop/dev-guide-build-cluster-in-cloud.md index 1f18550ba2b15..9782c9797b3b4 100644 --- a/develop/dev-guide-build-cluster-in-cloud.md +++ b/develop/dev-guide-build-cluster-in-cloud.md @@ -1,11 +1,11 @@ --- -title: Build a TiDB Cluster in TiDB Cloud (DevTier) +title: Build a TiDB Cluster in TiDB Cloud (Developer Tier) summary: Learn how to build a TiDB cluster in TiDB Cloud (Developer Tier) and connect to a TiDB Cloud cluster. --- -# Build a TiDB cluster in TiDB Cloud (DevTier) +# Build a TiDB Cluster in TiDB Cloud (Developer Tier) This document walks you through the quickest way to get started with TiDB. You will use [TiDB Cloud](https://en.pingcap.com/tidb-cloud) to create a free TiDB cluster, connect to it, and run a sample application on it. @@ -15,8 +15,8 @@ If you need to run TiDB on your local machine, see [Starting TiDB Locally](/quic 1. If you do not have a TiDB Cloud account, click [TiDB Cloud](https://tidbcloud.com/free-trial) to sign up for an account. 2. [Sign in](https://tidbcloud.com/) with your TiDB Cloud account. -3. To create a Developer Tier cluster for one year free, you can either select the **Developer Tier** plan on the [plan page](https://tidbcloud.com/console/plans) or click [Create a Cluster (Dev Tier)](https://tidbcloud.com/console/create-cluster?tier=dev). -4. On the **Create a Cluster (Dev Tier)** page, set up your cluster name, password, cloud provider (for now, only AWS is available for Developer Tier), and region (a nearby region is recommended). Then click **Create** to create your cluster. +3. To create a Developer Tier cluster for one year free, you can either select the **Developer Tier** plan on the [plan page](https://tidbcloud.com/console/plans) or click [Create a Cluster (Developer Tier)](https://tidbcloud.com/console/create-cluster?tier=dev). +4. On the **Create a Cluster (Developer Tier)** page, set up your cluster name, password, cloud provider (for now, only AWS is available for Developer Tier), and region (a nearby region is recommended). Then click **Create** to create your cluster. 5. Your TiDB Cloud cluster will be created in approximately 5 to 15 minutes. You can check the creation progress at [Active Clusters](https://tidbcloud.com/console/clusters). 6. After creating a cluster, on the **Active Clusters** page, click the name of your newly created cluster to navigate to the cluster control panel. diff --git a/develop/dev-guide-choose-driver-or-orm.md b/develop/dev-guide-choose-driver-or-orm.md index a29672418624f..2dcfbd48a650f 100644 --- a/develop/dev-guide-choose-driver-or-orm.md +++ b/develop/dev-guide-choose-driver-or-orm.md @@ -34,14 +34,11 @@ TiDB provides the following two support levels for Java: Support level: **Full** -You can follow the [MySQL documentation](https://dev.mysql.com/doc/connector-j/8.0/en/) to download and configure a Java JDBC driver. +You can follow the [MySQL documentation](https://dev.mysql.com/doc/connector-j/5.1/en/) to download and configure a Java JDBC driver. > **Note:** > -> Version `8.0.16` or later is strongly recommended, which fixes two Common Vulnerabilities and Exposures (CVEs): -> -> - Fix CVE-2019-2692 directly -> - Fix CVE-2021-22569 indirectly +> It is strongly recommended to use version 5.1.49, which is the latest version of JDBC 5.1. Since there is an [unresolved bug](https://bugs.mysql.com/bug.php?id=106252) in the current version 8.0.29, which might cause threads to hang when using TiDB. It is recommended that you do not upgrade to version 8.0 until MySQL JDBC 8.0 merges this fix. For an example of how to build a complete application, see [Build a Simple CRUD App with TiDB and JDBC](/develop/dev-guide-sample-application-java.md). @@ -88,7 +85,7 @@ If you are using **Maven**, add the following to your ` mysql mysql-connector-java - 8.0.28 + 5.1.49 ``` @@ -98,7 +95,7 @@ If you are using **Gradle**, add the following to your `dependencies`: ```gradle implementation 'org.hibernate:hibernate-core:6.0.0.CR2' -implementation 'mysql:mysql-connector-java:8.0.28' +implementation 'mysql:mysql-connector-java:5.1.49' ``` - For an example of using Hibernate to build a TiDB application by native Java, see [Build a Simple CRUD App with TiDB and Java](/develop/dev-guide-sample-application-java.md). diff --git a/develop/dev-guide-connection-parameters.md b/develop/dev-guide-connection-parameters.md index 9369ca6cd7443..7eba85f417d67 100644 --- a/develop/dev-guide-connection-parameters.md +++ b/develop/dev-guide-connection-parameters.md @@ -279,6 +279,6 @@ After it is configured, you can check the monitoring to see a decreased number o #### Timeout-related parameters -TiDB provides two MySQL-compatible parameters to control the timeout: **wait_timeout** and **max_execution_time**. These two parameters respectively control the connection idle timeout with the Java application and the timeout of the SQL execution in the connection; that is to say, these parameters control the longest idle time and the longest busy time for the connection between TiDB and the Java application. The default value of both parameters is `0`, which by default allows the connection to be infinitely idle and infinitely busy (an infinite duration for one SQL statement to execute). +TiDB provides two MySQL-compatible parameters to control the timeout: [`wait_timeout`](/system-variables.md#wait_timeout) and [`max_execution_time`](/system-variables.md#max_execution_time). These two parameters respectively control the connection idle timeout with the Java application and the timeout of the SQL execution in the connection; that is to say, these parameters control the longest idle time and the longest busy time for the connection between TiDB and the Java application. Since TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. The default value of `max_execution_time` is `0`, which means the maximum execution time of a SQL statement is unlimited. However, in an actual production environment, idle connections and SQL statements with excessively long execution time negatively affect databases and applications. To avoid idle connections and SQL statements that are executed for too long, you can configure these two parameters in your application's connection string. For example, set `sessionVariables=wait_timeout=3600` (1 hour) and `sessionVariables=max_execution_time=300000` (5 minutes). diff --git a/develop/dev-guide-create-database.md b/develop/dev-guide-create-database.md index aee4e29f43a7f..6007e735a934c 100644 --- a/develop/dev-guide-create-database.md +++ b/develop/dev-guide-create-database.md @@ -11,7 +11,7 @@ This document describes how to create a database using SQL and various programmi Before creating a database, do the following: -- [Build a TiDB Cluster in TiDB Cloud Developer Tier](/develop/dev-guide-build-cluster-in-cloud.md). +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md). - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md). ## What is database diff --git a/develop/dev-guide-create-secondary-indexes.md b/develop/dev-guide-create-secondary-indexes.md index 5c4b383387f2e..9901afef07dd5 100644 --- a/develop/dev-guide-create-secondary-indexes.md +++ b/develop/dev-guide-create-secondary-indexes.md @@ -11,7 +11,7 @@ This document describes how to create a secondary index using SQL and various pr Before creating a secondary index, do the following: -- [Build a TiDB Cluster in TiDB Cloud Developer Tier](/develop/dev-guide-build-cluster-in-cloud.md). +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md). - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md). - [Create a Database](/develop/dev-guide-create-database.md). - [Create a Table](/develop/dev-guide-create-table.md). diff --git a/develop/dev-guide-create-table.md b/develop/dev-guide-create-table.md index 5a45d58c6b99d..c9913c2763fee 100644 --- a/develop/dev-guide-create-table.md +++ b/develop/dev-guide-create-table.md @@ -11,7 +11,7 @@ This document introduces how to create tables using the SQL statement and the re Before reading this document, make sure that the following tasks are completed: -- [Build a TiDB Cluster in TiDB Cloud (DevTier)](/develop/dev-guide-build-cluster-in-cloud.md). +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md). - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md). - [Create a Database](/develop/dev-guide-create-database.md). @@ -286,7 +286,7 @@ ALTER TABLE `bookshop`.`ratings` SET TIFLASH REPLICA 1; > **Note:** > -> If your cluster does not contain **TiFlash** nodes, this SQL statement will report an error: `1105 - the tiflash replica count: 1 should be less than the total tiflash server count: 0`. You can use [Build a TiDB Cluster in TiDB Cloud (DevTier)](/develop/dev-guide-build-cluster-in-cloud.md#step-1-create-a-free-cluster) to create a free cluster that includes **TiFlash**. +> If your cluster does not contain **TiFlash** nodes, this SQL statement will report an error: `1105 - the tiflash replica count: 1 should be less than the total tiflash server count: 0`. You can use [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md#step-1-create-a-free-cluster) to create a free cluster that includes **TiFlash**. Then you can go on to perform the following query: diff --git a/develop/dev-guide-delete-data.md b/develop/dev-guide-delete-data.md index aefc13996ab3c..98c3893b269d2 100644 --- a/develop/dev-guide-delete-data.md +++ b/develop/dev-guide-delete-data.md @@ -11,7 +11,7 @@ This document describes how to use the [DELETE](/sql-statements/sql-statement-de Before reading this document, you need to prepare the following: -- [Build a TiDB Cluster in TiDB Cloud (DevTier)](/develop/dev-guide-build-cluster-in-cloud.md) +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md) - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md), [Create a Database](/develop/dev-guide-create-database.md), [Create a Table](/develop/dev-guide-create-table.md), and [Create Secondary Indexes](/develop/dev-guide-create-secondary-indexes.md) - [Insert Data](/develop/dev-guide-insert-data.md) diff --git a/develop/dev-guide-get-data-from-single-table.md b/develop/dev-guide-get-data-from-single-table.md index 6a93c24728db5..b9e8fcdadd7b3 100644 --- a/develop/dev-guide-get-data-from-single-table.md +++ b/develop/dev-guide-get-data-from-single-table.md @@ -1,11 +1,11 @@ --- -title: Query data from a single table +title: Query Data from a Single Table summary: This document describes how to query data from a single table in a database. --- -# Query data from a single table +# Query Data from a Single Table This document describes how to use SQL and various programming languages to query data from a single table in a database. diff --git a/develop/dev-guide-insert-data.md b/develop/dev-guide-insert-data.md index d13602b2c33a5..aea7b9d7b8bd8 100644 --- a/develop/dev-guide-insert-data.md +++ b/develop/dev-guide-insert-data.md @@ -13,7 +13,7 @@ This document describes how to insert data into TiDB by using the SQL language w Before reading this document, you need to prepare the following: -- [Build a TiDB Cluster in TiDB Cloud(DevTier)](/develop/dev-guide-build-cluster-in-cloud.md). +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md). - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md), [Create a Database](/develop/dev-guide-create-database.md), [Create a Table](/develop/dev-guide-create-table.md), and [Create Secondary Indexes](/develop/dev-guide-create-secondary-indexes.md) ## Insert rows diff --git a/develop/dev-guide-optimistic-and-pessimistic-transaction.md b/develop/dev-guide-optimistic-and-pessimistic-transaction.md index 330a4920a4539..170e320d38ee1 100644 --- a/develop/dev-guide-optimistic-and-pessimistic-transaction.md +++ b/develop/dev-guide-optimistic-and-pessimistic-transaction.md @@ -1,9 +1,9 @@ --- -title: Optimistic transaction and pessimistic transaction +title: Optimistic Transactions and Pessimistic Transactions summary: Learn about optimistic and pessimistic transactions in TiDB. --- -# Optimistic transactions and pessimistic transactions +# Optimistic Transactions and Pessimistic Transactions The [optimistic transaction](/optimistic-transaction.md) model commits the transaction directly, and rolls back when there is a conflict. By contrast, the [pessimistic transaction](/pessimistic-transaction.md) model tries to lock the resources that need to be modified before actually committing the transaction, and only starts committing after ensuring that the transaction can be successfully executed. diff --git a/develop/dev-guide-optimize-sql-overview.md b/develop/dev-guide-optimize-sql-overview.md index 12b4b44d7e434..a02898420e7a8 100644 --- a/develop/dev-guide-optimize-sql-overview.md +++ b/develop/dev-guide-optimize-sql-overview.md @@ -1,9 +1,9 @@ --- -title: Overview of Optimizing SQL Performance +title: Overview of Optimizing SQL Performance summary: Provides an overview of SQL performance tuning for TiDB application developers. --- -# Overview of Optimizing SQL Performance +# Overview of Optimizing SQL Performance This document introduces how to optimize the performance of SQL statements in TiDB. To get good performance, you can start with the following aspects: diff --git a/develop/dev-guide-overview.md b/develop/dev-guide-overview.md index 9a2e1593556d1..535a7441790f4 100644 --- a/develop/dev-guide-overview.md +++ b/develop/dev-guide-overview.md @@ -1,5 +1,5 @@ --- -title: Developer Overview +title: Developer Guide Overview summary: Introduce the overview of the developer guide. aliases: ['/tidb/dev/connectors-and-apis/','/tidb/stable/connectors-and-apis/','/appdev/dev/','/tidb/dev/dev-guide-outdated-for-laravel'] --- diff --git a/develop/dev-guide-sql-development-specification.md b/develop/dev-guide-sql-development-specification.md index e30b110f2c25a..d0254495eb946 100644 --- a/develop/dev-guide-sql-development-specification.md +++ b/develop/dev-guide-sql-development-specification.md @@ -3,7 +3,7 @@ title: SQL Development Specifications summary: Learn about the SQL development specifications for TiDB. --- -# SQL Development Specification +# SQL Development Specifications This document introduces some general development specifications for using SQL. diff --git a/develop/dev-guide-third-party-support.md b/develop/dev-guide-third-party-support.md new file mode 100644 index 0000000000000..c5c6966aa75c0 --- /dev/null +++ b/develop/dev-guide-third-party-support.md @@ -0,0 +1,68 @@ +--- +title: Third-Party Libraries Support Maintained by PingCAP +summary: Learn about third-party libraries support maintained by PingCAP. +--- + +# Third-Party Libraries Support Maintained by PingCAP + +TiDB is highly compatible with the MySQL 5.7 protocol, so most of the MySQL drivers, ORM frameworks, and other tools that adapt to MySQL are compatible with TiDB. This document focuses on these tools and their support levels for TiDB. + +## Support Level + +PingCAP works with the community and provides the following support levels for third-party tools: + +- **_Full_**: Indicates that TiDB is already compatible with most functionalities of the corresponding third-party tool, and maintains compatibility with its newer versions. PingCAP will periodically conduct compatibility tests with the latest version of the tool. +- **_Compatible_**: Indicates that because the corresponding third-party tool is adapted to MySQL and TiDB is highly compatible with the MySQL protocol, so TiDB can use most features of the tool. However, PingCAP has not completed a full test on all features of the tool, which might lead to some unexpected behaviors. + +> **Warning:** +> +> Unless specified, support for [Application retry and error handling](/develop/dev-guide-transaction-troubleshoot.md#application-retry-and-error-handling) is not included for **Driver** or **ORM frameworks**. + +If you encounter problems when connecting to TiDB using the tools listed in this document, please submit an [issue](https://github.com/pingcap/tidb/issues/new?assignees=&labels=type%2Fquestion&template=general-question.md) on GitHub with details to promote support on this tool. + +## Driver + +| Language | Driver | Latest tested version | Support level | TiDB adapter | Tutorial | +|------------|--------------------------------------------------------------------------|---------|------|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| +| C | [MySQL Connector/C](https://downloads.mysql.com/archives/c-c/) | 6.1.11 | Full | N/A | N/A | +| C#(.Net) | [MySQL Connector/NET](https://downloads.mysql.com/archives/c-net/) | 8.0.28 | Compatible | N/A | N/A | +| C#(.Net) | [MySQL Connector/ODBC](https://downloads.mysql.com/archives/c-odbc/) | 8.0.28 | Compatible | N/A | N/A | +| Go | [go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) | v1.6.0 | Full | N/A | [Build a Simple CRUD App with TiDB and Golang](/develop/dev-guide-sample-application-golang.md) | +| Java | [JDBC](https://dev.mysql.com/downloads/connector/j/) | 5.1.46; 8.0.29 | Full | 5.1.46: N/A; 8.0.29: [pingcap/mysql-connector-j](https://github.com/pingcap/mysql-connector-j/tree/release/8.0) | [Build a Simple CRUD App with TiDB and Java](/develop/dev-guide-sample-application-java.md) | +| JavaScript | [mysql](https://github.com/mysqljs/mysql) | v2.18.1 | Compatible | N/A | N/A | +| PHP | [MySQL Connector/PHP](https://downloads.mysql.com/archives/c-php/) | 5.0.37 | Compatible | N/A | N/A | +| Python | [MySQL Connector/Python](https://downloads.mysql.com/archives/c-python/) | 8.0.28 | Compatible | N/A | N/A | + +## ORM + +| Language | ORM framework | Latest tested version | Support level | TiDB adapter | Tutorial | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|------|--------------------------------------------------------|--------------------------------------------------------------------------------| +| Go | [gorm](https://github.com/go-gorm/gorm) | v1.23.5 | Full | N/A | [Build a Simple CRUD App with TiDB and Golang](/develop/dev-guide-sample-application-golang.md) | +| Go | [beego](https://github.com/beego/beego) | v2.0.3 | Full | N/A | N/A | +| Go | [upper/db](https://github.com/upper/db) | v4.5.2 | Full | N/A | N/A | +| Go | [xorm](https://gitea.com/xorm/xorm) | v1.3.1 | Full | N/A | N/A | +| Java | [Hibernate](https://hibernate.org/orm/) | 6.1.0.Final | Full | N/A | [Build a Simple CRUD App with TiDB and Java](/develop/dev-guide-sample-application-java.md) | +| Java | [MyBatis](https://mybatis.org/mybatis-3/) | v3.5.10 | Full | N/A | [Build a Simple CRUD App with TiDB and Java](/develop/dev-guide-sample-application-java.md) | +| Java | [Spring Data JPA](https://spring.io/projects/spring-data-jpa/) | 2.7.2 | Full | N/A | [Build a TiDB Application Using Spring Boot](/develop/dev-guide-sample-application-spring-boot.md) | +| Java | [jOOQ](https://github.com/jOOQ/jOOQ) | v3.16.7 (Open Source) | Full | N/A | N/A | +| JavaScript/TypeScript | [sequelize](https://www.npmjs.com/package/sequelize) | v6.20.1 | Compatible | N/A | N/A | +| JavaScript/TypeScript | [Knex.js](https://knexjs.org/) | v1.0.7 | Compatible | N/A | N/A | +| JavaScript/TypeScript | [Prisma Client](https://www.prisma.io/) | 3.15.1 | Compatible | N/A | N/A | +| JavaScript/TypeScript | [TypeORM](https://www.npmjs.com/package/typeorm) | v0.3.6 | Compatible | N/A | N/A | +| PHP | [laravel](https://laravel.com/) | v9.1.10 | Compatible | [laravel-tidb](https://github.com/colopl/laravel-tidb) | N/A | +| Python | [Django](https://pypi.org/project/Django/) | v4.0.5 | Compatible | N/A | N/A | +| Python | [peewee](https://github.com/coleifer/peewee/) | v3.14.10 | Compatible | N/A | N/A | +| Python | [PonyORM](https://ponyorm.org/) | v0.7.16 | Compatible | N/A | N/A | +| Python | [SQLAlchemy](https://www.sqlalchemy.org/) | v1.4.37 | Compatible | N/A | N/A | + +## GUI + +| GUI | Latest tested version | Support level | Tutorial | +|-----------------------------------------------|---------|------|-----| +| [DBeaver](https://dbeaver.io/) | 22.1.0 | Compatible | N/A | +| [Navicat for MySQL](https://www.navicat.com/) | 16.0.14 | Compatible | N/A | + +| IDE | Latest tested version | Support level | Tutorial | +| ------------------------------------------------ | ------- | ---- | ---- | +| [DataGrip](https://www.jetbrains.com/datagrip/) | N/A | Compatible | N/A | +| [IntelliJ IDEA](https://www.jetbrains.com/idea/) | N/A | Compatible | N/A | diff --git a/develop/dev-guide-tidb-crud-sql.md b/develop/dev-guide-tidb-crud-sql.md index ce61758c9e31c..d40ceb9a78794 100644 --- a/develop/dev-guide-tidb-crud-sql.md +++ b/develop/dev-guide-tidb-crud-sql.md @@ -9,7 +9,7 @@ This document briefly introduces how to use TiDB's CURD SQL. ## Before you start -Please make sure you are connected to a TiDB cluster. If not, refer to [Build a TiDB Cluster in TiDB Cloud (DevTier)](/develop/dev-guide-build-cluster-in-cloud.md#step-1-create-a-free-cluster) to create a free cluster. +Please make sure you are connected to a TiDB cluster. If not, refer to [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md#step-1-create-a-free-cluster) to create a free cluster. ## Explore SQL with TiDB diff --git a/develop/dev-guide-timeouts-in-tidb.md b/develop/dev-guide-timeouts-in-tidb.md index 94119a3c0e8a6..aad13f226bf20 100644 --- a/develop/dev-guide-timeouts-in-tidb.md +++ b/develop/dev-guide-timeouts-in-tidb.md @@ -33,7 +33,7 @@ MySQL JDBC's query timeout setting for `setQueryTimeout()` does **_NOT_** work f TiDB provides the following MySQL-compatible timeout control parameters. -- **wait_timeout**, controls the non-interactive idle timeout for the connection to Java applications. The value is `0` by default, which allows the connection to be idle indefinitely. +- **wait_timeout**, controls the non-interactive idle timeout for the connection to Java applications. Since TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. - **interactive_timeout**, controls the interactive idle timeout for the connection to Java applications. The value is `8 hours` by default. - **max_execution_time**, controls the timeout for SQL execution in the connection. The value is `0` by default, which allows the connection to be infinitely busy, that is, an SQL statement is executed for an infinitely long time. diff --git a/develop/dev-guide-transaction-troubleshoot.md b/develop/dev-guide-transaction-troubleshoot.md index 6050d85d40520..4dee540f8771e 100644 --- a/develop/dev-guide-transaction-troubleshoot.md +++ b/develop/dev-guide-transaction-troubleshoot.md @@ -104,7 +104,7 @@ while True: if (error.code != "9007" && error.code != "8028" && error.code != "8002" && error.code != "8022"): raise error else: - connnection.exec('ROLLBACK'); + connection.exec('ROLLBACK') # Capture the error types that require application-side retry, # wait for a short period of time, @@ -113,7 +113,7 @@ while True: sleep(sleep_ms) # make sure your sleep() takes milliseconds ``` -> Note: +> **Note:** > > If you frequently encounter `Error 9007: Write conflict`, you may need to check your schema design and the data access patterns of your workload to find the root cause of the conflict and try to avoid conflicts by a better design. > For information about how to troubleshoot and resolve transaction conflicts, see [Troubleshoot Lock Conflicts](/troubleshoot-lock-conflicts.md). diff --git a/develop/dev-guide-update-data.md b/develop/dev-guide-update-data.md index 8e0d5fb962d0c..f6f4f81605bb0 100644 --- a/develop/dev-guide-update-data.md +++ b/develop/dev-guide-update-data.md @@ -14,7 +14,7 @@ This document describes how to use the following SQL statements to update the da Before reading this document, you need to prepare the following: -- [Build a TiDB Cluster in TiDB Cloud(DevTier)](/develop/dev-guide-build-cluster-in-cloud.md). +- [Build a TiDB Cluster in TiDB Cloud (Developer Tier)](/develop/dev-guide-build-cluster-in-cloud.md). - Read [Schema Design Overview](/develop/dev-guide-schema-design-overview.md), [Create a Database](/develop/dev-guide-create-database.md), [Create a Table](/develop/dev-guide-create-table.md), and [Create Secondary Indexes](/develop/dev-guide-create-secondary-indexes.md). - If you want to `UPDATE` data, you need to [insert data](/develop/dev-guide-insert-data.md) first. diff --git a/dynamic-config.md b/dynamic-config.md index e1a40c78bb854..5bf0c480f24e8 100644 --- a/dynamic-config.md +++ b/dynamic-config.md @@ -122,6 +122,7 @@ The following TiKV configuration items can be modified online: | Configuration item | Description | | :--- | :--- | +| log.level | The log level. | | `raftstore.raft-max-inflight-msgs` | The number of Raft logs to be confirmed. If this number is exceeded, the Raft state machine slows down log sending. | | `raftstore.raft-log-gc-tick-interval` | The time interval at which the polling task of deleting Raft logs is scheduled | | `raftstore.raft-log-gc-threshold` | The soft limit on the maximum allowable number of residual Raft logs | @@ -205,8 +206,9 @@ The following TiKV configuration items can be modified online: | `storage.block-cache.capacity` | The size of shared block cache (supported since v4.0.3) | | `storage.scheduler-worker-pool-size` | The number of threads in the Scheduler thread pool | | `backup.num-threads` | The number of backup threads (supported since v4.0.3) | -| `split.qps-threshold` | The threshold to execute `load-base-split` on a Region. If the QPS of read requests for a Region exceeds `qps-threshold` for a consecutive period of time, this Region should be split.| -| `split.byte-threshold` | The threshold to execute `load-base-split` on a Region. If the traffic of read requests for a Region exceeds the `byte-threshold` for a consecutive period of time, this Region should be split. | +| `split.qps-threshold` | The threshold to execute `load-base-split` on a Region. If the QPS of read requests for a Region exceeds `qps-threshold` for 10 consecutive seconds, this Region should be split.| +| `split.byte-threshold` | The threshold to execute `load-base-split` on a Region. If the traffic of read requests for a Region exceeds the `byte-threshold` for 10 consecutive seconds, this Region should be split. | +| `split.region-cpu-overload-threshold-ratio` | The threshold to execute `load-base-split` on a Region. If the CPU usage in the Unified Read Pool for a Region exceeds the `region-cpu-overload-threshold-ratio` for 10 consecutive seconds, this Region should be split. (supported since v6.2.0) | | `split.split-balance-score` | The parameter of `load-base-split`, which ensures the load of the two split Regions is as balanced as possible. The smaller the value is, the more balanced the load is. But setting it too small might cause split failure. | | `split.split-contained-score` | The parameter of `load-base-split`. The smaller the value, the fewer cross-Region visits after Region split. | | `cdc.min-ts-interval` | The time interval at which Resolved TS is forwarded | diff --git a/experimental-features.md b/experimental-features.md index 0096cb41565c9..1ef72dbd563ed 100644 --- a/experimental-features.md +++ b/experimental-features.md @@ -16,15 +16,12 @@ This document introduces the experimental features of TiDB in different versions ## Stability -+ Improve the stability of the optimizer's choice of indexes (Introduced in v5.0) - + Extend the statistics feature by collecting the multi-column order dependency information. - + Refactor the statistics module, including deleting the `TopN` value from `CMSKetch` and the histogram, and adding NDV information for histogram buckets of each table index. For details, see descriptions about [Statistics - `tidb_analyze_version = 2`](/statistics.md). ++ Improve the stability of the optimizer's choice of indexes: extend the statistics feature by collecting the multi-column order dependency information (Introduced in v5.0). + When TiKV is deployed with limited resources, if the foreground of TiKV processes too many read and write requests, the CPU resources used by the background are occupied to help process such requests, which affects the performance stability of TiKV. To avoid this situation, you can use the [Quota Limiter](/tikv-configuration-file.md#quota) to limit the CPU resources to be used by the foreground. (Introduced in v6.0) ## Scheduling -+ Cascading Placement Rules feature. It is a replica rule system that guides PD to generate corresponding schedules for different types of data. By combining different scheduling rules, you can finely control the attributes of any continuous data range, such as the number of replicas, the storage location, the host type, whether to participate in Raft election, and whether to act as the Raft leader. See [Cascading Placement Rules](/configure-placement-rules.md) for details. (Introduced in v4.0) -+ Elastic scheduling feature. It enables the TiDB cluster to dynamically scale out and in on Kubernetes based on real-time workloads, which effectively reduces the stress during your application's peak hours and saves overheads. See [Enable TidbCluster Auto-scaling](https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tidb-cluster-auto-scaling) for details. (Introduced in v4.0) +Elastic scheduling feature. It enables the TiDB cluster to dynamically scale out and in on Kubernetes based on real-time workloads, which effectively reduces the stress during your application's peak hours and saves overheads. See [Enable TidbCluster Auto-scaling](https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tidb-cluster-auto-scaling) for details. (Introduced in v4.0) ## SQL @@ -32,17 +29,8 @@ This document introduces the experimental features of TiDB in different versions + [Generated Columns](/generated-columns.md) (Introduced in v2.1) + [User-Defined Variables](/user-defined-variables.md) (Introduced in v2.1) + [JSON data type](/data-type-json.md) and [JSON functions](/functions-and-operators/json-functions.md) (Introduced in v2.1) -+ [View](/information-schema/information-schema-views.md) (Introduced in v2.1) + [`ALTER TABLE ... COMPACT`](/sql-statements/sql-statement-alter-table-compact.md) (Introduced in v6.1.0) -## Configuration management - -+ [SHOW CONFIG](/sql-statements/sql-statement-show-config.md) (Introduced in v4.0) - -## Data sharing and subscription - -+ [Integrate TiCDC with Kafka Connect (Confluent Platform)](/ticdc/integrate-confluent-using-ticdc.md) (Introduced in v5.0) - ## Storage + [Disable Titan](/storage-engine/titan-configuration.md#disable-titan-experimental) (Introduced in v4.0) diff --git a/media/tidb-cloud/Project-CIDR.png b/media/tidb-cloud/Project-CIDR.png deleted file mode 100644 index ade4f03041135..0000000000000 Binary files a/media/tidb-cloud/Project-CIDR.png and /dev/null differ diff --git a/media/tidb-cloud/Project-CIDR1.png b/media/tidb-cloud/Project-CIDR1.png deleted file mode 100644 index e24702d831563..0000000000000 Binary files a/media/tidb-cloud/Project-CIDR1.png and /dev/null differ diff --git a/media/tidb-cloud/VPC-Peering1.png b/media/tidb-cloud/VPC-Peering1.png deleted file mode 100644 index 1d7782af9ace0..0000000000000 Binary files a/media/tidb-cloud/VPC-Peering1.png and /dev/null differ diff --git a/media/tidb-cloud/add-credit-card.png b/media/tidb-cloud/add-credit-card.png deleted file mode 100644 index c6abebd545ef8..0000000000000 Binary files a/media/tidb-cloud/add-credit-card.png and /dev/null differ diff --git a/media/tidb-cloud/aws-create-policy.png b/media/tidb-cloud/aws-create-policy.png new file mode 100644 index 0000000000000..825ff9dd8fe37 Binary files /dev/null and b/media/tidb-cloud/aws-create-policy.png differ diff --git a/media/tidb-cloud/aws-create-role.png b/media/tidb-cloud/aws-create-role.png new file mode 100644 index 0000000000000..88f6bd7ca7716 Binary files /dev/null and b/media/tidb-cloud/aws-create-role.png differ diff --git a/media/tidb-cloud/aws-role-arn.png b/media/tidb-cloud/aws-role-arn.png new file mode 100644 index 0000000000000..3807b51b9b32a Binary files /dev/null and b/media/tidb-cloud/aws-role-arn.png differ diff --git a/media/tidb-cloud/copy-bucket-arn.png b/media/tidb-cloud/copy-bucket-arn.png new file mode 100644 index 0000000000000..60e20ccead2a0 Binary files /dev/null and b/media/tidb-cloud/copy-bucket-arn.png differ diff --git a/media/tidb-cloud/poc-points.png b/media/tidb-cloud/poc-points.png index aeb09e0132931..52eb2598ca5d5 100644 Binary files a/media/tidb-cloud/poc-points.png and b/media/tidb-cloud/poc-points.png differ diff --git a/media/tidb-cloud/project-CIDR3.png b/media/tidb-cloud/project-CIDR3.png deleted file mode 100644 index c6815a10c484e..0000000000000 Binary files a/media/tidb-cloud/project-CIDR3.png and /dev/null differ diff --git a/media/tidb-cloud/statement-analysis.png b/media/tidb-cloud/statement-analysis.png index cbcedc72ce0b1..5927435099c66 100644 Binary files a/media/tidb-cloud/statement-analysis.png and b/media/tidb-cloud/statement-analysis.png differ diff --git a/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot-index.png b/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot-index.png new file mode 100644 index 0000000000000..56c3d5f811485 Binary files /dev/null and b/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot-index.png differ diff --git a/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot.png b/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot.png new file mode 100644 index 0000000000000..41576bdd61bb8 Binary files /dev/null and b/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot.png differ diff --git a/media/tidb-cloud/tidb-cloud-troubleshoot-read-hotspot-new.png b/media/tidb-cloud/tidb-cloud-troubleshoot-read-hotspot-new.png new file mode 100644 index 0000000000000..4a9b58b39e9c7 Binary files /dev/null and b/media/tidb-cloud/tidb-cloud-troubleshoot-read-hotspot-new.png differ diff --git a/media/tidb-cloud/tidb-cloud-troubleshoot-write-hotspot.png b/media/tidb-cloud/tidb-cloud-troubleshoot-write-hotspot.png new file mode 100644 index 0000000000000..ce82b1041a169 Binary files /dev/null and b/media/tidb-cloud/tidb-cloud-troubleshoot-write-hotspot.png differ diff --git a/mysql-compatibility.md b/mysql-compatibility.md index 6c3cd5fec67bc..4f44d2b41eae2 100644 --- a/mysql-compatibility.md +++ b/mysql-compatibility.md @@ -104,7 +104,7 @@ See also: [TiDB SQL Grammar](https://pingcap.github.io/sqlgram/#functioncallkeyw In TiDB, all supported DDL changes are performed online. Compared with DDL operations in MySQL, the DDL operations in TiDB have the following major restrictions: -* Multiple operations cannot be completed in a single `ALTER TABLE` statement. For example, it is not possible to add multiple columns or indexes in a single statement. Otherwise, the `Unsupported multi schema change` error might be output. +* When you use a single `ALTER TABLE` statement to alter multiple schema objects (such as columns or indexes) of a table, specifying the same object in multiple changes is not supported. For example, if you execute the `ALTER TABLE t1 MODIFY COLUMN c1 INT, DROP COLUMN c1` command, the `Unsupported operate same column/index` error is output. * `ALTER TABLE` in TiDB does not support the changes of some data types. For example, TiDB does not support the change from the `DECIMAL` type to the `DATE` type. If a data type change is unsupported, TiDB reports the `Unsupported modify column: type %d not match origin %d` error. Refer to [`ALTER TABLE`](/sql-statements/sql-statement-modify-column.md) for more details. * The `ALGORITHM={INSTANT,INPLACE,COPY}` syntax functions only as an assertion in TiDB, and does not modify the `ALTER` algorithm. See [`ALTER TABLE`](/sql-statements/sql-statement-alter-table.md) for further details. * Adding/Dropping the primary key of the `CLUSTERED` type is unsupported. For more details about the primary key of the `CLUSTERED` type, refer to [clustered index](/clustered-indexes.md). diff --git a/placement-rules-in-sql.md b/placement-rules-in-sql.md index 9b7f38faf223b..b3f09b1b4d692 100644 --- a/placement-rules-in-sql.md +++ b/placement-rules-in-sql.md @@ -258,7 +258,7 @@ In dictionary format, constraints also indicate a number of instances that apply ## Known limitations -The following known limitations exist in the experimental release of Placement Rules in SQL: +The following known limitations are as follows: * Temporary tables do not support placement options. * Syntactic sugar rules are permitted for setting `PRIMARY_REGION` and `REGIONS`. In the future, we plan to add varieties for `PRIMARY_RACK`, `PRIMARY_ZONE`, and `PRIMARY_HOST`. See [issue #18030](https://github.com/pingcap/tidb/issues/18030). diff --git a/releases/release-5.0.0-rc.md b/releases/release-5.0.0-rc.md index db411c1857b44..e381e60d269c8 100644 --- a/releases/release-5.0.0-rc.md +++ b/releases/release-5.0.0-rc.md @@ -125,7 +125,7 @@ The TiDB scheduling process occupies resources such as I/O, network, CPU, and me + Reduce the redundant scheduling issues caused by fluctuations of node capacity (always near the waterline) and caused by PD's `store-limit` configuration value set too large. This is achieved by introducing a new set of scheduling calculation formulas enabled via the `region-score-formula-version = v2` configuration item. [#3269](https://github.com/tikv/pd/pull/3269) + Enable the cross-Region merge feature by modifying `enable-cross-table-merge = true` to reduce the number of empty Regions. [#3129](https://github.com/tikv/pd/pull/3129) + Data compaction in the TiKV background occupies a lot of I/O resources. The system automatically adjusts the compaction rate to balance the contention for I/O resources between background tasks and foreground reads and writes. After enabling this feature via the `rate-limiter-auto-tuned` configuration item, the delay jitter is greatly reduced. [#18011](https://github.com/pingcap/tidb/issues/18011) -+ When TiKV performs garbage collection (GC) and data compaction, partitions occupy CPU and I/O resources. Overlapping data exists during the execution of these two tasks. To reduce I/O usage, the GC Compaction Filter feature combines these two tasks into one and executes them in the same task. This feature is still experimental and you can enable it via `gc.enable-compaction-filter = ture`. [#18009](https://github.com/pingcap/tidb/issues/18009) ++ When TiKV performs garbage collection (GC) and data compaction, partitions occupy CPU and I/O resources. Overlapping data exists during the execution of these two tasks. To reduce I/O usage, the GC Compaction Filter feature combines these two tasks into one and executes them in the same task. This feature is still experimental and you can enable it via `gc.enable-compaction-filter = true`. [#18009](https://github.com/pingcap/tidb/issues/18009) + When TiFlash compresses or sorts data, it occupies a lot of I/O resources. The system alleviates contention for resources by limiting the compression and data sorting's use of I/O resources. This feature is still experimental and you can enable it via `bg_task_io_rate_limit`. Related issue: [#18005](https://github.com/pingcap/tidb/issues/18005) diff --git a/releases/versioning.md b/releases/versioning.md index 459aea9e85894..a87346f18dc49 100644 --- a/releases/versioning.md +++ b/releases/versioning.md @@ -14,6 +14,8 @@ TiDB offers two release series: * Long-Term Support Releases * Development Milestone Releases (introduced in TiDB v6.0.0) +To learn about the support policy for major releases of TiDB, see [TiDB Release Support Policy](https://en.pingcap.com/tidb-release-support-policy/). + ## Release versioning TiDB versioning has the form of `X.Y.Z`. `X.Y` represents a release series. diff --git a/sql-statements/sql-statement-add-column.md b/sql-statements/sql-statement-add-column.md index 1811fc69f722c..47ae0faa329e1 100644 --- a/sql-statements/sql-statement-add-column.md +++ b/sql-statements/sql-statement-add-column.md @@ -86,7 +86,6 @@ mysql> SELECT * FROM t1; ## MySQL compatibility -* Adding multiple columns at the same time in a statement is currently not supported. * Adding a new column and setting it to the `PRIMARY KEY` is not supported. * Adding a new column and setting it to `AUTO_INCREMENT` is not supported. * There are limitations on adding generated columns, refer to: [generated column limitations](/generated-columns.md#limitations). diff --git a/sql-statements/sql-statement-add-index.md b/sql-statements/sql-statement-add-index.md index 2a4dab3290d52..315aaa0b9aee5 100644 --- a/sql-statements/sql-statement-add-index.md +++ b/sql-statements/sql-statement-add-index.md @@ -77,7 +77,6 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; * `FULLTEXT`, `HASH` and `SPATIAL` indexes are not supported. * Descending indexes are not supported (similar to MySQL 5.7). -* Adding multiple indexes at the same time is currently not supported. * Adding the primary key of the `CLUSTERED` type to a table is not supported. For more details about the primary key of the `CLUSTERED` type, refer to [clustered index](/clustered-indexes.md). ## See also diff --git a/sql-statements/sql-statement-alter-table-compact.md b/sql-statements/sql-statement-alter-table-compact.md index 719f3872f647b..d8348e45846d9 100644 --- a/sql-statements/sql-statement-alter-table-compact.md +++ b/sql-statements/sql-statement-alter-table-compact.md @@ -5,13 +5,9 @@ summary: An overview of the usage of ALTER TABLE ... COMPACT for the TiDB databa # ALTER TABLE ... COMPACT -> **Warning:** -> -> This statement is still an experimental feature. It is NOT recommended that you use it in the production environment. - To enhance read performance and reduce disk usage, TiDB automatically schedules data compaction on storage nodes in the background. During the compaction, storage nodes rewrite physical data, including cleaning up deleted rows and merging multiple versions of data caused by updates. The `ALTER TABLE ... COMPACT` statement allows you to initiate compaction for a specific table immediately, without waiting until compaction is triggered in the background. -The execution of this statement does not block existing SQL statements or affect any TiDB features, such as transactions, DDL, and GC. Data that can be selected via SQL statements will not be changed either. However, executing this statement consumes some IO and CPU resources, which might result in higher SQL execution latency. +The execution of this statement does not block existing SQL statements or affect any TiDB features, such as transactions, DDL, and GC. Data that can be selected via SQL statements will not be changed either. Executing this statement consumes some IO and CPU resources. Be careful to choose an appropriate timing for execution, such as when resources are available, to avoid negative impact on the business. The compaction statement will be finished and returned when all replicas of a table are compacted. During the execution process, you can safely interrupt the compaction by executing the [`KILL`](/sql-statements/sql-statement-kill.md) statement. Interrupting a compaction does not break data consistency or lead to data loss, nor does it affect subsequent manual or background compactions. @@ -21,9 +17,11 @@ This data compaction statement is currently supported only for TiFlash replicas, ```ebnf+diagram AlterTableCompactStmt ::= - 'ALTER' 'TABLE' TableName 'COMPACT' 'TIFLASH' 'REPLICA' + 'ALTER' 'TABLE' TableName 'COMPACT' ( 'TIFLASH' 'REPLICA' )? ``` +Since v6.2.0, the `TIFLASH REPLICA` part of the syntax can be omitted. When omitted, the semantic of the statement remains unchanged, and takes effect only for TiFlash. + ## Examples ### Compact TiFlash replicas in a table diff --git a/sql-statements/sql-statement-alter-table.md b/sql-statements/sql-statement-alter-table.md index 515f0de59a566..4dc0a4f726ce7 100644 --- a/sql-statements/sql-statement-alter-table.md +++ b/sql-statements/sql-statement-alter-table.md @@ -157,7 +157,7 @@ Query OK, 0 rows affected, 1 warning (0.25 sec) The following major restrictions apply to `ALTER TABLE` in TiDB: -- Making multiple changes in a single `ALTER TABLE` statement is currently not supported. +- Changing the same column or index when altering multiple schema objects in a single statement is not supported. - Changes of the [Reorg-Data](/sql-statements/sql-statement-modify-column.md#reorg-data-change) types on primary key columns are not supported. diff --git a/sql-statements/sql-statement-change-column.md b/sql-statements/sql-statement-change-column.md index 144ab03c40acf..41d857ad79bfe 100644 --- a/sql-statements/sql-statement-change-column.md +++ b/sql-statements/sql-statement-change-column.md @@ -149,7 +149,6 @@ ERROR 8200 (HY000): Unsupported modify column: change from original type decimal ## MySQL compatibility -* Making multiple changes in a single `ALTER TABLE` statement is currently not supported. * Changes of [Reorg-Data](/sql-statements/sql-statement-modify-column.md#reorg-data-change) types on primary key columns are not supported. * Changes of column types on partitioned tables are not supported. * Changes of column types on generated columns are not supported. diff --git a/sql-statements/sql-statement-drop-column.md b/sql-statements/sql-statement-drop-column.md index c9bbb528859a0..bf89165c62382 100644 --- a/sql-statements/sql-statement-drop-column.md +++ b/sql-statements/sql-statement-drop-column.md @@ -75,7 +75,6 @@ mysql> SELECT * FROM t1; ## MySQL compatibility -* Dropping multiple columns in the same statement is not supported. * Dropping primary key columns or columns covered by the composite index is not supported. ## See also diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 08ef3d64a5ca4..12748bfe00de6 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -169,13 +169,6 @@ CREATE TABLE `t1` ( ## MySQL compatibility -* Does not support modifying multiple columns using a single `ALTER TABLE` statement. For example: - - ```sql - ALTER TABLE t1 MODIFY col1 BIGINT, MODIFY id BIGINT NOT NULL; - ERROR 1105 (HY000): Unsupported multi schema change - ``` - * Does not support modifying the Reorg-Data types on the primary key columns but supports modifying the Meta-Only types. For example: ```sql diff --git a/sql-statements/sql-statement-show-table-regions.md b/sql-statements/sql-statement-show-table-regions.md index 02482a0eecafb..b1c939f251a9d 100644 --- a/sql-statements/sql-statement-show-table-regions.md +++ b/sql-statements/sql-statement-show-table-regions.md @@ -50,6 +50,8 @@ Executing `SHOW TABLE REGIONS` returns the following columns: * `READ_BYTES`: The estimated amount of data read from the Region within one heartbeat cycle. The unit is byte. * `APPROXIMATE_SIZE(MB)`: The estimated amount of data in the Region. The unit is megabytes (MB). * `APPROXIMATE_KEYS`: The estimated number of Keys in the Region. +* `SCHEDULING_CONSTRAINTS`: The [placement policy settings](/placement-rules-in-sql.md) associated with the table or partition to which a Region belongs. +* `SCHEDULING_STATE`: The scheduling state of the Region which has a placement policy. > **Note:** > @@ -90,13 +92,13 @@ The output should show that the table is split into Regions. The `REGION_ID`, `S ```sql ... mysql> SHOW TABLE t1 REGIONS; -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ -| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ -| 94 | t_75_ | t_75_r_31717 | 95 | 1 | 95 | 0 | 0 | 0 | 112 | 207465 | -| 96 | t_75_r_31717 | t_75_r_63434 | 97 | 1 | 97 | 0 | 0 | 0 | 97 | 0 | -| 2 | t_75_r_63434 | | 3 | 1 | 3 | 0 | 269323514 | 66346110 | 245 | 162020 | -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE | ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| 94 | t_75_ | t_75_r_31717 | 95 | 1 | 95 | 0 | 0 | 0 | 112 | 207465 | | | +| 96 | t_75_r_31717 | t_75_r_63434 | 97 | 1 | 97 | 0 | 0 | 0 | 97 | 0 | | | +| 2 | t_75_r_63434 | | 3 | 1 | 3 | 0 | 269323514 | 66346110 | 245 | 162020 | | | ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ 3 rows in set (0.00 sec) ``` @@ -114,14 +116,14 @@ mysql> SPLIT TABLE t1 BETWEEN (31717) AND (63434) REGIONS 2; 1 row in set (42.34 sec) mysql> SHOW TABLE t1 REGIONS; -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ -| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ -| 94 | t_75_ | t_75_r_31717 | 95 | 1 | 95 | 0 | 0 | 0 | 112 | 207465 | -| 98 | t_75_r_31717 | t_75_r_47575 | 99 | 1 | 99 | 0 | 1325 | 0 | 53 | 12052 | -| 96 | t_75_r_47575 | t_75_r_63434 | 97 | 1 | 97 | 0 | 1526 | 0 | 48 | 0 | -| 2 | t_75_r_63434 | | 3 | 1 | 3 | 0 | 0 | 55752049 | 60 | 0 | -+-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+ ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE | ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| 94 | t_75_ | t_75_r_31717 | 95 | 1 | 95 | 0 | 0 | 0 | 112 | 207465 | | | +| 98 | t_75_r_31717 | t_75_r_47575 | 99 | 1 | 99 | 0 | 1325 | 0 | 53 | 12052 | | | +| 96 | t_75_r_47575 | t_75_r_63434 | 97 | 1 | 97 | 0 | 1526 | 0 | 48 | 0 | | | +| 2 | t_75_r_63434 | | 3 | 1 | 3 | 0 | 0 | 55752049 | 60 | 0 | | | ++-----------+--------------+--------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ 4 rows in set (0.00 sec) ``` @@ -134,16 +136,16 @@ For a more detailed example: ```sql mysql> show table t regions; -+-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ -| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | -+-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ -| 102 | t_43_r | t_43_r_20000 | 118 | 7 | 105, 118, 119 | 0 | 0 | 0 | 1 | 0 | -| 106 | t_43_r_20000 | t_43_r_40000 | 120 | 7 | 107, 108, 120 | 0 | 23 | 0 | 1 | 0 | -| 110 | t_43_r_40000 | t_43_r_60000 | 112 | 9 | 112, 113, 121 | 0 | 0 | 0 | 1 | 0 | -| 114 | t_43_r_60000 | t_43_r_80000 | 122 | 7 | 115, 122, 123 | 0 | 35 | 0 | 1 | 0 | -| 3 | t_43_r_80000 | | 93 | 8 | 5, 73, 93 | 0 | 0 | 0 | 1 | 0 | -| 98 | t_43_ | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | -+-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ ++-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE | ++-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| 102 | t_43_r | t_43_r_20000 | 118 | 7 | 105, 118, 119 | 0 | 0 | 0 | 1 | 0 | | | +| 106 | t_43_r_20000 | t_43_r_40000 | 120 | 7 | 107, 108, 120 | 0 | 23 | 0 | 1 | 0 | | | +| 110 | t_43_r_40000 | t_43_r_60000 | 112 | 9 | 112, 113, 121 | 0 | 0 | 0 | 1 | 0 | | | +| 114 | t_43_r_60000 | t_43_r_80000 | 122 | 7 | 115, 122, 123 | 0 | 35 | 0 | 1 | 0 | | | +| 3 | t_43_r_80000 | | 93 | 8 | 5, 73, 93 | 0 | 0 | 0 | 1 | 0 | | | +| 98 | t_43_ | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | | | ++-----------+--------------+--------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ 6 rows in set ``` @@ -158,11 +160,11 @@ To check the Region that corresponds to table t in store 1, use the `WHERE` clau ```sql test> show table t regions where leader_store_id =1; -+-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+ -| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | -+-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+ -| 98 | t_43_ | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | -+-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+ ++-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE | ++-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| 98 | t_43_ | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | | | ++-----------+-----------+---------+-----------+-----------------+--------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ ``` Use `SPLIT TABLE REGION` to split the index data into Regions. In the following example, the index data `name` of table t is split into two Regions in the range of `[a,z]`. @@ -181,17 +183,17 @@ Now table t corresponds to seven Regions. Five of them (`102`, `106`, `110`, `11 ```sql test> show table t regions; -+-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ -| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | -+-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ -| 102 | t_43_r | t_43_r_20000 | 118 | 7 | 105, 118, 119 | 0 | 0 | 0 | 1 | 0 | -| 106 | t_43_r_20000 | t_43_r_40000 | 120 | 7 | 108, 120, 126 | 0 | 0 | 0 | 1 | 0 | -| 110 | t_43_r_40000 | t_43_r_60000 | 112 | 9 | 112, 113, 121 | 0 | 0 | 0 | 1 | 0 | -| 114 | t_43_r_60000 | t_43_r_80000 | 122 | 7 | 115, 122, 123 | 0 | 35 | 0 | 1 | 0 | -| 3 | t_43_r_80000 | | 93 | 8 | 73, 93, 128 | 0 | 0 | 0 | 1 | 0 | -| 135 | t_43_i_1_ | t_43_i_1_016d80000000000000 | 139 | 2 | 138, 139, 140 | 0 | 35 | 0 | 1 | 0 | -| 98 | t_43_i_1_016d80000000000000 | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | -+-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+ ++-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| REGION_ID | START_KEY | END_KEY | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE | ++-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ +| 102 | t_43_r | t_43_r_20000 | 118 | 7 | 105, 118, 119 | 0 | 0 | 0 | 1 | 0 | | | +| 106 | t_43_r_20000 | t_43_r_40000 | 120 | 7 | 108, 120, 126 | 0 | 0 | 0 | 1 | 0 | | | +| 110 | t_43_r_40000 | t_43_r_60000 | 112 | 9 | 112, 113, 121 | 0 | 0 | 0 | 1 | 0 | | | +| 114 | t_43_r_60000 | t_43_r_80000 | 122 | 7 | 115, 122, 123 | 0 | 35 | 0 | 1 | 0 | | | +| 3 | t_43_r_80000 | | 93 | 8 | 73, 93, 128 | 0 | 0 | 0 | 1 | 0 | | | +| 135 | t_43_i_1_ | t_43_i_1_016d80000000000000 | 139 | 2 | 138, 139, 140 | 0 | 35 | 0 | 1 | 0 | | | +| 98 | t_43_i_1_016d80000000000000 | t_43_r | 99 | 1 | 99, 100, 101 | 0 | 0 | 0 | 1 | 0 | | | ++-----------+-----------------------------+-----------------------------+-----------+-----------------+---------------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+ 7 rows in set ``` diff --git a/statistics.md b/statistics.md index 8c8c55541b1ed..9a9205b49a529 100644 --- a/statistics.md +++ b/statistics.md @@ -6,7 +6,7 @@ aliases: ['/docs/dev/statistics/','/docs/dev/reference/performance/statistics/'] # Introduction to Statistics -TiDB uses statistics to decide [which index to choose](/choose-index.md). The `tidb_analyze_version` variable controls the statistics collected by TiDB. Currently, two versions of statistics are supported: `tidb_analyze_version = 1` and `tidb_analyze_version = 2`. In versions before v5.1.0, the default value of this variable is `1`. In v5.3.0 and later versions, the default value of this variable is `2`, which serves as an experimental feature. If your cluster is upgraded from a version earlier than v5.3.0 to v5.3.0 or later, the default value of `tidb_analyze_version` does not change. +TiDB uses statistics to decide [which index to choose](/choose-index.md). The `tidb_analyze_version` variable controls the statistics collected by TiDB. Currently, two versions of statistics are supported: `tidb_analyze_version = 1` and `tidb_analyze_version = 2`. In versions before v5.1.0, the default value of this variable is `1`. In v5.3.0 and later versions, the default value of this variable is `2`. If your cluster is upgraded from a version earlier than v5.3.0 to v5.3.0 or later, the default value of `tidb_analyze_version` does not change. > **Note:** > diff --git a/system-variables.md b/system-variables.md index 05d64efdce163..6e1c1ab821279 100644 --- a/system-variables.md +++ b/system-variables.md @@ -826,22 +826,6 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: `OFF` - This variable is used to determine whether to include the `AUTO_INCREMENT` columns when creating a generated column or an expression index. -### tidb_enable_change_multi_schema - -> **Warning:** -> -> TiDB will support more types of multi-schema changes in the future. This system variable will be deleted in a future release of TiDB. - -- Scope: GLOBAL -- Persists to cluster: Yes -- Type: Boolean -- Default value: `OFF` -- This variable is used to control whether multiple columns or indexes can be altered in one `ALTER TABLE` statement. When the value of this variable is `ON`, only the following multi-schema changes are supported: - - Add multiple columns. For example, `ATLER TABLE t ADD COLUMN c1 INT, ADD COLUMN c2 INT;`. - - Drop multiple columns. For example, `ATLER TABLE t DROP COLUMN c1, DROP COLUMN c2;`. - - Drop multiple indexes. For example, `ATLER TABLE t DROP INDEX i1, DROP INDEX i2;`. - - Drop a column covered by a single-column index. For example, `ALTER TABLE t DROP COLUMN c1`, in which the schema contains `INDEX idx(c1)`. - ### tidb_enable_cascades_planner > **Warning:** @@ -1925,15 +1909,21 @@ explain select * from t where age=5; - Persists to cluster: Yes - Type: Boolean - Default value: `OFF` +- `tidb_restricted_read_only` and [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) behave similarly. In most cases, you should use [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) only. +- Users with the `SUPER` or `SYSTEM_VARIABLES_ADMIN` privilege can modify this variable. However, if the [Security Enhanced Mode](#tidb_enable_enhanced_security) is enabled, the additional `RESTRICTED_VARIABLES_ADMIN` privilege is required to read or modify this variable. +- `tidb_restricted_read_only` affects [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) in the following cases: + - Setting `tidb_restricted_read_only` to `ON` will update [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) to `ON`. + - Setting `tidb_restricted_read_only` to `OFF` leaves [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) unchanged. + - If `tidb_restricted_read_only` is `ON`, [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) cannot be set to `OFF`. +- For DBaaS providers of TiDB, if a TiDB cluster is a downstream database of another database, to make the TiDB cluster read-only, you might need to use `tidb_restricted_read_only` with [Security Enhanced Mode](#tidb_enable_enhanced_security) enabled, which prevents your customers from using [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) to make the cluster writable. To achieve this, you need to enable [Security Enhanced Mode](#tidb_enable_enhanced_security), use an admin user with the `SYSTEM_VARIABLES_ADMIN` and `RESTRICTED_VARIABLES_ADMIN` privileges to control `tidb_restricted_read_only`, and let your database users use the root user with the `SUPER` privilege to control [`tidb_super_read_only`](#tidb_super_read_only-new-in-v531) only. - This variable controls the read-only status of the entire cluster. When the variable is `ON`, all TiDB servers in the entire cluster are in the read-only mode. In this case, TiDB only executes the statements that do not modify data, such as `SELECT`, `USE`, and `SHOW`. For other statements such as `INSERT` and `UPDATE`, TiDB rejects executing those statements in the read-only mode. - Enabling the read-only mode using this variable only ensures that the entire cluster finally enters the read-only status. If you have changed the value of this variable in a TiDB cluster but the change has not yet propagated to other TiDB servers, the un-updated TiDB servers are still **not** in the read-only mode. -- When this variable is enabled, the SQL statements being executed are not affected. TiDB only performs the read-only check for the SQL statements **to be** executed. +- TiDB checks the read-only flag before SQL statements are executed. Since v6.2.0, the flag is also checked before SQL statements are committed. This helps prevent the case where long-running [auto commit](/transaction-overview.md#autocommit) statements might modify data after the server has been placed in read-only mode. - When this variable is enabled, TiDB handles the uncommitted transactions in the following ways: - For uncommitted read-only transactions, you can commit the transactions normally. - For uncommitted transactions that are not read-only, SQL statements that perform write operations in these transactions are rejected. - For uncommitted read-only transactions with modified data, the commit of these transactions is rejected. - After the read-only mode is enabled, all users (including the users with the `SUPER` privilege) cannot execute the SQL statements that might write data unless the user is explicitly granted the `RESTRICTED_REPLICA_WRITER_ADMIN` privilege. -- Users with `RESTRICTED_VARIABLES_ADMIN` or `SUPER` privileges can modify this variable. However, if the [security enhanced mode](#tidb_enable_enhanced_security) is enabled, only the users with the `RESTRICTED_VARIABLES_ADMIN` privilege can modify this variable. ### tidb_retry_limit @@ -2127,6 +2117,24 @@ Query OK, 0 rows affected, 1 warning (0.00 sec) - Range: `[0, 9223372036854775807]` - This variable is used to limit the maximum number of requests TiDB can send to TiKV at the same time. 0 means no limit. +### tidb_super_read_only New in v5.3.1 + +- Scope: GLOBAL +- Persists to cluster: Yes +- Type: Boolean +- Default value: `OFF` +- `tidb_super_read_only` aims to be implemented as a replacement of the MySQL variable `super_read_only`. However, because TiDB is a distributed database, `tidb_super_read_only` does not make the database read-only immediately after execution, but eventually. +- Users with the `SUPER` or `SYSTEM_VARIABLES_ADMIN` privilege can modify this variable. +- This variable controls the read-only status of the entire cluster. When the variable is `ON`, all TiDB servers in the entire cluster are in the read-only mode. In this case, TiDB only executes the statements that do not modify data, such as `SELECT`, `USE`, and `SHOW`. For other statements such as `INSERT` and `UPDATE`, TiDB rejects executing those statements in the read-only mode. +- Enabling the read-only mode using this variable only ensures that the entire cluster finally enters the read-only status. If you have changed the value of this variable in a TiDB cluster but the change has not yet propagated to other TiDB servers, the un-updated TiDB servers are still **not** in the read-only mode. +- TiDB checks the read-only flag before SQL statements are executed. Since v6.2.0, the flag is also checked before SQL statements are committed. This helps prevent the case where long-running [auto commit](/transaction-overview.md#autocommit) statements might modify data after the server has been placed in read-only mode. +- When this variable is enabled, TiDB handles the uncommitted transactions in the following ways: + - For uncommitted read-only transactions, you can commit the transactions normally. + - For uncommitted transactions that are not read-only, SQL statements that perform write operations in these transactions are rejected. + - For uncommitted read-only transactions with modified data, the commit of these transactions is rejected. +- After the read-only mode is enabled, all users (including the users with the `SUPER` privilege) cannot execute the SQL statements that might write data unless the user is explicitly granted the `RESTRICTED_REPLICA_WRITER_ADMIN` privilege. +- When the [`tidb_restricted_read_only`](#tidb_restricted_read_only-new-in-v520) system variable is set to `ON`, `tidb_super_read_only` is affected by [`tidb_restricted_read_only`](#tidb_restricted_read_only-new-in-v520) in some cases. For detailed impact, see the description of [`tidb_restricted_read_only`](#tidb_restricted_read_only-new-in-v520). + ### tidb_sysdate_is_now New in v6.0.0 - Scope: SESSION | GLOBAL diff --git a/tidb-cloud/_index.md b/tidb-cloud/_index.md index 7fb1aeb53a7bd..ca69403b60952 100644 --- a/tidb-cloud/_index.md +++ b/tidb-cloud/_index.md @@ -1,80 +1,114 @@ --- title: TiDB Cloud Documentation -summary: Learn about TiDB Cloud documentation. aliases: ['/tidbcloud/beta/privacy-policy', '/tidbcloud/beta/terms-of-service', '/tidbcloud/beta/service-level-agreement'] +hide_sidebar: true +hide_commit: true --- - + -# TiDB Cloud Documentation + -[TiDB Cloud](https://pingcap.com/products/tidbcloud) is a fully-managed Database-as-a-Service (DBaaS) that brings everything great about TiDB to your cloud, and lets you focus on your applications, not the complexities of your database. +[Why TiDB Cloud](https://docs.pingcap.com/tidbcloud/tidb-cloud-intro) - - -Quick Start +[Architecture](https://docs.pingcap.com/tidbcloud/tidb-cloud-intro#architecture) -- [Quick Start](/tidb-cloud/tidb-cloud-quickstart.md) -- [Perform a PoC](/tidb-cloud/tidb-cloud-poc.md) -- [Why TiDB Cloud](/tidb-cloud/tidb-cloud-intro.md) -- [Architecture](/tidb-cloud/tidb-cloud-intro.md#architecture) -- [FAQs](/tidb-cloud/tidb-cloud-faq.md) +[FAQ](https://docs.pingcap.com/tidbcloud/tidb-cloud-faq) - + - -Manage Cluster + -- [Select Your Cluster Tier](/tidb-cloud/select-cluster-tier.md) -- [Determine Your TiDB Size](/tidb-cloud/size-your-cluster.md) -- [Create a TiDB Cluster](/tidb-cloud/create-tidb-cluster.md) -- [Connect to a TiDB Cluster](/tidb-cloud/connect-to-tidb-cluster.md) -- [Use an HTAP Cluster](/tidb-cloud/use-htap-cluster.md) -- [Scale a TiDB Cluster](/tidb-cloud/scale-tidb-cluster.md) -- [Upgrade a TiDB Cluster](/tidb-cloud/upgrade-tidb-cluster.md) +[Try Out TiDB Cloud](https://docs.pingcap.com/tidbcloud/tidb-cloud-quickstart) - +[Try Out HTAP](https://docs.pingcap.com/tidbcloud/tidb-cloud-htap-quickstart) - -Migrate Data +[Proof of Concept](https://docs.pingcap.com/tidbcloud/tidb-cloud-poc) -- [Import Sample Data](/tidb-cloud/import-sample-data.md) -- [Migrate from MySQL-Compatible Databases](/tidb-cloud/migrate-data-into-tidb.md) -- [Migrate from Amazon Aurora MySQL in Bulk](/tidb-cloud/migrate-from-aurora-bulk-import.md) -- [Import or Migrate from Amazon S3 or GCS to TiDB Cloud](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md) -- [Export Data from TiDB Cloud](/tidb-cloud/export-data-from-tidb-cloud.md) + - + - -Monitor and Alert +[Create a Cluster](https://docs.pingcap.com/tidbcloud/create-tidb-cluster) -- [Built-in Alerting](/tidb-cloud/monitor-built-in-alerting.md) -- [Datadog Integration](/tidb-cloud/monitor-datadog-integration.md) -- [Prometheus and Grafana Integration](/tidb-cloud/monitor-prometheus-and-grafana-integration.md) +[Connect to a Cluster](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster) - +[Use an HTAP Cluster](https://docs.pingcap.com/tidbcloud/tiflash-overview) - -Manage User Access +[Scale a Cluster](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster) -- [Sign In](/tidb-cloud/manage-user-access.md#sign-in) -- [Sign Out](/tidb-cloud/manage-user-access.md#sign-out) -- [View the Organization and Project](/tidb-cloud/manage-user-access.md#view-the-organization-and-project) -- [Invite an Organization Member](/tidb-cloud/manage-user-access.md#invite-an-organization-member) -- [Invite a Project Member](/tidb-cloud/manage-user-access.md#invite-a-project-member) -- [Configure Member Roles](/tidb-cloud/manage-user-access.md#configure-member-roles) -- [Set the Local Time Zone](/tidb-cloud/manage-user-access.md#set-the-local-time-zone) +[Upgrade a Cluster](https://docs.pingcap.com/tidbcloud/upgrade-tidb-cluster) - +[Delete a Cluster](https://docs.pingcap.com/tidbcloud/delete-tidb-cluster) - -Reference + -- [Billing](/tidb-cloud/tidb-cloud-billing.md) -- [Support](/tidb-cloud/tidb-cloud-support.md) -- [Glossary](/tidb-cloud/tidb-cloud-glossary.md) + - +[Import Sample Data](https://docs.pingcap.com/tidbcloud/import-sample-data) - +[From MySQL](https://docs.pingcap.com/tidbcloud/migrate-data-into-tidb) + +[From Amazon Aurora MySQL](https://docs.pingcap.com/tidbcloud/migrate-from-aurora-bulk-import) + +[From Amazon S3 or GCS](https://docs.pingcap.com/tidbcloud/migrate-from-amazon-s3-or-gcs) + +[From CSV Files](https://docs.pingcap.com/tidbcloud/import-csv-files) + +[From Apache Parquet Files](https://docs.pingcap.com/tidbcloud/import-csv-files) + + + + + +[Status and Metrics](https://docs.pingcap.com/tidbcloud/monitor-tidb-cluster) + +[Built-in Monitoring](https://docs.pingcap.com/tidbcloud/built-in-monitoring) + +[Built-in Alerting](https://docs.pingcap.com/tidbcloud/monitor-built-in-alerting) + +[Use Datadog](https://docs.pingcap.com/tidbcloud/monitor-datadog-integration) + +[Use Prometheus and Grafana](https://docs.pingcap.com/tidbcloud/monitor-prometheus-and-grafana-integration) + + + + + +[Tuning Overview](https://docs.pingcap.com/tidbcloud/tidb-cloud-tune-performance-overview) + +[Analyze Performance](https://docs.pingcap.com/tidbcloud/tune-performance) + +[Tune SQL Performance](https://docs.pingcap.com/tidbcloud/tidb-cloud-sql-tuning-overview) + +[Tune TiFlash Performance](https://docs.pingcap.com/tidbcloud/tune-tiflash-performance) + + + + + +[Manage Passwords](https://docs.pingcap.com/tidbcloud/manage-user-access#manage-user-passwords) + +[Manage Profiles](https://docs.pingcap.com/tidbcloud/manage-user-access#manage-user-profiles) + +[View Organization and Project](https://docs.pingcap.com/tidbcloud/manage-user-access#view-the-organization-and-project) + +[Invite a Member](https://docs.pingcap.com/tidbcloud/manage-user-access#invite-an-organization-member) + +[Configure Roles](https://docs.pingcap.com/tidbcloud/manage-user-access#configure-member-roles) + +[Configure Security Settings](https://docs.pingcap.com/tidbcloud/configure-security-settings) + + + + + +[Costs](https://docs.pingcap.com/tidbcloud/tidb-cloud-billing) + +[Invoices](https://docs.pingcap.com/tidbcloud/tidb-cloud-billing#invoices) + +[Trial Points](https://docs.pingcap.com/tidbcloud/tidb-cloud-billing#trial-points) + + + + diff --git a/tidb-cloud/backup-and-restore.md b/tidb-cloud/backup-and-restore.md index b8092054ad673..11160c3c010af 100644 --- a/tidb-cloud/backup-and-restore.md +++ b/tidb-cloud/backup-and-restore.md @@ -8,14 +8,15 @@ aliases: ['/tidbcloud/restore-deleted-tidb-cluster'] This document describes how to back up and restore your TiDB cluster data on TiDB Cloud. +> **Note:** +> +> For [Developer Tier clusters](/tidb-cloud/select-cluster-tier.md#developer-tier), the backup and restore feature is unavailable. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as a backup. + ## Backup TiDB Cloud provides two types of data backup: automatic backup and manual backup. -For [Developer Tier clusters](/tidb-cloud/select-cluster-tier.md#developer-tier), each cluster allows one automatic backup and two manual backups: - -- For the automatic backup, the existing backup will be replaced by the newer backup. -- For the manual backup, if you already have two backups, you need to delete at least one backup before you are able to make another backup. +Daily backups are automatically scheduled for your TiDB clusters in TiDB Cloud. You can pick a backup snapshot and restore it into a new TiDB cluster at any time. Automated backup can reduce your losses in extreme disaster situations. ### Automatic backup @@ -70,6 +71,14 @@ To delete an existing backup file, perform the following steps: 2. Click **Delete** for the backup file that you want to delete. +### Delete a running backup job + +To delete a running backup job, it is similar as [**Delete backup files**](#delete-backup-files). + +1. Navigate to the **Backup** tab of a cluster. + +2. Click **Delete** for the backup file that is in the **Pending** or **Running** state. + ### Best practices for backup - It is recommended that you perform backup operations at cluster idle time to minimize the impact on business. @@ -94,7 +103,7 @@ To restore your TiDB cluster data from a backup to a new cluster, take the follo 3. In the **Restore** window, make the following changes if necessary: - Update the port number of the cluster. - - Increase the vCPUs size, node quantity, and storage size for the cluster. + - Increase the node size, node quantity, and storage size for the cluster. 4. Click **Confirm**. @@ -112,10 +121,10 @@ To restore a deleted cluster from recycle bin, take the following steps: 4. In the **Restore** window, make the following changes if necessary: - Update the port number of the cluster. - - Increase the vCPUs size, node quantity, and storage size for the cluster. + - Increase the node size, node quantity, and storage size for the cluster. 5. Click **Confirm**. The cluster restore process starts and the **Security Quick Start** dialog box is displayed. -6. In the **Security Quick Start** dialog box, set the root password and allowed IP addresses to connect to your cluster, and then click **Apply**. \ No newline at end of file +6. In the **Security Quick Start** dialog box, set the root password and allowed IP addresses to connect to your cluster, and then click **Apply**. diff --git a/tidb-cloud/changefeed-sink-to-mysql.md b/tidb-cloud/changefeed-sink-to-mysql.md index c60015cf13c5f..9c8ef4b189a8f 100644 --- a/tidb-cloud/changefeed-sink-to-mysql.md +++ b/tidb-cloud/changefeed-sink-to-mysql.md @@ -54,9 +54,9 @@ The **Sink to MySQL** connector can only sink incremental data from your TiDB cl SET GLOBAL tidb_gc_life_time = '720h'; ``` -2. Use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export data from your TiDB cluster, then use community tools such as [mydumper/myloader](https://centminmod.com/mydumper.html) to load data to the MySQL service. +2. Use [Dumpling](/dumpling-overview.md) to export data from your TiDB cluster, then use community tools such as [mydumper/myloader](https://centminmod.com/mydumper.html) to load data to the MySQL service. -3. From the [exported files of Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview#format-of-exported-files), get the TSO from the metadata file: +3. From the [exported files of Dumpling](/dumpling-overview.md#format-of-exported-files), get the TSO from the metadata file: {{< copyable "shell-regular" >}} diff --git a/tidb-cloud/configure-security-settings.md b/tidb-cloud/configure-security-settings.md new file mode 100644 index 0000000000000..de19c40c77e6a --- /dev/null +++ b/tidb-cloud/configure-security-settings.md @@ -0,0 +1,22 @@ +--- +title: Configure Cluster Security Settings +summary: Learn how to configure the root password and allowed IP addresses to connect to your cluster. +--- + +# Configure Cluster Security Settings + +When you create a cluster, the TiDB Cloud console will automatically guide you to configure the root password and allowed IP addresses to connect to your cluster. + +If you do not configure the root password or allowed IP addresses at that time, or if you want to modify the cluster security settings, take the following steps: + +1. In the TiDB Cloud console, navigate to the **Active Clusters** page of your project, and then locate the pane of your cluster. +2. Click **Security Quick Start** in the pane. The **Security Quick Start** dialog is displayed. +3. In the dialog, configure the root password and allowed IP addresses. + + To allow your cluster to be accessible by any IP addresses, click **Allow Access From Anywhere**. + +4. Click **Apply**. + +> **Tip:** +> +> If you are viewing the overview page of your cluster, you can click the **Quick Start** tab on the page and configure these settings, too. \ No newline at end of file diff --git a/tidb-cloud/connect-to-tidb-cluster.md b/tidb-cloud/connect-to-tidb-cluster.md index 5eebacdf5e645..77d2b3a6358b4 100644 --- a/tidb-cloud/connect-to-tidb-cluster.md +++ b/tidb-cloud/connect-to-tidb-cluster.md @@ -29,7 +29,6 @@ To connect to your TiDB cluster via standard connection, perform the following s 1. Click one of the buttons to add some rules quickly. - **Add My Current IP Address** - - **Add Rules from Default Set** - **Allow Access from Anywhere** 2. Provide an optional description for the newly added IP address or CIDR range. @@ -38,6 +37,10 @@ To connect to your TiDB cluster via standard connection, perform the following s 4. Under **Step 2: Connect with a SQL client** in the dialog box, click the tab of your preferred connection method, and then connect to your cluster with the connection string. +> **Note:** +> +> For [Developer Tier clusters](/tidb-cloud/select-cluster-tier.md#developer-tier), when you connect to your cluster, you must include the prefix for your cluster in the user name and wrap the name with quotation marks. For more information, see [User name prefix](/tidb-cloud/select-cluster-tier.md#user-name-prefix). + ## Connect via VPC peering > **Note:** diff --git a/tidb-cloud/create-tidb-cluster.md b/tidb-cloud/create-tidb-cluster.md index 313e0930f8d72..40e5d162e3f58 100644 --- a/tidb-cloud/create-tidb-cluster.md +++ b/tidb-cloud/create-tidb-cluster.md @@ -98,7 +98,7 @@ To create a Dedicated Tier cluster, take the following steps: > > When setting the project CIDR, avoid any conflicts with the CIDR of the VPC where your application is located. You cannot modify your project CIDR once it is set. -4. Configure the [cluster size](/tidb-cloud/size-your-cluster.md) for TiDB, TiKV, and TiFlashbeta (optional) respectively, and then click **Next**. +4. Configure the [cluster size](/tidb-cloud/size-your-cluster.md) for TiDB, TiKV, and TiFlash (optional) respectively, and then click **Next**. 5. Confirm the cluster information in the middle area and the billing information in the right pane. diff --git a/tidb-cloud/delete-tidb-cluster.md b/tidb-cloud/delete-tidb-cluster.md index b1f0a10afa144..859bb99b90723 100644 --- a/tidb-cloud/delete-tidb-cluster.md +++ b/tidb-cloud/delete-tidb-cluster.md @@ -14,11 +14,15 @@ You can delete a cluster at any time by performing the following steps: 3. Click **Delete** in the drop-down menu. 4. In the cluster deleting window, enter the cluster name. - If you want to restore the cluster sometime in the future, make sure you have a backup of the cluster. Otherwise, you cannot restore it anymore. For more information about how to back up clusters, see [Back up and Restore TiDB Cluster Data](/tidb-cloud/backup-and-restore.md). + If you want to restore the cluster sometime in the future, make sure that you have a backup of the cluster. Otherwise, you cannot restore it anymore. For more information about how to back up Dedicated Tier clusters, see [Back up and Restore TiDB Cluster Data](/tidb-cloud/backup-and-restore.md). + + > **Note:** + > + > For [Developer Tier clusters](/tidb-cloud/select-cluster-tier.md#developer-tier), the backup and restore feature is unavailable. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as a backup. 5. Click **I understand the consequences, delete this cluster**. - Once a backed up cluster is deleted, the existing backup files of the cluster are moved to the recycle bin. + Once a backed up Dedicated Tier cluster is deleted, the existing backup files of the cluster are moved to the recycle bin. - For backup files from an automatic backup, the recycle bin can retain them for 7 days. - For backup files from a manual backup, there is no expiration date. diff --git a/tidb-cloud/export-data-from-tidb-cloud.md b/tidb-cloud/export-data-from-tidb-cloud.md index cade4dd46b490..205a7d981d9b2 100644 --- a/tidb-cloud/export-data-from-tidb-cloud.md +++ b/tidb-cloud/export-data-from-tidb-cloud.md @@ -7,11 +7,9 @@ summary: This page has instructions for exporting data from your TiDB cluster in This page describes how to export data from your cluster in TiDB Cloud. -Daily backups are automatically scheduled for your TiDB clusters in TiDB Cloud. You can pick a backup snapshot and restore it into a new TiDB cluster at any time. Automated backup can reduce your losses in extreme disaster situations. +TiDB does not lock in your data. Sometimes you still want to be able to migrate data from TiDB to other data platforms. Because TiDB is highly compatible with MySQL, any export tool suitable for MySQL can also be used for TiDB. -TiDB does not lock in your data, sometimes you still want to be able to migrate data from TiDB to other data platforms. Because TiDB is highly compatible with MySQL, any export tool suitable for MySQL can also be used for TiDB. - -You can use the same tool [Dumpling](https://github.com/pingcap/dumpling) for data export. +You can use the tool [Dumpling](https://github.com/pingcap/dumpling) for data export. 1. Download and install TiUP: diff --git a/tidb-cloud/high-availability-with-multi-az.md b/tidb-cloud/high-availability-with-multi-az.md index faea9673aba2e..dec22461a50b6 100644 --- a/tidb-cloud/high-availability-with-multi-az.md +++ b/tidb-cloud/high-availability-with-multi-az.md @@ -17,6 +17,6 @@ TiDB Cloud clusters consist of three major components: TiDB node, TiKV node, and TiKV () is the row-based storage layer of TiDB Cloud cluster with horizontal scalability. On TiDB Cloud, the minimum number of TiKV nodes for a cluster is 3. TiDB Cloud deploys TiKV nodes evenly to all availability zones (at least 3) in the region you select to achieve durability and high availability. In a typical 3-replica setup, your data is distributed evenly among the TiKV nodes across all availability zones and is persisted to the disk of each TiKV node. -* **TiFlashbeta node** +* **TiFlash node** - TiFlashbeta(), as a columnar storage extension of TiKV, is the key component that makes TiDB essentially a Hybrid Transactional/Analytical Processing (HTAP) database. In TiFlashbeta, the columnar replicas are asynchronously replicated according to the Raft Learner consensus algorithm. TiDB Cloud deploys TiFlashbeta nodes evenly to different availability zones in a region. It is recommended that you configure at least two TiFlashbeta nodes in each TiDB Cloud cluster and create at least 2 replicas of the data for high availability in your production environment. \ No newline at end of file + TiFlash(), as a columnar storage extension of TiKV, is the key component that makes TiDB essentially a Hybrid Transactional/Analytical Processing (HTAP) database. In TiFlash, the columnar replicas are asynchronously replicated according to the Raft Learner consensus algorithm. TiDB Cloud deploys TiFlash nodes evenly to different availability zones in a region. It is recommended that you configure at least two TiFlash nodes in each TiDB Cloud cluster and create at least two replicas of the data for high availability in your production environment. \ No newline at end of file diff --git a/tidb-cloud/import-csv-files.md b/tidb-cloud/import-csv-files.md index b3eef8d5a64ce..28687415ebdf9 100644 --- a/tidb-cloud/import-csv-files.md +++ b/tidb-cloud/import-csv-files.md @@ -57,11 +57,11 @@ Before importing CSV files into TiDB Cloud, you need to create the target databa To allow TiDB Cloud to access the CSV files in the Amazon S3 or GCS bucket, do one of the following: -- If your organization is using TiDB Cloud as a service on AWS, [configure cross-account access to Amazon S3](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-amazon-s3-access). +- If your CSV files are located in Amazon S3, [configure cross-account access to Amazon S3](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-amazon-s3-access). Once finished, make a note of the Role ARN value as you will need it in [Step 4](#step-4-import-csv-files-to-tidb-cloud). -- If your organization is using TiDB Cloud as a service on Google Cloud Platform (GCP), [configure cross-account access to GCS](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-gcs-access). +- If your CSV files are located in GCS, [configure cross-account access to GCS](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-gcs-access). ## Step 4. Import CSV files to TiDB Cloud @@ -82,13 +82,19 @@ To import the CSV files to TiDB Cloud, take the following steps: > For the configurations of separator, delimiter, and null, you can use both alphanumeric characters and certain special characters. The supported special characters include `\t`, `\b`, `\n`, `\r`, `\f`, and `\u0001`. - **Target Database**: fill in the **Username** and **Password** fields. - - **DB/Tables Filter**: if necessary, you can specify a [table filter](https://docs.pingcap.com/tidb/stable/table-filter#cli). Currently, TiDB Cloud only supports one table filter rule. + - **DB/Tables Filter**: if necessary, you can specify a [table filter](/table-filter.md#syntax). If you want to configure multiple filter rules, use `,` to separate the rules. - **Object Name Pattern**: enter a pattern that matches the names of the CSV files to be imported. For example,`my-data.csv`. - **Target Table Name**: enter the name of the target table. For example, `mydb.mytable`. -4. Click **Import** to start the import task. +4. Click **Import**. -5. When the import progress shows success, check the number after **Total Files:**. + A warning message about the database resource consumption is displayed. + +5. Click **Confirm**. + + TiDB Cloud starts validating whether it can access your data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. If you get the `AccessDenied` error, see [Troubleshoot Access Denied Errors during Data Import from S3](/tidb-cloud/troubleshoot-import-access-denied-error.md). + +6. When the import progress shows success, check the number after **Total Files:**. If the number is zero, it means no data files matched the value you entered in the **Object Name Pattern** field. In this case, ensure that there are no typos in the **Object Name Pattern** field and try again. diff --git a/tidb-cloud/import-parquet-files.md b/tidb-cloud/import-parquet-files.md index f6a5193979005..03c0b4f9b1209 100644 --- a/tidb-cloud/import-parquet-files.md +++ b/tidb-cloud/import-parquet-files.md @@ -66,11 +66,11 @@ Before importing Parquet files into TiDB Cloud, you need to create the target da To allow TiDB Cloud to access the Parquet files in the Amazon S3 or GCS bucket, do one of the following: -- If your organization is using TiDB Cloud as a service on AWS, [configure cross-account access to Amazon S3](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-amazon-s3-access). +- If your Parquet files are located in Amazon S3, [configure cross-account access to Amazon S3](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-amazon-s3-access). Once finished, make a note of the Role ARN value as you will need it in [Step 4](#step-4-import-parquet-files-to-tidb-cloud). -- If your organization is using TiDB Cloud as a service on Google Cloud Platform (GCP), [configure cross-account access to GCS](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-gcs-access). +- If your Parquet files are located in GCS, [configure cross-account access to GCS](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md#step-2-configure-gcs-access). ## Step 4. Import Parquet files to TiDB Cloud @@ -85,13 +85,19 @@ To import the Parquet files to TiDB Cloud, take the following steps: - **Data Format**: select **Parquet**. - **Setup Credentials** (This field is visible only for AWS S3): enter the Role ARN value for **Role-ARN**. - **Target Database**: fill in the **Username** and **Password** fields. - - **DB/Tables Filter**: if necessary, you can specify a [table filter](https://docs.pingcap.com/tidb/stable/table-filter#cli). Currently, TiDB Cloud only supports one table filter rule. + - **DB/Tables Filter**: if necessary, you can specify a [table filter](/table-filter.md#syntax). If you want to configure multiple filter rules, use `,` to separate the rules. - **Object Name Pattern**: enter a pattern that matches the names of the Parquet files to be imported. For example,`my-data.parquet`. - **Target Table Name**: enter the name of the target table. For example, `mydb.mytable`. -4. Click **Import** to start the import task. +4. Click **Import**. -5. When the import progress shows success, check the number after **Total Files:**. + A warning message about the database resource consumption is displayed. + +5. Click **Confirm**. + + TiDB Cloud starts validating whether it can access your data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. If you get the `AccessDenied` error, see [Troubleshoot Access Denied Errors during Data Import from S3](/tidb-cloud/troubleshoot-import-access-denied-error.md). + +6. When the import progress shows success, check the number after **Total Files:**. If the number is zero, it means no data files matched the value you entered in the **Object Name Pattern** field. In this case, check whether there are any typos in the **Object Name Pattern** field and try again. diff --git a/tidb-cloud/import-sample-data.md b/tidb-cloud/import-sample-data.md index ab852edfe4ac8..98899d0462666 100644 --- a/tidb-cloud/import-sample-data.md +++ b/tidb-cloud/import-sample-data.md @@ -7,31 +7,52 @@ summary: Learn how to import sample data into TiDB Cloud via UI. This document describes how to import sample data into TiDB Cloud via the UI. The sample data used is the system data from Capital Bikeshare, released under the Capital Bikeshare Data License Agreement. Before importing the sample data, you need to have one TiDB cluster. -1. Navigate to the **Active Clusters** page and click the name of your target cluster. The overview page of your target cluster is displayed. +1. Navigate to the **Active Clusters** page and click the name of your newly created cluster. The overview page of your cluster is displayed. + 2. In the cluster information pane on the left, click **Import**. The **Data Import Task** page is displayed. -3. Depending on where your TiDB cluster is hosted, do one of the following: - - If your TiDB cluster is hosted by AWS, select **AWS S3** for **Data Source Type**, and then enter the sample data URL `s3://tidbcloud-samples/data-ingestion/` in the **Bucket URL** field. The sample data bucket is hosted in the US West (Oregon) region for AWS. +3. Fill in the import parameters: - - If your TiDB cluster is hosted by GCP, select **Google Cloud Storage** for **Data Source Type**, and then enter the sample data URL `gcs://tidbcloud-samples-us-west1` in the **Bucket URL** field. The sample data bucket is hosted in the US-West1 (Oregon) region for GCP. + +
-4. For **Data Format**, select **TiDB Dumpling**. + If your TiDB cluster is hosted by AWS (the Developer Tier is hosted by AWS by default), fill in the following parameters: -5. If the TiDB cluster is hosted by GCP, skip this step. If the TiDB cluster is hosted by AWS, enter the Role-ARN: + - **Data Source Type**: `AWS S3`. + - **Bucket URL**: enter the sample data URL `s3://tidbcloud-samples/data-ingestion/`. + - **Data Format**: select **TiDB Dumpling**. + - **Setup Credentials**: enter `arn:aws:iam::385595570414:role/import-sample-access` for Role-ARN. + - **Target Database**: + - **Username**: `root`. + - **Password**: enter your root password. + - **DB/Tables Filter**: leave this field blank. - ``` - arn:aws:iam::385595570414:role/import-sample-access - ``` +
+ +
+ + If your TiDB cluster is hosted by GCP, fill in the following parameters: + + - **Data Source Type**: `Google Cloud Stroage`. + - **Bucket URL**: enter the sample data URL `gcs://tidbcloud-samples-us-west1`. + - **Data Format**: select **TiDB Dumpling**. + - **Target Database**: + - **Username**: `root`. + - **Password**: enter your root password. + - **DB/Tables Filter**: leave this field blank. + +
+
+ +4. Click **Import**. -6. For **Target Database**, enter `root` in the **Username** field, and enter the root password of the cluster in the **Password** field. + A warning message about the database resource consumption is displayed. - > **Note:** - > - > If you have created a custom user of the target database, you can also use the name of the newly created user and the corresponding password. +5. Click **Confirm**. -7. Leave the **DB/Tables Filter** field blank. + TiDB Cloud starts validating whether it can access the sample data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. -8. Click **Import**. Then the sample data starts being imported. +The data import process will take 5 to 10 minutes. When the data import progress bar shows **Success**, you have successfully imported the sample data and the database schema to your database in TiDB Cloud. Once the cluster finishes the data importing process, you will get the sample data in your database. @@ -47,20 +68,20 @@ You can run some queries to check the result, for example: ``` ```sql - +------------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ - | ride_id | rideable_type | started_at | ended_at | start_station_name | start_station_id | end_station_name | end_station_id | start_lat | start_lng | end_lat | end_lng | member_casual | - +------------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ - |E291FF5018 | classic_bike | 2021-01-02 11:12:38 | 2021-01-02 11:23:47 | 12th & U St NW | 31268 | 7th & F St NW / National Portrait Gallery | 31232 | 38.916786 | -77.02814 | 38.89728 | -77.022194 | member - |E76F3605D0 | docked_bike | 2020-09-13 00:44:11 | 2020-09-13 00:59:38 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual - |FFF0B75414 | docked_bike | 2020-09-28 16:47:53 | 2020-09-28 16:57:30 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual - |C3F2C16949 | docked_bike | 2020-09-13 00:42:03 | 2020-09-13 00:59:43 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual - |1C7EC91629 | docked_bike | 2020-09-28 16:47:49 | 2020-09-28 16:57:26 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | member - |A3A38BCACA | classic_bike | 2021-01-14 09:52:53 | 2021-01-14 10:00:51 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916786 | -77.02814 | 38.895912 | -77.02606 | member - |EC4943257E | electric_bike | 2021-01-28 10:06:52 | 2021-01-28 10:16:28 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916843 | -77.028206 | 38.89607 | -77.02608 | member - |D4070FBFA7 | classic_bike | 2021-01-12 09:50:51 | 2021-01-12 09:59:41 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916786 | -77.02814 | 38.895912 | -77.02606 | member - |6EABEF3CAB | classic_bike | 2021-01-09 15:00:43 | 2021-01-09 15:18:30 | 12th & U St NW | 31268 | 1st & M St NE | 31603 | 38.916786 | -77.02814 | 38.905697 | -77.005486 | member - |2F5CC89018 | electric_bike | 2021-01-02 01:47:07 | 2021-01-02 01:58:29 | 12th & U St NW | 31268 | 3rd & H St NE | 31616 | 38.916836 | -77.02815 | 38.90074 | -77.00219 | member - +------------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ + +-----------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ + | ride_id | rideable_type | started_at | ended_at | start_station_name | start_station_id | end_station_name | end_station_id | start_lat | start_lng | end_lat | end_lng | member_casual | + +-----------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ + | E291FF5018 | classic_bike | 2021-01-02 11:12:38 | 2021-01-02 11:23:47 | 12th & U St NW | 31268 | 7th & F St NW / National Portrait Gallery | 31232 | 38.916786 | -77.02814 | 38.89728 | -77.022194 | member | + | E76F3605D0 | docked_bike | 2020-09-13 00:44:11 | 2020-09-13 00:59:38 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual | + | FFF0B75414 | docked_bike | 2020-09-28 16:47:53 | 2020-09-28 16:57:30 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual | + | C3F2C16949 | docked_bike | 2020-09-13 00:42:03 | 2020-09-13 00:59:43 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | casual | + | 1C7EC91629 | docked_bike | 2020-09-28 16:47:49 | 2020-09-28 16:57:26 | 12th & U St NW | 31268 | 17th St & Massachusetts Ave NW | 31267 | 38.916786 | -77.02814 | 38.908142 | -77.03836 | member | + | A3A38BCACA | classic_bike | 2021-01-14 09:52:53 | 2021-01-14 10:00:51 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916786 | -77.02814 | 38.895912 | -77.02606 | member | + | EC4943257E | electric_bike | 2021-01-28 10:06:52 | 2021-01-28 10:16:28 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916843 | -77.028206 | 38.89607 | -77.02608 | member | + | D4070FBFA7 | classic_bike | 2021-01-12 09:50:51 | 2021-01-12 09:59:41 | 12th & U St NW | 31268 | 10th & E St NW | 31256 | 38.916786 | -77.02814 | 38.895912 | -77.02606 | member | + | 6EABEF3CAB | classic_bike | 2021-01-09 15:00:43 | 2021-01-09 15:18:30 | 12th & U St NW | 31268 | 1st & M St NE | 31603 | 38.916786 | -77.02814 | 38.905697 | -77.005486 | member | + | 2F5CC89018 | electric_bike | 2021-01-02 01:47:07 | 2021-01-02 01:58:29 | 12th & U St NW | 31268 | 3rd & H St NE | 31616 | 38.916836 | -77.02815 | 38.90074 | -77.00219 | member | + +-----------------+---------------+---------------------+---------------------+--------------------+------------------+-------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ ``` 2. Get the trip records with electric bikes: @@ -76,15 +97,15 @@ You can run some queries to check the result, for example: +------------------+---------------+---------------------+---------------------+----------------------------------------+------------------+-------------------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ | ride_id | rideable_type | started_at | ended_at | start_station_name | start_station_id | end_station_name | end_station_id | start_lat | start_lng | end_lat | end_lng | member_casual | +------------------+---------------+---------------------+---------------------+----------------------------------------+------------------+-------------------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ - | AF15B12839DA4367 | electric_bike | 2021-01-23 14:50:46 | 2021-01-23 14:59:55 | Columbus Circle / Union Station | 31623 | 15th & East Capitol St NE | 31630 | 38.8974 | -77.00481 | 38.890 |76.98354 | member - | 7173E217338C4752 | electric_bike | 2021-01-15 08:28:38 | 2021-01-15 08:33:49 | 37th & O St NW / Georgetown University | 31236 | 34th St & Wisconsin Ave NW | 31226 | 38.907825 | -77.071655 | 38.916 |-77.0683 | member - | E665505ED621D1AB | electric_bike | 2021-01-05 13:25:47 | 2021-01-05 13:35:58 | N Lynn St & Fairfax Dr | 31917 | 34th St & Wisconsin Ave NW | 31226 | 38.89359 | -77.07089 | 38.916 |77.06829 | member - | 646AFE266A6375AF | electric_bike | 2021-01-16 00:08:10 | 2021-01-16 00:35:58 | 7th St & Massachusetts Ave NE | 31647 | 34th St & Wisconsin Ave NW | 31226 | 38.892235 | -76.996025 | 38.91 |7.068245 | member - | 40CDDA0378E45736 | electric_bike | 2021-01-03 11:14:50 | 2021-01-03 11:26:04 | N Lynn St & Fairfax Dr | 31917 | 34th St & Wisconsin Ave NW | 31226 | 38.893734 | -77.07096 | 38.916 |7.068275 | member - | E0A7DDB0CE680C01 | electric_bike | 2021-01-05 18:18:17 | 2021-01-05 19:04:11 | Maine Ave & 7th St SW | 31609 | Smithsonian-National Mall / Jefferson Dr & 12th St SW | 31248 | 38.878727 | -77.02304 | 38.8 |7.028755 | casual - | 71BDF35029AF0039 | electric_bike | 2021-01-07 10:23:57 | 2021-01-07 10:59:43 | 10th & K St NW | 31263 | East West Hwy & Blair Mill Rd | 32019 | 38.90279 | -77.02633 | 38.990 |77.02937 | member - | D5EACDF488260A61 | electric_bike | 2021-01-13 20:57:23 | 2021-01-13 21:04:19 | 8th & H St NE | 31661 | 15th & East Capitol St NE | 31630 | 38.89985 | -76.994835 | 38.88 |76.98345 | member - | 211D449363FB7EE3 | electric_bike | 2021-01-15 17:22:02 | 2021-01-15 17:35:49 | 7th & K St NW | 31653 | 15th & East Capitol St NE | 31630 | 38.90216 | -77.0211 | 38.88 |76.98357 | casual - | CE667578A7291701 | electric_bike | 2021-01-15 16:55:12 | 2021-01-15 17:38:26 | East West Hwy & 16th St | 32056 | East West Hwy & Blair Mill Rd | 32019 | 38.995674 | -77.03868 | 38.990 |77.02953 | casual + | AF15B12839DA4367 | electric_bike | 2021-01-23 14:50:46 | 2021-01-23 14:59:55 | Columbus Circle / Union Station | 31623 | 15th & East Capitol St NE | 31630 | 38.8974 | -77.00481 | 38.890 | 76.98354 | member | + | 7173E217338C4752 | electric_bike | 2021-01-15 08:28:38 | 2021-01-15 08:33:49 | 37th & O St NW / Georgetown University | 31236 | 34th St & Wisconsin Ave NW | 31226 | 38.907825 | -77.071655 | 38.916 | -77.0683 | member | + | E665505ED621D1AB | electric_bike | 2021-01-05 13:25:47 | 2021-01-05 13:35:58 | N Lynn St & Fairfax Dr | 31917 | 34th St & Wisconsin Ave NW | 31226 | 38.89359 | -77.07089 | 38.916 | 77.06829 | member | + | 646AFE266A6375AF | electric_bike | 2021-01-16 00:08:10 | 2021-01-16 00:35:58 | 7th St & Massachusetts Ave NE | 31647 | 34th St & Wisconsin Ave NW | 31226 | 38.892235 | -76.996025 | 38.91 | 7.068245 | member | + | 40CDDA0378E45736 | electric_bike | 2021-01-03 11:14:50 | 2021-01-03 11:26:04 | N Lynn St & Fairfax Dr | 31917 | 34th St & Wisconsin Ave NW | 31226 | 38.893734 | -77.07096 | 38.916 | 7.068275 | member | + | E0A7DDB0CE680C01 | electric_bike | 2021-01-05 18:18:17 | 2021-01-05 19:04:11 | Maine Ave & 7th St SW | 31609 | Smithsonian-National Mall / Jefferson Dr & 12th St SW | 31248 | 38.878727 | -77.02304 | 38.8 | 7.028755 | casual | + | 71BDF35029AF0039 | electric_bike | 2021-01-07 10:23:57 | 2021-01-07 10:59:43 | 10th & K St NW | 31263 | East West Hwy & Blair Mill Rd | 32019 | 38.90279 | -77.02633 | 38.990 | 77.02937 | member | + | D5EACDF488260A61 | electric_bike | 2021-01-13 20:57:23 | 2021-01-13 21:04:19 | 8th & H St NE | 31661 | 15th & East Capitol St NE | 31630 | 38.89985 | -76.994835 | 38.88 | 76.98345 | member | + | 211D449363FB7EE3 | electric_bike | 2021-01-15 17:22:02 | 2021-01-15 17:35:49 | 7th & K St NW | 31653 | 15th & East Capitol St NE | 31630 | 38.90216 | -77.0211 | 38.88 | 76.98357 | casual | + | CE667578A7291701 | electric_bike | 2021-01-15 16:55:12 | 2021-01-15 17:38:26 | East West Hwy & 16th St | 32056 | East West Hwy & Blair Mill Rd | 32019 | 38.995674 | -77.03868 | 38.990 | 77.02953 | casual | +------------------+---------------+---------------------+---------------------+----------------------------------------+------------------+-------------------------------------------------------+----------------+-----------+------------+-----------+------------+---------------+ ``` diff --git a/tidb-cloud/limitations-and-quotas.md b/tidb-cloud/limitations-and-quotas.md index fd0e2977e51d5..a6d8f4741cdd4 100644 --- a/tidb-cloud/limitations-and-quotas.md +++ b/tidb-cloud/limitations-and-quotas.md @@ -28,3 +28,4 @@ TiDB Cloud limits how many of each kind of component you can create, and the com |:-|:-| | Maximum number of total TiDB nodes for all clusters in your organization | 20 | | Maximum number of total TiKV nodes for all clusters in your organization | 30 | +| Maximum number of total TiFlash nodes for all clusters in your organization | 30 | diff --git a/tidb-cloud/manage-user-access.md b/tidb-cloud/manage-user-access.md index 2835c1d2ec74b..83e978600878c 100644 --- a/tidb-cloud/manage-user-access.md +++ b/tidb-cloud/manage-user-access.md @@ -1,11 +1,11 @@ --- -title: Manage User Access -summary: Learn how to manage the user access in your TiDB Cloud cluster. +title: Manage Console User Access +summary: Learn how to manage the user access of the TiDB Cloud console. --- -# Manage User Access +# Manage Console User Access -This document describes how to manage the user access in your TiDB Cloud cluster. +This document describes how to manage user access of the [TiDB Cloud console](https://tidbcloud.com/console). ## Sign in diff --git a/tidb-cloud/migrate-data-into-tidb.md b/tidb-cloud/migrate-data-into-tidb.md index 15fa23e9e6a0b..bef347761738b 100644 --- a/tidb-cloud/migrate-data-into-tidb.md +++ b/tidb-cloud/migrate-data-into-tidb.md @@ -7,7 +7,7 @@ summary: Learn how to migrate data from MySQL-compatible databases to TiDB Cloud TiDB is highly compatible with MySQL. You can migrate data from any MySQL-compatible databases to TiDB smoothly, whether the data is from a self-hosted MySQL instance or RDS service provided by the public cloud. -This document describes how to use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export data from MySQL-compatible databases and use [TiDB Lightning](https://docs.pingcap.com/tidb/stable/tidb-lightning-overview) TiDB-backend to import the data to TiDB Cloud. +This document describes how to use [Dumpling](/dumpling-overview.md) to export data from MySQL-compatible databases and use [TiDB Lightning](https://docs.pingcap.com/tidb/stable/tidb-lightning-overview) logical import mode to import the data to TiDB Cloud. > **Note:** > @@ -15,10 +15,19 @@ This document describes how to use [Dumpling](https://docs.pingcap.com/tidb/stab ## Prerequisites -TiDB currently only supports the following CI collations. Before migrating data from MySQL-compatible databases into TiDB, ensure that the supported collations can meet your requirements. +Before migrating data from MySQL-compatible databases into TiDB, ensure that the supported collations of TiDB Cloud can meet your requirements. +By default, TiDB Cloud supports the following CI collations: + +- ascii_bin +- binary +- latin1_bin +- utf8_bin - utf8_general_ci +- utf8_unicode_ci +- utf8mb4_bin - utf8mb4_general_ci +- utf8mb4_unicode_ci ## Step 1. Install TiUP @@ -46,7 +55,7 @@ TiUP is a package manager in the TiDB ecosystem, which can help you run any TiDB ## Step 2. Export data from MySQL-compatible databases -You can use several ways to dump data from MySQL, such as using `mysqldump` or `mydumper`. It is recommended to use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) for higher performance and compatibility with TiDB, which is also one of the open source tools created by PingCAP. +You can use several ways to dump data from MySQL, such as using `mysqldump` or `mydumper`. It is recommended to use [Dumpling](/dumpling-overview.md) for higher performance and compatibility with TiDB, which is also one of the open source tools created by PingCAP. 1. Install Dumpling: @@ -58,7 +67,7 @@ You can use several ways to dump data from MySQL, such as using `mysqldump` or ` 2. Export your MySQL database using Dumpling. - - To export your data to Amazon S3 cloud storage, see [Export data to Amazon S3 cloud storage](https://docs.pingcap.com/tidb/stable/dumpling-overview#export-data-to-amazon-s3-cloud-storage). + - To export your data to Amazon S3 cloud storage, see [Export data to Amazon S3 cloud storage](/dumpling-overview.md#export-data-to-amazon-s3-cloud-storage). - To export your data to local data files, use the following command: {{< copyable "shell-regular" >}} @@ -88,9 +97,9 @@ Depending on the location and size of your source data, the importing methods ar - If your source data is in local files, do one of the following: - If the data is larger than 1 TB, it is recommended that you use Amazon S3 or GCS as a staging area to import or migrate data into TiDB Cloud. For more information, see [Import or migrate from Amazon S3 or GCS to TiDB Cloud](/tidb-cloud/migrate-from-amazon-s3-or-gcs.md). - - If the data is less than 1 TB, you can use TiDB Lightning TiDB-backend according to the following steps in this document. + - If the data is less than 1 TB, you can use the logical import mode of TiDB Lightning according to the following steps in this document. -The following steps show how to import data to TiDB Cloud using TiDB Lightning TiDB-backend. +The following steps show how to import local data to TiDB Cloud using the logical import mode of TiDB Lightning. 1. Install TiDB Lightning: diff --git a/tidb-cloud/migrate-from-amazon-s3-or-gcs.md b/tidb-cloud/migrate-from-amazon-s3-or-gcs.md index 4aeb964e6aaea..9b401999673a6 100644 --- a/tidb-cloud/migrate-from-amazon-s3-or-gcs.md +++ b/tidb-cloud/migrate-from-amazon-s3-or-gcs.md @@ -13,150 +13,153 @@ This document describes how to use Amazon Simple Storage Service (Amazon S3) or ## Import or migrate from Amazon S3 to TiDB Cloud -If your organization is using TiDB Cloud as a service on AWS, you can use Amazon S3 as a staging area for importing or migrating data into TiDB Cloud. +If your organization is using TiDB Cloud as a service on AWS, you can use Amazon S3 as a staging area for importing or migrating data into TiDB Cloud. ### Prerequisites -Before migrating data from Amazon S3 to TiDB Cloud, ensure the following: - -- You have administrator access to your corporate-owned AWS account. -- You have administrator access to the TiDB Cloud Management Portal. +Before migrating data from Amazon S3 to TiDB Cloud, ensure you have administrator access to your corporate-owned AWS account. ### Step 1. Create an Amazon S3 bucket and prepare source data files -1. Create an Amazon S3 bucket in your corporate-owned AWS account. +1. Create an Amazon S3 bucket in your corporate-owned AWS account. For more information, see [Creating a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) in the AWS User Guide. + > **Note:** + > + > To minimize egress charges and latency, create your Amazon S3 bucket and TiDB Cloud database cluster in the same region. + 2. If you are migrating data from an upstream database, you need to export the source data first. - For more information, see [Install TiUP](/tidb-cloud/migrate-data-into-tidb.md#step-1-install-tiup) and [Export data from MySQL compatible databases](/tidb-cloud/migrate-data-into-tidb.md#step-2-export-data-from-mysql-compatible-databases). + For more information, see [Migrate Data from MySQL-Compatible Databases](/tidb-cloud/migrate-data-into-tidb.md). + +3. If your source data is in local files, you can upload the files to the Amazon S3 bucket using either the Amazon S3 Console or the AWS CLI. + + - To upload files using the Amazon S3 Console, see [Uploading objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) in the AWS User Guide. + - To upload files using the AWS CLI, use the following command: + + ```shell + aws s3 sync + ``` + + For example: + + ```shell + aws s3 sync ./tidbcloud-samples-us-west-2/ s3://tidb-cloud-source-data + ``` > **Note:** -> -> - Ensure that your source data can be copied to a file format supported by TiDB Cloud. The supported formats include CSV, Dumpling, and Aurora Backup Snapshot. If your source files are in the CSV format, you need to follow [the naming convention supported by TiDB](https://docs.pingcap.com/tidb/stable/migrate-from-csv-using-tidb-lightning#file-name). -> - Where possible and applicable, it is recommended that you split a large source file into smaller files of maximum size 256 MB because it allows TiDB Cloud to read files in parallel across threads, thereby resulting in potentially enhanced import performance. +> +> - Ensure that your source data can be copied to a file format supported by TiDB Cloud. The supported formats include CSV, Dumpling, and Aurora Backup Snapshot. If your source files are in the CSV format, you need to follow [the naming convention supported by TiDB](https://docs.pingcap.com/tidb/stable/migrate-from-csv-using-tidb-lightning#file-name). +> - Where possible and applicable, it is recommended that you split a large source file into smaller files of maximum size 256 MB. It allows TiDB Cloud to read files in parallel across threads, thereby resulting in potentially enhanced import performance. -### Step 2. Configure Amazon S3 access +### Step 2. Configure Amazon S3 access -To allow TiDB cloud to access the source data in your Amazon S3 bucket, you need to configure the Amazon S3 for each TiDB Cloud as a service on the AWS project and Amazon S3 bucket pair. Once the configuration is done for one cluster in a project, all database clusters in that project can access the Amazon S3 bucket. +To allow TiDB Cloud to access the source data in your Amazon S3 bucket, take the following steps to configure the bucket access for TiDB Cloud and get the Role-ARN. Once the configuration is done for one TiDB cluster in a project, all TiDB clusters in that project can use the same Role-ARN to access your Amazon S3 bucket. -1. Get the TiDB Cloud account ID and external ID of the target TiDB cluster. +1. In the TiDB Cloud Console, get the TiDB Cloud account ID and external ID of the target TiDB cluster. - 1. In the TiDB Cloud Admin console, choose a target project and a target cluster deployed on the AWS, and then click **Import**. - 2. Click **Show AWS IAM policy settings**. The corresponding TiDB Cloud Account ID and TiDB Cloud External ID of the target TiDB cluster are displayed. - 3. Take a note of the TiDB Cloud Account ID and External ID because they will be used in the following steps. + 1. In the TiDB Cloud Console, choose your target project, and then click the name of your target cluster to go to its overview page. + 2. In the cluster overview pane on the left, click **Import**. The **Data Import Task** page is displayed. + 3. On the **Data Import Task** page, click **Show AWS IAM policy settings** to get the TiDB Cloud Account ID and TiDB Cloud External ID. Take a note of these IDs for later use. -2. In the AWS Management Console, go to **IAM** > **Access Management** > **Policies**, and then check whether a storage bucket policy with the following read-only permissions exists. +2. In the AWS Management Console, create a managed policy for your Amazon S3 bucket. - - s3:GetObject - - s3:GetObjectVersion - - s3:ListBucket - - s3:GetBucketLocation + 1. Sign in to the AWS Management Console and open the Amazon S3 console at . + 2. In the **Buckets** list, choose the name of your bucket with the source data, and then click **Copy ARN** to get your S3 bucket ARN (for example, `arn:aws:s3:::tidb-cloud-source-data`). Take a note of the bucket ARN for later use. - Depending on whether a storage bucket policy with the above permissions exists, do one of the following: - - - If yes, you can use the matched storage bucket policy for the target TiDB cluster in the following steps. - - If not, go to **IAM** > **Access Management** > **Policies** > **Create Policy**, and define a bucket policy for the target TiDB cluster according to the following policy template. + ![Copy bucket ARN](/media/tidb-cloud/copy-bucket-arn.png) - {{< copyable "" >}} + 3. Open the IAM console at , click **Policies** in the navigation pane on the left, and then click **Create Policy**. - ``` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetObject", - "s3:GetObjectVersion" - ], - "Resource": "arn:aws:s3:::" - }, - { - "Effect": "Allow", - "Action": [ - "s3:ListBucket", - "s3:GetBucketLocation" - ], - "Resource": "" - } - ] - } - ``` + ![Create a policy](/media/tidb-cloud/aws-create-policy.png) - In the template, you need to update the following two fields to your own resource values: + 4. On the **Create policy** page, click the **JSON** tab. + 5. Copy the following access policy template and paste it to the policy text field. - - `"Resource": ""`: `` is the ARN of your S3 bucket. You can go to the **Properties** tab in your S3 bucket, and get the Amazon Resource Name (ARN) value in the **Bucket Overview** area. For example, `"Resource": "arn:aws:s3:::tidb-cloud-test"`. - - `"Resource": "arn:aws:s3:::"`: `` is a directory that you can customize in your S3 bucket root level for data storage. For example, `"Resource": "arn:aws:s3:::tidb-cloud-test/mydata/*"`. If you want to store your data in the S3 bucket root directory, just use `"Resource": "arn:aws:s3:::tidb-cloud-test/*"`. + ``` + { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "VisualEditor0", + "Effect": "Allow", + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Resource": "//*" + }, + { + "Sid": "VisualEditor1", + "Effect": "Allow", + "Action": [ + "s3:ListBucket", + "s3:GetBucketLocation" + ], + "Resource": "" + } + ] + } + ``` -3. Go to **IAM** > **Access Management** > **Roles**, and then check whether a role whose trust entity corresponds to the TiDB Cloud Account ID of the target TiDB cluster exists. + In the policy text field, update the following configurations to your own values. - - If yes, you can use the matched role for the target TiDB cluster in the following steps. - - If not, click **Create role**, select **Another AWS account** as the trust entity type, and then enter the TiDB Cloud Account ID of the target TiDB cluster in the **Account ID** field. + - `"Resource": "//*"` -4. In **IAM** > **Access Management** > **Roles**, click the role name from the previous step to go to the **Summary** page, and then do the following: + For example, if your source data is stored in the root directory of the `tidb-cloud-source-data` bucket, use `"Resource": "arn:aws:s3:::tidb-cloud-source-data/*"`. If your source data is stored in the `mydata` directory of the bucket, use `"Resource": "arn:aws:s3:::tidb-cloud-source-data/mydata/*"`. Make sure that `/*` is added to the end of the directory so TiDB Cloud can access all files in this directory. - 1. Under the **Permissions** tab, check whether the storage bucket policy for the target TiDB cluster is attached to the role. + - `"Resource": ""` - If not, choose **Attach Policies**, search for the needed policy, and then click **Attach Policy**. + For example, `"Resource": "arn:aws:s3:::tidb-cloud-source-data"`. - 2. Click the **Trust relationships** tab, click **Edit trust relationship**, and then check whether the value of the **Condition sts:ExternalId** attribute is the TiDB Cloud External ID of the target TiDB cluster. + 6. Click **Next: Tags**, add a tag of the policy (optional), and then click **Next:Review**. - If not, update the **Condition sts:ExternalId** attribute in the JSON text editor, and then click **Update Trust Policy**. - - The following is a configuration example of the **Condition sts:ExternalId** attribute. + 7. Set a policy name, and then click **Create policy**. - {{< copyable "" >}} +3. In the AWS Management Console, create an access role for TiDB Cloud and get the role ARN. - ``` - "Condition": { - "StringEquals": { - "sts:ExternalId": "696e6672612d61706993147c163238a8a7005caaf40e0338fc" - } - } - ``` + 1. In the IAM console at , click **Roles** in the navigation pane on the left, and then click **Create role**. - 3. Return to the **Summary** page and copy the **Role ARN** value to your clipboard. + ![Create a role](/media/tidb-cloud/aws-create-role.png) -5. In the TiDB Cloud Admin console, go to the screen where you get the TiDB Cloud account ID and external ID of the target TiDB cluster, update the **Role ARN** field using the role value from the previous step. + 2. To create a role, fill in the following information: -Your TiDB Cloud cluster can now access the Amazon S3 bucket. + - Under **Trusted entity type**, select **AWS account**. + - Under **An AWS account**, select **Another AWS account**, and then paste the TiDB Cloud account ID to the **Account ID** field. + - Under **Options**, click **Require external ID (Best practice when a third party will assume this role)**, and then paste the TiDB Cloud External ID to the **External ID** field. -> **Note:** -> -> To remove access to TiDB Cloud, simply delete the trust policy that you added. + 3. Click **Next** to open the policy list, choose the policy you just created, and then click **Next**. + 4. Under **Role details**, set a name for the role, and then click **Create role** in the lower-right corner. After the role is created, the list of roles is displayed. + 5. In the list of roles, click the name of the role that you just created to go to its summary page, and then copy the role ARN. -### Step 3. Copy source data files to Amazon S3 and import data into TiDB Cloud + ![Copy AWS role ARN](/media/tidb-cloud/aws-role-arn.png) -1. To copy your source data files to your Amazon S3 bucket, you can upload the data to the Amazon S3 bucket using either AWS Web console or AWS CLI. +4. In the TiDB Cloud console, go to the **Data Import Task** page where you get the TiDB Cloud account ID and external ID, and then paste the role ARN to the **Role ARN** field. - - To upload data using the AWS Web console, see [Uploading objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) in the AWS User Guide. - - To upload data using the AWS CLI, use the following command: +### Step 3. Import data into TiDB Cloud - {{< copyable "shell-regular" >}} +1. On the **Data Import Task** page, besides the **Role ARN** field, you also need to fill in the following information: - ```shell - aws s3 sync - ``` + - **Data Source Type**: `AWS S3`. + - **Bucket URL**: fill in the bucket URL of your source data. + - **Data Format**: choose the format of your data. + - **Target Cluster**: fill in the **Username** and **Password** fields. + - **DB/Tables Filter**: if necessary, you can specify a [table filter](/table-filter.md#syntax). If you want to configure multiple filter rules, use `,` to separate the rules. - For example: +2. Click **Import**. - {{< copyable "shell-regular" >}} + A warning message about the database resource consumption is displayed. - ```shell - aws s3 sync ./tidbcloud-samples-us-west-2/ s3://target-url-in-s3 - ``` +3. Click **Confirm**. -2. From the TiDB Cloud console, navigate to the TiDB Clusters page, and then click the name of your target cluster to go to its own overview page. In the cluster information pane on the left, click **Import**, and then fill in the importing related information on the **Data Import Task** page. + TiDB Cloud starts validating whether it can access your data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. If you get the `AccessDenied` error, see [Troubleshoot Access Denied Errors during Data Import from S3](/tidb-cloud/troubleshoot-import-access-denied-error.md). -> **Note:** -> -> To minimize egress charges and latency, locate your Amazon S3 bucket and TiDB Cloud database cluster in the same region. +After the data is imported, if you want to remove the Amazon S3 access of TiDB Cloud, simply delete the policy that you added in [Step 2. Configure Amazon S3 access](#step-2-configure-amazon-s3-access). ## Import or migrate from GCS to TiDB Cloud -If your organization is using TiDB Cloud as a service on Google Cloud Platform (GCP), you can use Google Cloud Storage (GCS) as a staging area for importing or migrating data into TiDB Cloud. +If your organization is using TiDB Cloud as a service on Google Cloud Platform (GCP), you can use Google Cloud Storage (GCS) as a staging area for importing or migrating data into TiDB Cloud. ### Prerequisites @@ -210,36 +213,32 @@ To allow TiDB cloud to access the source data in your GCS bucket, you need to co 1. In the **New Principals** field, paste the Google Cloud Service Account ID of the target TiDB cluster. 2. In the **Role** drop-down list, choose the role of the target TiDB cluster. 3. Click **SAVE**. - + Your TiDB Cloud cluster can now access the GCS bucket. > **Note:** > > To remove the access to TiDB Cloud, you can simply delete the principal that you added. -### Step 3. Copy source data files to GCS and import data into TiDB Cloud +### Step 3. Copy source data files to GCS and import data into TiDB Cloud 1. To copy your source data files to your GCS bucket, you can upload the data to the GCS bucket using either Google Cloud Console or gsutil. - To upload data using Google Cloud Console, see [Creating storage buckets](https://cloud.google.com/storage/docs/creating-buckets) in Google Cloud Storage documentation. - To upload data using gsutil, use the following command: - {{< copyable "shell-regular" >}} - ```shell - gsutil rsync -r + gsutil rsync -r ``` For example: - {{< copyable "shell-regular" >}} - ```shell gsutil rsync -r ./tidbcloud-samples-us-west-2/ gs://target-url-in-gcs - ``` + ``` 2. From the TiDB Cloud console, navigate to the TiDB Clusters page, and then click the name of your target cluster to go to its own overview page. In the cluster information pane on the left, click **Import**, and then fill in the importing related information on the **Data Import Task** page. > **Note:** > -> To minimize egress charges and latency, locate your GCS bucket and TiDB Cloud database cluster in the same region. +> To minimize egress charges and latency, locate your GCS bucket and TiDB Cloud database cluster in the same region. diff --git a/tidb-cloud/migrate-from-aurora-bulk-import.md b/tidb-cloud/migrate-from-aurora-bulk-import.md index 5881c4ed959ee..cbe81284b140f 100644 --- a/tidb-cloud/migrate-from-aurora-bulk-import.md +++ b/tidb-cloud/migrate-from-aurora-bulk-import.md @@ -17,7 +17,13 @@ To import data, perform the following steps: 4. Fill in the **Data Source Type**, **Bucket URL**, and **Data Format** fields according to the specification of your source data. 5. Fill in the **Username** and **Password** fields of the **Target Database** according to the connection settings of your cluster. 6. Create the bucket policy and role for cross-account access according to [Learn how to configure cross-account access](#learn-how-to-configure-cross-account-access). -7. Click **Import** to create the task. +7. Click **Import**. + + A warning message about the database resource consumption is displayed. + +8. Click **Confirm**. + + TiDB Cloud starts validating whether it can access your data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. If you get the `AccessDenied` error, see [Troubleshoot Access Denied Errors during Data Import from S3](/tidb-cloud/troubleshoot-import-access-denied-error.md). > **Note:** > @@ -29,7 +35,7 @@ To prepare data, you can select one from the following two options: - [Option 1: Prepare source data files using Dumpling](#option-1-prepare-source-data-files-using-dumpling) - You need to launch [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) on your EC2, and export the data to Amazon S3. The data you export is the current latest data of your source database. This might affect the online service. Dumpling will lock the table when you export data. + You need to launch [Dumpling](/dumpling-overview.md) on your EC2, and export the data to Amazon S3. The data you export is the current latest data of your source database. This might affect the online service. Dumpling will lock the table when you export data. - [Option 2: Prepare source data files using Amazon Aurora snapshots](#option-2-prepare-source-data-files-using-amazon-aurora-snapshots) @@ -98,7 +104,7 @@ You need to prepare an EC2 to run the following data export task. It's better to 3. Back up the source database to S3. - Use Dumpling to export the data from Amazon Aurora. Based on your environment, replace the content in angle brackets (>), and then execute the following commands. If you want to use filter rules when exporting the data, refer to [Table Filter](https://docs.pingcap.com/tidb/stable/table-filter#cli). + Use Dumpling to export the data from Amazon Aurora. Based on your environment, replace the content in angle brackets (>), and then execute the following commands. If you want to use filter rules when exporting the data, refer to [Table Filter](/table-filter.md#syntax). {{< copyable "shell-regular" >}} @@ -197,7 +203,7 @@ Once finished, you will have created a policy and role for cross-account. You ca ## Learn how to set up filter rules -Refer to the [Table Filter](https://docs.pingcap.com/tidb/stable/table-filter#cli) document. Currently, TiDB Cloud only supports one table filter rule. +Refer to the [Table Filter](/table-filter.md#syntax) document. ## Learn how to clean up incomplete data diff --git a/tidb-cloud/monitor-built-in-alerting.md b/tidb-cloud/monitor-built-in-alerting.md index a882df8959441..3346bb92bf5ac 100644 --- a/tidb-cloud/monitor-built-in-alerting.md +++ b/tidb-cloud/monitor-built-in-alerting.md @@ -45,13 +45,13 @@ The following table provides the TiDB Cloud built-in alert conditions and the co |:--- |:--- | | Total TiDB node memory utilization across cluster exceeded 70% for 10 minutes | Total TiDB node memory utilization of cluster ABC in project XYZ has exceeded 70% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiDB nodes. To monitor node memory utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | | Total TiKV node memory utilization across cluster exceeded 70% for 10 minutes | Total TiKV node memory utilization of cluster ABC in project XYZ has exceeded 70% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiKV nodes. To monitor node memory utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | -| Total TiFlashbeta node memory utilization across cluster exceeded 70% for 10 minutes | Total TiFlashbeta node memory utilization of cluster ABC in project XYZ has exceeded 70% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiFlashbeta nodes. To monitor node memory utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | +| Total TiFlash node memory utilization across cluster exceeded 70% for 10 minutes | Total TiFlash node memory utilization of cluster ABC in project XYZ has exceeded 70% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiFlash nodes. To monitor node memory utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | |`*` At least one TiDB node in the cluster has run out of memory | At least one TiDB node in cluster ABC in project XYZ ran out of memory while executing a SQL statement. Consider increasing the memory available to queries using the `tidb_mem_quota_query` session variable. To monitor node memory utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | | Total TiDB node CPU utilization exceeded 80% for 10 minutes | Total TiDB node CPU utilization of cluster ABC in project XYZ has exceeded 80% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiDB nodes. To monitor node CPU utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | | Total TiKV node CPU utilization exceeded 80% for 10 minutes | Total TiKV node CPU utilization of cluster ABC in project XYZ has exceeded 80% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiKV nodes. To monitor node CPU utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | -| Total TiFlashbeta node CPU utilization exceeded 80% for 10 minutes | Total TiFlashbeta node CPU utilization of cluster ABC in project XYZ has exceeded 80% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiFlashbeta nodes. To monitor node CPU utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | +| Total TiFlash node CPU utilization exceeded 80% for 10 minutes | Total TiFlash node CPU utilization of cluster ABC in project XYZ has exceeded 80% for 10 minutes. If you expect this to continue, it is recommended that you add additional TiFlash nodes. To monitor node CPU utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | |`*` TiKV storage utilization exceeds 80% | Total TiKV storage utilization of cluster ABC in project XYZ exceeds 80%. It is recommended that you add additional TiKV nodes to increase your storage capacity. To monitor storage utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | -|`*` TiFlashbeta storage utilization exceeds 80% | Total TiFlashbeta storage utilization of cluster ABC in project XYZ exceeds 80%. It is recommended that you add additional TiFlashbeta nodes to increase your storage capacity. To monitor storage utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | +|`*` TiFlash storage utilization exceeds 80% | Total TiFlash storage utilization of cluster ABC in project XYZ exceeds 80%. It is recommended that you add additional TiFlash nodes to increase your storage capacity. To monitor storage utilization, see [Monitoring metrics](/tidb-cloud/monitor-tidb-cluster.md#monitoring-metrics). | | Cluster nodes are offline | Some or all nodes in cluster ABC in project XYZ are offline. The TiDB Cloud Operations team is aware and working to resolve the issue. Refer to [TiDB Cloud Status](https://status.tidbcloud.com/) for the latest information. To monitor node status, see [Cluster status and node status](/tidb-cloud/monitor-tidb-cluster.md#cluster-status-and-node-status). | > **Note:** diff --git a/tidb-cloud/monitor-datadog-integration.md b/tidb-cloud/monitor-datadog-integration.md index 1553f38b970c0..04a3ca9a3f2ad 100644 --- a/tidb-cloud/monitor-datadog-integration.md +++ b/tidb-cloud/monitor-datadog-integration.md @@ -54,9 +54,9 @@ Datadog tracks the following metric data for your TiDB clusters. | tidb_cloud.db_failed_queries_total | count | type: `planner:xxx\|executor:2345\|...`
cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | The total number of execution errors | | tidb_cloud.db_connections | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | Current number of connections in your TiDB server | | tidb_cloud.db_query_duration_seconds | histogram | sql_type: `Select\|Insert\|...`
cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | The duration histogram of statements | -| tidb_cloud.node_storage_used_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk usage bytes of TiKV/TiFlashbeta nodes | -| tidb_cloud.node_storage_capacity_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk capacity bytes of TiKV/TiFlashbeta nodes | -| tidb_cloud.node_cpu_seconds_total | count | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU usage of TiDB/TiKV/TiFlashbeta nodes | -| tidb_cloud.node_cpu_capacity_cores | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU limit cores of TiDB/TiKV/TiFlashbeta nodes | -| tidb_cloud.node_memory_used_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The used memory bytes of TiDB/TiKV/TiFlashbeta nodes | -| tidb_cloud.node_memory_capacity_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The memory capacity bytes of TiDB/TiKV/TiFlashbeta nodes | +| tidb_cloud.node_storage_used_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk usage bytes of TiKV/TiFlash nodes | +| tidb_cloud.node_storage_capacity_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk capacity bytes of TiKV/TiFlash nodes | +| tidb_cloud.node_cpu_seconds_total | count | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU usage of TiDB/TiKV/TiFlash nodes | +| tidb_cloud.node_cpu_capacity_cores | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU limit cores of TiDB/TiKV/TiFlash nodes | +| tidb_cloud.node_memory_used_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The used memory bytes of TiDB/TiKV/TiFlash nodes | +| tidb_cloud.node_memory_capacity_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The memory capacity bytes of TiDB/TiKV/TiFlash nodes | diff --git a/tidb-cloud/monitor-prometheus-and-grafana-integration.md b/tidb-cloud/monitor-prometheus-and-grafana-integration.md index 0ffe9082810b9..f4dced7aebd8e 100644 --- a/tidb-cloud/monitor-prometheus-and-grafana-integration.md +++ b/tidb-cloud/monitor-prometheus-and-grafana-integration.md @@ -73,9 +73,9 @@ Prometheus tracks the following metric data for your TiDB clusters. | tidbcloud_db_failed_queries_total | count | type: `planner:xxx\|executor:2345\|...`
cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | The total number of execution errors | | tidbcloud_db_connections | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | Current number of connections in your TiDB server | | tidbcloud_db_query_duration_seconds | histogram | sql_type: `Select\|Insert\|...`
cluster_name: ``
instance: `tidb-0\|tidb-1…`
component: `tidb` | The duration histogram of statements | -| tidbcloud_node_storage_used_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk usage bytes of TiKV/TiFlashbeta nodes | -| tidbcloud_node_storage_capacity_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk capacity bytes of TiKV/TiFlashbeta nodes | -| tidbcloud_node_cpu_seconds_total | count | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU usage of TiDB/TiKV/TiFlashbeta nodes | -| tidbcloud_node_cpu_capacity_cores | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU limit cores of TiDB/TiKV/TiFlashbeta nodes | -| tidbcloud_node_memory_used_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The used memory bytes of TiDB/TiKV/TiFlashbeta nodes | -| tidbcloud_node_memory_capacity_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The memory capacity bytes of TiDB/TiKV/TiFlashbeta nodes | \ No newline at end of file +| tidbcloud_node_storage_used_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk usage bytes of TiKV/TiFlash nodes | +| tidbcloud_node_storage_capacity_bytes | gauge | cluster_name: ``
instance: `tikv-0\|tikv-1…\|tiflash-0\|tiflash-1…`
component: `tikv\|tiflash` | The disk capacity bytes of TiKV/TiFlash nodes | +| tidbcloud_node_cpu_seconds_total | count | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU usage of TiDB/TiKV/TiFlash nodes | +| tidbcloud_node_cpu_capacity_cores | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The CPU limit cores of TiDB/TiKV/TiFlash nodes | +| tidbcloud_node_memory_used_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The used memory bytes of TiDB/TiKV/TiFlash nodes | +| tidbcloud_node_memory_capacity_bytes | gauge | cluster_name: ``
instance: `tidb-0\|tidb-1…\|tikv-0…\|tiflash-0…`
component: `tidb\|tikv\|tiflash` | The memory capacity bytes of TiDB/TiKV/TiFlash nodes | \ No newline at end of file diff --git a/tidb-cloud/monitor-tidb-cluster.md b/tidb-cloud/monitor-tidb-cluster.md index 2898c9e10c810..2eb52ccca69e5 100644 --- a/tidb-cloud/monitor-tidb-cluster.md +++ b/tidb-cloud/monitor-tidb-cluster.md @@ -18,7 +18,7 @@ You can see the current status of each running cluster on the cluster page. | **Normal** | Normal running (including data migration) | | **Creating** | Creating the cluster | | **Importing** | The cluster is importing data | -| **Scaling** | Scaling the TiDB, TiKV, or TiFlashbeta nodes | +| **Scaling** | Scaling the TiDB, TiKV, or TiFlash nodes | | **Upgrading** | Upgrading the TiDB version | | **Unavailable** | The TiDB Cloud service is not available | | **Unhealthy** | Part of nodes are unavailable, not enough replicas, and so on | @@ -51,7 +51,7 @@ On the cluster overview page, you can view the commonly used metrics of the clus 2. Click the name of a cluster to go to the cluster overview page. - Currently, the metrics include Total QPS, Latency, Connections, TiFlashbeta Request QPS, TiFlashbeta Request Duration, TiFlashbeta Storage Size, TiKV Storage Size, TiDB CPU, TiKV CPU, TiKV IO Read, and TiKV IO Write. + Currently, the metrics include Total QPS, Latency, Connections, TiFlash Request QPS, TiFlash Request Duration, TiFlash Storage Size, TiKV Storage Size, TiDB CPU, TiKV CPU, TiKV IO Read, and TiKV IO Write. ## Built-in alerting diff --git a/tidb-cloud/release-notes-2020.md b/tidb-cloud/release-notes-2020.md index e547b57dec765..4a5c1c24b55e7 100644 --- a/tidb-cloud/release-notes-2020.md +++ b/tidb-cloud/release-notes-2020.md @@ -34,7 +34,7 @@ This page lists the release notes of [TiDB Cloud](https://en.pingcap.com/tidb-cl * Update Terms of Service and Privacy location in the Sign Up page * Add a feedback form entrance widget * Prevent Members from deleting owner(s) in the Preference tab -* Change TiFlashbeta and TiKV storage chart metrics +* Change TiFlash and TiKV storage chart metrics * Upgrade the default TiDB cluster version to 4.0.8 ## October 12, 2020 @@ -45,7 +45,7 @@ This page lists the release notes of [TiDB Cloud](https://en.pingcap.com/tidb-cl ## October 2, 2020 -* Fix TiFlashbeta disk storage configuration +* Fix TiFlash disk storage configuration ## September 14, 2020 diff --git a/tidb-cloud/release-notes-2021.md b/tidb-cloud/release-notes-2021.md index 3e4de74a62284..cfc92acea4ef7 100644 --- a/tidb-cloud/release-notes-2021.md +++ b/tidb-cloud/release-notes-2021.md @@ -46,7 +46,7 @@ Bug fixes: * One TiDB shared node * One TiKV shared node (with 500 MiB of OLTP storage) - * One TiFlashbeta shared node (with 500 MiB of OLAP storage) + * One TiFlash shared node (with 500 MiB of OLAP storage) Get started [here](/tidb-cloud/tidb-cloud-quickstart.md). diff --git a/tidb-cloud/release-notes-2022.md b/tidb-cloud/release-notes-2022.md index 76d7f2d86dcff..816f4625a4daf 100644 --- a/tidb-cloud/release-notes-2022.md +++ b/tidb-cloud/release-notes-2022.md @@ -8,6 +8,49 @@ aliases: ['/tidbcloud/beta/supported-tidb-versions','/tidbcloud/release-notes'] This page lists the release notes of [TiDB Cloud](https://en.pingcap.com/tidb-cloud/) in 2022. +## July 26, 2022 + +* Support automatic hibernation and resuming for new Developer Tier clusters. + + A Developer Tier cluster will not be deleted after 7 days of inactivity so you can still use it at any time until the one-year free trial ends. After 24 hours of inactivity, the Developer Tier cluster will hibernate automatically. To resume the cluster, either send a new connection to the cluster or click the **Resume** button in the TiDB Cloud console. The cluster will be resumed within 50 seconds and back to service automatically. + +* Add a user name prefix limitation for new Developer Tier clusters + + Whenever you use or set a database user name, you must include the prefix for your cluster in the user name. For more information, see [User name prefix](/tidb-cloud/select-cluster-tier.md#user-name-prefix). + +* Disable the backup and restore feature for Developer Tier clusters. + + The backup and restore feature (including both automatic backup and manual backup) is disabled for Developer Tier clusters. You can still use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as a backup. + +* Increase the storage size of a Developer Tier cluster from 500 MiB to 1 GiB. +* Add breadcrumbs to the TiDB Cloud console to improve the navigation experience. +* Support configuring multiple filter rules when you import data into TiDB Cloud. +* Remove the **Traffic Filters** page from **Project Settings**, and remove the **Add Rules from Default Set** button from the **Connect to TiDB** dialog. + +## July 19, 2022 + +* Provide a new option for TiKV node size: `8 vCPU, 32 GiB`. You can choose either `8 vCPU, 32 GiB` or `8 vCPU, 64 GiB` for an 8 vCPU TiKV node. +* Support syntax highlighting in sample code provided in the **Connect to TiDB** dialog to improve code readability. You can easily identify the parameters that you need to replace in the sample code. +* Support automatically validating whether TiDB Cloud can access your source data after you confirm the import task on the **Data Import Task** page. +* Change the theme color of the TiDB Cloud console to make it consistent with that of [PingCAP website](https://en.pingcap.com/). + +## July 12, 2022 + +* Add the **Validate** button to the **Data Import Task** page for Amazon S3, which helps you detect data access issues before the data import starts. +* Add **Billing Profile** under the **Payment Method** tab. By providing your tax registration number in **Billing Profile**, certain taxes might be exempted from your invoice. + +## July 05, 2022 + +* The columnar storage TiFlash is now in General Availability (GA). + + - TiFlash makes TiDB essentially an Hybrid Transactional/Analytical Processing (HTAP) database. Your application data is first stored in TiKV and then replicated to TiFlash via the Raft consensus algorithm. So it is real time replication from the row storage to the columnar storage. + - For tables with TiFlash replicas, the TiDB optimizer automatically determines whether to use either TiKV or TiFlash replicas based on the cost estimation. + + To experience the benefits brought by TiFlash, see [TiDB Cloud HTAP Quick Start Guide](/tidb-cloud/tidb-cloud-htap-quickstart.md). + +* Support [increasing the storage size](/tidb-cloud/scale-tidb-cluster.md) of TiKV and TiFlash for a Dedicated Tier cluster. +* Support showing the memory information in the node size field. + ## June 28, 2022 * Upgrade TiDB Cloud Dedicated Tier from [TiDB v5.4.1](https://docs.pingcap.com/tidb/stable/release-5.4.1) to [TiDB v6.1.0](https://docs.pingcap.com/tidb/stable/release-6.1.0). @@ -64,7 +107,7 @@ This page lists the release notes of [TiDB Cloud](https://en.pingcap.com/tidb-cl ## May 1, 2022 -* Support configuring vCPU size of TiDB, TiKV, and TiFlashbeta when you create or restore a cluster. +* Support configuring vCPU size of TiDB, TiKV, and TiFlash when you create or restore a cluster. * Add the support of the AWS region `Mumbai` for cluster creation. * Update the compute, storage, and data transfer cost for [TiDB Cloud billing](/tidb-cloud/tidb-cloud-billing.md). @@ -92,11 +135,11 @@ New feature: General changes: -* No cluster tier with the fixed cluster size any more. You can customize the cluster size of TiDB, TiKV, and TiFlashbeta easily. -* Support adding TiFlashbeta nodes for an existing cluster without TiFlash. +* No cluster tier with the fixed cluster size any more. You can customize the cluster size of TiDB, TiKV, and TiFlash easily. +* Support adding TiFlash nodes for an existing cluster without TiFlash. * Support specifying the storage size (500 to 2048 GiB) when creating a new cluster. The storage size cannot be changed after the cluster is created. * Introduce a new public region: `eu-central-1`. -* Deprecate 8 vCPU TiFlashbeta and provide 16 vCPU TiFlash. +* Deprecate 8 vCPU TiFlash and provide 16 vCPU TiFlash. * Separate the price of CPU and storage (both have 30% public preview discount). * Update the [billing information](/tidb-cloud/tidb-cloud-billing.md) and the [price table](https://en.pingcap.com/tidb-cloud/#pricing). diff --git a/tidb-cloud/scale-tidb-cluster.md b/tidb-cloud/scale-tidb-cluster.md index 6bbff20bdf9be..812f2a6eebaa3 100644 --- a/tidb-cloud/scale-tidb-cluster.md +++ b/tidb-cloud/scale-tidb-cluster.md @@ -11,65 +11,93 @@ aliases: ['/tidbcloud/beta/scale-tidb-cluter'] > - Currently, you cannot scale a [Developer Tier cluster](/tidb-cloud/select-cluster-tier.md#developer-tier). > - When a cluster is in the scaling status, you cannot perform any new scaling operations on it. -## Scale out a cluster +You can scale a TiDB cluster in the following dimensions: -To scale out a cluster, take the following steps: +- Node number of TiDB, TiKV, and TiFlash +- Storage size of TiKV and TiFlash +- Node size (including vCPUs and memory) of TiDB, TiKV, and TiFlash -1. Navigate to the TiDB Clusters page and click the name of a cluster that you want to scale. The overview page of the cluster is displayed. +For information about how to determine the size of your TiDB cluster, see [Determine Your TiDB Size](/tidb-cloud/size-your-cluster.md). + +## Change node number + +You can change the number of TiDB, TiKV, or TiFlash nodes. + +### Increase node number + +To increase the number of TiDB, TiKV, or TiFlash nodes, take the following steps: + +1. In the TiDB Cloud console, navigate to the **Active Clusters** page for your project, and then click the name of a cluster that you want to scale. The overview page of the cluster is displayed. 2. In the cluster information pane on the left, click **Setting**. 3. Click **Scale** in the drop-down menu. The **Scale** window is displayed. -4. In the **Scale** window, increase the node quantity of your TiDB, TiKV, and TiFlashbeta respectively. +4. In the **Scale** window, increase the number of TiDB, TiKV, or TiFlash nodes. 5. Click **Confirm**. -## Scale the vCPU or storage size +### Decrease node number -When a cluster is running, you cannot change its vCPU or storage size. To make such changes, take either of the following methods: +To decrease the number of TiDB nodes, take the following steps: -> **Warning:** -> -> Scaling down the vCPU or storage size of TiKV or TiFlashbeta nodes can be risky, which might lead to insufficient storage space, excessive CPU usage, or excessive memory usage on remaining nodes. If you need to do that, choose Method 2: Scale vCPU or storage size through a support ticket. +1. In the TiDB Cloud console, navigate to the **Active Clusters** page for your project, and then click the name of a cluster that you want to scale. The overview page of the cluster is displayed. +2. In the cluster information pane on the left, click **Setting**. +3. Click **Scale** in the drop-down menu. The **Scale** window is displayed. +4. In the **Scale** window, decrease the number of TiDB nodes. +5. Click **Confirm**. -- Method 1: Scale vCPU or storage size through backup and restore +To decrease the number of TiKV or TiFlash nodes, you need to submit a support ticket. The PingCAP support team will contact you and complete the scaling within the agreed time. - Scaling vCPU or storage size through backup and restore means that you need to [create a latest backup of the cluster](/tidb-cloud/backup-and-restore.md#manual-backup), [delete the cluster](/tidb-cloud/delete-tidb-cluster.md), and then change the vCPU or storage size when you [restore the deleted cluster](/tidb-cloud/backup-and-restore.md#restore-a-deleted-cluster). Before taking this method, make sure the following impacts are acceptable: +> **Warning:** +> +> Decreasing TiKV or TiFlash node number can be risky, which might lead to insufficient storage space, excessive CPU usage, or excessive memory usage on remaining nodes. - - To avoid any data loss during or after the backup, you need to stop the connection to the cluster through your SQL client before creating the backup. - - After you stop the connection to the cluster, your applications running on this cluster cannot provide service normally until the restoring process is completed. +To submit a support ticket, perform the steps in [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md). For each node to be scaled, provide the following information in the **Description** box: -- Method 2: Scale vCPU or storage size through a support ticket +- Cluster name: xxx +- Cloud provider: GCP or AWS +- Node type: TiKV or TiFlash +- Current node number: xxx +- Expected node number: xxx - Perform the steps in [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md) to create a support ticket. For each node to be scaled, provide the following information in the **Description** box of the ticket: +## Change storage size - - Node type: TiDB, TiKV, or TiFlash - - Current vCPU size: xxx - - Expected vCPU size: xxx - - Current storage size: xxx - - Expected storage size: xxx - - Cloud Provider: GCP or AWS - - Cluster Name: xxx +You can change the storage size of TiKV or TiFlash. -## Scale in TiDB nodes +### Increase storage size -To scale in TiDB nodes, take the following steps: +To increase the storage size of TiKV or TiFlash, take the following steps: -1. Navigate to the TiDB Clusters page and click the name of a cluster that you want to scale. The overview page of the cluster is displayed. +1. In the TiDB Cloud console, navigate to the **Active Clusters** page for your project, and then click the name of a cluster that you want to scale. The overview page of the cluster is displayed. 2. In the cluster information pane on the left, click **Setting**. 3. Click **Scale** in the drop-down menu. The **Scale** window is displayed. -4. In the **Scale** window, decrease the node quantity of your TiDB. +4. In the **Scale** window, increase the storage size of TiKV or TiFlash. 5. Click **Confirm**. -## Scale in TiKV or TiFlashbeta nodes +> **Note:** +> +> AWS has a cooldown period of storage size changes. If your TiDB cluster is hosted by AWS, after changing the storage size of TiKV or TiFlash, you must wait at least six hours before you can change it again. -To scale in TiKV nodes or TiFlashbeta nodes, you need to submit a scale-in support ticket. We will contact you and complete the scale-in within the agreed time. +### Decrease storage size -> **Warning:** -> -> Scaling in your TiKV nodes and TiFlashbeta nodes can be risky, which might lead to insufficient storage space, excessive CPU usage, or excessive memory usage on remaining nodes. +For a running cluster, AWS and Google Cloud do not allow in-place storage capacity downgrade. -To submit a scale-in request, perform the steps in [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md) to contact our support team. For each node to be scaled, provide the following information in the **Description** box: +## Increase node size -- Node type: TiKV or TiFlash -- Current node number: xxx -- Expected node number: xxx -- Cloud Provider: GCP or AWS -- Cluster Name: xxx +When a cluster is running, you cannot increase its node size. To make such changes, take either of the following methods: + +- Method 1: Increase the node size through backup and restore + + You need to [create a latest backup of the cluster](/tidb-cloud/backup-and-restore.md#manual-backup), [delete the cluster](/tidb-cloud/delete-tidb-cluster.md), and then increase the node size when you [restore the deleted cluster](/tidb-cloud/backup-and-restore.md#restore-a-deleted-cluster). Before taking this method, make sure the following impacts are acceptable: + + - To avoid any data loss during or after the backup, you need to stop the connection to the cluster through your SQL client before creating the backup. + - After you stop the connection to the cluster, your applications running on this cluster cannot provide service normally until the restoring process is completed. + +- Method 2: Increase the node size through a support ticket + + To submit a support ticket, perform the steps in [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md). The PingCAP support team will contact you and complete the scaling within the agreed time. + + For each node to be scaled, provide the following information in the **Description** box of the ticket: + + - Cluster name: xxx + - Cloud provider: GCP or AWS + - Node type: TiDB, TiKV, or TiFlash + - Current node size: xxx + - Expected node size: xxx \ No newline at end of file diff --git a/tidb-cloud/select-cluster-tier.md b/tidb-cloud/select-cluster-tier.md index 572108a54a1cc..6c327a6d254da 100644 --- a/tidb-cloud/select-cluster-tier.md +++ b/tidb-cloud/select-cluster-tier.md @@ -20,38 +20,75 @@ The TiDB Cloud Developer Tier is a one-year free trial of [TiDB Cloud](https://p Each Developer Tier cluster is a full-featured TiDB cluster and comes with the following: - 1 TiDB shared node -- 1 TiKV shared node (with 500 MiB of OLTP storage) -- 1 TiFlashbeta shared node (with 500 MiB of OLAP storage) +- 1 TiKV shared node (with 1 GiB of OLTP storage) +- 1 TiFlash shared node (with 1 GiB of OLAP storage) -Developer Tier clusters run on shared nodes. Although each node is run in its own container on a virtual machine (VM), that VM is also running other TiDB, TiKV, or TiFlashbeta nodes. As a result, shared nodes will have reduced performance when compared to standard, dedicated TiDB Cloud nodes. However, as all nodes are running in separate containers and have dedicated cloud disks, data stored in a Developer Tier cluster is isolated and will never be exposed to other TiDB clusters. +Developer Tier clusters run on shared nodes. Although each node is run in its own container on a virtual machine (VM), that VM is also running other TiDB, TiKV, or TiFlash nodes. As a result, shared nodes will have reduced performance when compared to standard, dedicated TiDB Cloud nodes. However, as all nodes are running in separate containers and have dedicated cloud disks, data stored in a Developer Tier cluster is isolated and will never be exposed to other TiDB clusters. For each TiDB Cloud account, you can use one complimentary Developer Tier cluster to use for one year. Although you can only run one Developer Tier cluster at a time, you can delete and recreate the cluster as many times as you wish. The one-year free trial begins the day the first Developer Tier cluster is created. +### User name prefix + + + +For each Developer Tier cluster, TiDB Cloud generates a unique prefix to distinguish it from other clusters. + +Whenever you use or set a database user name, you must include the prefix in the user name. For example, assume that the prefix of your cluster is `3pTAoNNegb47Uc8`. + +- To connect to your cluster: + + ```shell + mysql --connect-timeout 15 -u '3pTAoNNegb47Uc8.root' -h -P 4000 -D test -p + ``` + +- To create a database user: + + ```sql + CREATE USER '3pTAoNNegb47Uc8.jeffrey'; + ``` + +To get the prefix for your cluster, take the following steps: + +1. In the TiDB Cloud console, navigate to the **Active Clusters** page of your project and click the name of your cluster. +2. In the cluster information pane on the left, click **Connect**. The **Connect to TiDB** dialog is displayed. +3. In the dialog, locate **Step 2: Connect with a SQL client** and get the prefix. + +### Automatic hibernation and resuming + +Once a Developer Tier cluster remains idle for 24 hours, the cluster hibernates automatically. + +The hibernation does not affect your data stored in the cluster but only stops the monitoring information collection and computing resource consumption. + +During the hibernation, the status of the cluster is still displayed as **Normal**, and you can see a message about hibernation in the TiDB Cloud console. + +Anytime you want to use your Developer Tier cluster again, just connect to your cluster using your MySQL client driver or ORM framework as you usually do. The cluster will be resumed within 50 seconds and back to service automatically. + +Alternatively, you can log in to the TiDB Cloud console, and then click **Resume** for the cluster on the **Active Clusters** page. + ### Developer Tier special terms and conditions - No uptime SLA guarantee. - No high availability or automatic failover. - Upgrades to clusters might incur significant downtimes. -- Each cluster allows one automatic daily backup and two manual backups. -- The maximum number of connections to the Dev Tier cluster is 50. +- The backup and restore feature is unavailable. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as a backup. +- The maximum number of connections to the Developer Tier cluster is 50. - You cannot create any changefeeds (Apache Kafka Sink and MySQL Sink) or use [TiCDC](https://docs.pingcap.com/tidb/stable/ticdc-overview) to replicate incremental data. - You cannot use VPC Peering to connect to clusters. - You cannot scale clusters to larger storage, standard nodes, or increase the number of nodes. - You cannot use a third-party monitoring service. - You cannot customize the port number of a TiDB cluster. - The data transfer is limited to a total of 20 GiB in and out per week. If the 20 GiB limit is reached, the network traffic will be throttled to 10 KB/s. -- The cluster will be backed up and shut down after 7 days of inactivity. To use the cluster again, you can restore it from previous backups. ## Dedicated Tier The TiDB Cloud Dedicated Tier is dedicated for production use with the benefits of cross-zone high availability, horizontal scaling, and [HTAP](https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing). -For Dedicated Tier clusters, you can customize the cluster size of TiDB, TiKV, and TiFlashbeta easily according to your business need. For each TiKV node and TiFlash node, the data on the node is replicated and distributed in different availability zones for [high availability](/tidb-cloud/high-availability-with-multi-az.md). +For Dedicated Tier clusters, you can customize the cluster size of TiDB, TiKV, and TiFlash easily according to your business need. For each TiKV node and TiFlash node, the data on the node is replicated and distributed in different availability zones for [high availability](/tidb-cloud/high-availability-with-multi-az.md). To create a Dedicated Tier cluster, you need to [add a payment method](/tidb-cloud/tidb-cloud-billing.md#payment-method) or [apply for a Proof of Concept (PoC) trial](/tidb-cloud/tidb-cloud-poc.md). > **Note:** > -> You cannot change the cluster storage size after your cluster is created. \ No newline at end of file +> You cannot decrease the cluster storage size after your cluster is created. \ No newline at end of file diff --git a/tidb-cloud/set-up-vpc-peering-connections.md b/tidb-cloud/set-up-vpc-peering-connections.md index 8adaddbdf6f2d..2e79c9b10ca1c 100644 --- a/tidb-cloud/set-up-vpc-peering-connections.md +++ b/tidb-cloud/set-up-vpc-peering-connections.md @@ -11,13 +11,13 @@ VPC peering connection is a networking connection between two VPCs that enables Currently, TiDB Cloud only supports VPC peering in the same region for the same project. TiDB clusters of the same project in the same region are created in the same VPC. Therefore, once VPC peering is set up in a region of a project, all the TiDB clusters created in the same region of this project can be connected in your VPC. VPC peering setup differs among cloud providers. -## Prerequisites +## Prerequisite: Set a Project CIDR Project CIDR (Classless Inter-Domain Routing) is the CIDR block used for network peering in a project. -Before adding VPC Peering requests to a region, you need to set a project CIDR for your project's AWS and GCP respectively to establish a peering link to your application's VPC. +Before adding VPC Peering requests to a region, you need to set a project CIDR for your project's cloud provider (AWS or GCP) to establish a peering link to your application's VPC. -You can set the project CIDR during creating the first Dedicated Tier of your project. If you want to set the project CIDR before creating the tier, do the following: +You can set the project CIDR when creating the first Dedicated Tier of your project. If you want to set the project CIDR before creating the tier, perform the following operations: 1. On the TiDB Cloud console, choose a target project, and then click the **Project Settings** tab. @@ -65,8 +65,6 @@ You can set the project CIDR during creating the first Dedicated Tier of your pr 3. Click **Initialize**. The **Approve VPC Peerings** dialog is displayed. - ![Add VPC peering](/media/tidb-cloud/vpc-peering/tidb-cloud-vpc-peering-env-check-information.png) - ### Step 2: Approve and configure the VPC peering Use either of the following two options to approve and configure the VPC peering connection: @@ -99,7 +97,7 @@ Use either of the following two options to approve and configure the VPC peering {{< copyable "shell-regular" >}} ```bash - # Set up the related variables. + # Sets up the related variables. pcx_tidb_to_app_id="" app_region="" app_vpc_id="" @@ -209,8 +207,6 @@ You can also use the AWS dashboard to configure the VPC peering connection. - VPC Network Name - VPC CIDR - ![VPC-Peering](/media/tidb-cloud/VPC-Peering2.png) - 3. Click **Initialize**. The **Approve VPC Peerings** dialog is displayed. 4. Check the connection information of your TiDB VPC peerings. diff --git a/tidb-cloud/size-your-cluster.md b/tidb-cloud/size-your-cluster.md index 2c01d03750632..6779e3b374c68 100644 --- a/tidb-cloud/size-your-cluster.md +++ b/tidb-cloud/size-your-cluster.md @@ -5,47 +5,62 @@ summary: Learn how to determine the size of your TiDB Cloud cluster. # Determine Your TiDB Size -This document describes how to determine the size of your TiDB cluster. +This document describes how to determine the size of a Dedicated Tier cluster. + +> **Note:** +> +> A [Developer Tier cluster](/tidb-cloud/select-cluster-tier.md#developer-tier) comes with a default cluster size, which cannot be changed. ## Size TiDB TiDB is for computing only and does not store data. It is horizontally scalable. -You can configure both vCPUs size and node quantity for TiDB. +You can configure both node size and node quantity for TiDB. -### TiDB vCPUs size +### TiDB node size -The supported vCPU size includes 4 vCPU (Beta), 8 vCPU, and 16 vCPU. +The supported node sizes include the following: + +- 4 vCPU, 16 GiB (Beta) +- 8 vCPU, 16 GiB +- 16 vCPU, 32 GiB > **Note:** > -> If the vCPU size of TiDB is set as **4 vCPU (Beta)**, note the following restrictions: +> If the node size of TiDB is set as **4 vCPU, 16 GiB (Beta)**, note the following restrictions: > > - The node quantity of TiDB can only be set to 1 or 2, and the node quantity of TiKV is fixed to 3. -> - TiDB can only be used with TiKV with 4 vCPU. -> - TiFlashbeta is not supported. +> - TiDB can only be used with 4 vCPU TiKV. +> - TiFlash is unavailable. ### TiDB node quantity For high availability, it is recommended that you configure at least two TiDB nodes for each TiDB Cloud cluster. +For more information about how to determine the TiDB size, see [Performance reference](#performance-reference). + ## Size TiKV TiKV is responsible for storing data. It is horizontally scalable. -You can configure vCPUs size, node quantity, and storage size for TiKV. +You can configure node size, node quantity, and storage size for TiKV. -### TiKV vCPUs size +### TiKV node size -The supported size includes 4 vCPU (Beta), 8 vCPU, and 16 vCPU. +The supported node sizes include the following: + +- 4 vCPU, 16 GiB (Beta) +- 8 vCPU, 32 GiB +- 8 vCPU, 64 GiB +- 16 vCPU, 64 GiB > **Note:** > -> If the vCPUs size of TiKV is set as **4 vCPU (Beta)**, note the following restrictions: +> If the node size of TiKV is set as **4 vCPU, 16 GiB (Beta)**, note the following restrictions: > > - The node quantity of TiDB can only be set to 1 or 2, and the node quantity of TiKV is fixed to 3. -> - TiKV can only be used with TiDB with 4 vCPU. -> - TiFlashbeta is not supported. +> - TiKV can only be used with 4 vCPU TiDB. +> - TiFlash is unavailable. ### TiKV node quantity @@ -65,34 +80,267 @@ For example, if you configure the storage size of each TiKV node on AWS as 1024 Minimum number of TiKV nodes: `ceil(3584 ÷ 1024) × 3 = 12` +For more information about how to determine the TiKV size, see [Performance reference](#performance-reference). + ### TiKV storage size -You can configure the TiKV storage size only when you create or restore a cluster. +- 8 vCPU or 16 vCPU TiKV supports up to 4 TiB storage capacity. +- 4 vCPU TiKV supports up to 2 TiB storage capacity. + +> **Note:** +> +> You cannot decrease the TiKV storage size after the cluster creation. + +## Size TiFlash + +TiFlash synchronizes data from TiKV in real time and supports real-time analytics workloads right out of the box. It is horizontally scalable. + +You can configure node size, node quantity, and storage size for TiFlash. + +### TiFlash node size + +The supported node sizes include the following: + +- 8 vCPU, 64 GiB +- 16 vCPU, 128 GiB + +Note that TiFlash is unavailable when the vCPU size of TiDB or TiKV is set as **4 vCPU, 16 GiB (Beta)**. + +### TiFlash node quantity + +TiDB Cloud deploys TiFlash nodes evenly to different availability zones in a region. It is recommended that you configure at least two TiFlash nodes in each TiDB Cloud cluster and create at least two replicas of the data for high availability in your production environment. + +The minimum number of TiFlash nodes depends on the TiFlash replica counts for specific tables: + +Minimum number of TiFlash nodes: `min((compressed size of table A * replicas for table A + compressed size of table B * replicas for table B) / size of each TiFlash capacity, max(replicas for table A, replicas for table B))` + +For example, if you configure the storage size of each TiFlash node on AWS as 1024 GB, and set 2 replicas for table A (the compressed size is 800 GB) and 1 replica for table B (the compressed size is 100 GB), then the required number of TiFlash nodes is as follows: + +Minimum number of TiFlash nodes: `min((800 GB * 2 + 100 GB * 1) / 1024 GB, max(2, 1)) ≈ 2` + +### TiFlash storage size + +TiFlash supports up to 2 TiB storage capacity. + +> **Note:** +> +> You cannot decrease the TiFlash storage size after the cluster creation. + +## Performance reference + +This section provides [TPC-C](https://www.tpc.org/tpcc/) and [Sysbench](https://github.com/akopytov/sysbench) performance test results of five popular TiDB cluster scales, which can be taken as a reference when you determine the cluster size. + +Test environment: + +- TiDB version: v5.4.0 +- Warehouses: 5000 +- Data size: 366 G +- Table size: 10000000 +- Table count: 16 + +You can click any of the following scales to check its performance data. + +
+TiDB: 4 vCPU * 2; TiKV: 4 vCPU * 3 + +- Optimal performance with low latency + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|---------------| + | TPCC | 300 | 14,532 | 13,137 | 608 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|--------|--------|---------------| + | Insert | 300 | 8,848 | 8,848 | 36 | + | Point Select | 600 | 46,224 | 46,224 | 13 | + | Read Write | 150 | 719 | 14,385 | 209 | + | Update Index | 150 | 4,346 | 4,346 | 35 | + | Update Non-index | 600 | 13,603 | 13,603 | 44 | + +- Maximum TPS and QPS + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 1,200 | 15,208 | 13,748 | 2,321 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|--------|--------|---------------| + | Insert | 1,500 | 11,601 | 11,601 | 129 | + | Point Select | 600 | 46,224 | 46,224 | 13 | + | Read Write | 150 | 14,385 | 719 | 209 | + | Update Index | 1,200 | 6,526 | 6,526 | 184 | + | Update Non-index | 1,500 | 14,351 | 14,351 | 105 | + +
+ +
+TiDB: 8 vCPU * 2; TiKV: 8 vCPU * 3 + +- Optimal performance with low latency + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 600 | 32,266 | 29,168 | 548 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|--------|--------|---------------| + | Insert | 600 | 17,831 | 17,831 | 34 | + | Point Select | 600 | 93,287 | 93,287 | 6 | + | Read Write | 300 | 29,729 | 1,486 | 202 | + | Update Index | 300 | 9,415 | 9,415 | 32 | + | Update Non-index | 1,200 | 31,092 | 31,092 | 39 | + +- Maximum TPS and QPS + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 1,200 | 33,394 | 30,188 | 1,048 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|--------|--------|---------------| + | Insert | 2,000 | 23,633 | 23,633 | 84 | + | Point Select | 600 | 93,287 | 93,287 | 6 | + | Read Write | 600 | 30,464 | 1,523 | 394 | + | Update Index | 2,000 | 15,146 | 15,146 | 132 | + | Update Non-index | 2,000 | 34,505 | 34,505 | 58 | + +
+ +
+TiDB: 8 vCPU * 4; TiKV: 8 vCPU * 6 + +- Optimal performance with low latency + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 1,200 | 62,918 | 56,878 | 310 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 1,200 | 33,892 | 33,892 | 23 | + | Point Select | 1,200 | 185,574 | 181,255 | 4 | + | Read Write | 600 | 59,160 | 2,958 | 127 | + | Update Index | 600 | 18,735 | 18,735 | 21 | + | Update Non-index | 2,400 | 60,629 | 60,629 | 23 | + +- Maximum TPS and QPS + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 2,400 | 65,452 | 59,169 | 570 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 4,000 | 47,029 | 47,029 | 43 | + | Point Select | 1,200 | 185,574 | 181,255 | 4 | + | Read Write | 1,200 | 60,624 | 3,030 | 197 | + | Update Index | 4,000 | 30,140 | 30,140 | 67 | + | Update Non-index | 4,000 | 68,664 | 68,664 | 29 | + +
+ +
+TiDB: 16 vCPU * 2; TiKV: 16 vCPU * 3 + +- Optimal performance with low latency + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 1,200 | 67,941 | 61,419 | 540 | + + Sysbench OLTP performance: + + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 1,200 | 35,096 | 35,096 | 34 | + | Point Select | 1,200 | 228,600 | 228,600 | 5 | + | Read Write | 600 | 73,150 | 3,658 | 164 | + | Update Index | 600 | 18,886 | 18,886 | 32 | + | Update Non-index | 2,000 | 63,837 | 63,837 | 31 | + +- Maximum TPS and QPS + + TPC-C performance: + + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|--------|--------|--------------| + | TPCC | 1,200 | 67,941 | 61,419 | 540 | + + Sysbench OLTP performance: -## Size TiFlashbeta + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 2,000 | 43,338 | 43,338 | 46 | + | Point Select | 1,200 | 228,600 | 228,600 | 5 | + | Read Write | 1,200 | 73,631 | 3,682 | 326 | + | Update Index | 3,000 | 29,576 | 29,576 | 101 | + | Update Non-index | 3,000 | 64,624 | 64,624 | 46 | -TiFlashbeta synchronizes data from TiKV in real time and supports real-time analytics workloads right out of the box. It is horizontally scalable. +
-You can configure vCPUs size, node quantity, and storage size for TiFlashbeta. +
+TiDB: 16 vCPU * 4; TiKV: 16 vCPU * 6 -### TiFlashbeta vCPUs size +- Optimal performance with low latency -The supported vCPUs size includes 8 vCPU and 16 vCPU. + TPC-C performance: -If the vCPUs size of TiDB or TiKV is set as **4 vCPU (Beta)**, TiFlashbeta is not supported. + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|---------|---------|--------------| + | TPCC | 2,400 | 133,164 | 120,380 | 305 | -### TiFlashbeta node quantity + Sysbench OLTP performance: -TiDB Cloud deploys TiFlashbeta nodes evenly to different availability zones in a region. It is recommended that you configure at least two TiFlashbeta nodes in each TiDB Cloud cluster and create at least 2 replicas of the data for high availability in your production environment. + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 2,400 | 69,139 | 69,139 | 22 | + | Point Select | 2,400 | 448,056 | 448,056 | 4 | + | Read Write | 1,200 | 145,568 | 7,310 | 97 | + | Update Index | 1,200 | 36,638 | 36,638 | 20 | + | Update Non-index | 4,000 | 125,129 | 125,129 | 17 | -The minimum number of TiFlashbeta nodes depends on the TiFlashbeta replica counts for specific tables: +- Maximum TPS and QPS -Minimum number of TiFlashbeta nodes: `min((compressed size of table A * replicas for table A + compressed size of table B * replicas for table B) / size of each TiFlash capacity, max(replicas for table A, replicas for table B))` + TPC-C performance: -For example, if you configure the storage size of each TiFlashbeta node on AWS as 1024 GB, and set 2 replicas for table A (the compressed size is 800 GB) and 1 replica for table B (the compressed size is 100 GB), then the required number of TiFlashbeta nodes is as follows: + | Transaction model | Threads | tpmC | QPS | Latency (ms) | + |-------------------|---------|---------|---------|--------------| + | TPCC | 2,400 | 133,164 | 120,380 | 305 | -Minimum number of TiFlashbeta nodes: `min((800 GB * 2 + 100 GB * 1) / 1024 GB, max(2, 1)) ≈ 2` + Sysbench OLTP performance: -### TiFlashbeta storage size + | Transaction model | Threads | TPS | QPS | Latency (ms) | + |-------------------|---------|---------|---------|---------------| + | Insert | 4,000 | 86,242 | 86,242 | 25 | + | Point Select | 2,400 | 448,056 | 448,056 | 4 | + | Read Write | 2,400 | 146,526 | 7,326 | 172 | + | Update Index | 6,000 | 58,856 | 58,856 | 51 | + | Update Non-index | 6,000 | 128,601 | 128,601 | 24 | -You can configure the TiFlashbeta storage size only when you create or restore a cluster. \ No newline at end of file +
diff --git a/tidb-cloud/tidb-cloud-auditing.md b/tidb-cloud/tidb-cloud-auditing.md index 1605cb2fd7938..b2514ed730d7a 100644 --- a/tidb-cloud/tidb-cloud-auditing.md +++ b/tidb-cloud/tidb-cloud-auditing.md @@ -1,15 +1,15 @@ --- -title: Audit Logging +title: Database Audit Logging summary: Learn about how to audit a cluster in TiDB Cloud. --- -# Audit Logging +# Database Audit Logging TiDB Cloud provides you with a database audit logging feature to record a history of user access details (such as any SQL statements executed) in logs. -> **Warning:** +> **Note:** > -> Currently, the **audit logging** feature is experimental. It is not recommended that you use it for production environments. +> Currently, the **audit logging** feature is experimental. The interface and output are subject to change. To assess the effectiveness of user access policies and other information security measures of your organization, it is a security best practice to conduct a periodic analysis of the database audit logs. @@ -21,16 +21,13 @@ The audit logging feature is disabled by default. To audit a cluster, you need t ## Prerequisites -- You are using a TiDB Cloud Dedicated tier or POC tier. Audit logging is not available for TiDB Cloud Developer Tier clusters. +- You are using a TiDB Cloud Dedicated tier. Audit logging is not available for TiDB Cloud Developer Tier clusters. - You are the audit administrator of your organization in TiDB Cloud. Otherwise, you cannot see the audit-related options in the TiDB Cloud console. For more information, see [Configure member roles](/tidb-cloud/manage-user-access.md#configure-member-roles). ## Enable audit logging for AWS or GCP To allow TiDB Cloud to write audit logs to your cloud bucket, you need to enable audit logging first. - -
- ### Enable audit logging for AWS To enable audit logging for AWS, take the following steps: @@ -106,10 +103,6 @@ In the TiDB Cloud console, go back to the **Audit Logging** dialog box where you > - After enabling audit logging, if you make any new changes to the bucket URL, location, or ARN, you must click **Restart** to load the changes and rerun the **Test Connectivity** check to make the changes effective. > - To remove Amazon S3 access from TiDB Cloud, simply delete the trust policy that you added. -
- -
- ### Enable audit logging for GCP To enable audit logging for GCP, take the following steps: @@ -172,9 +165,6 @@ In the TiDB Cloud console, go back to the **Audit Logging** dialog box where you > - After enabling audit logging, if you make any new changes to bucket URL or location, you must click **Restart** to load the changes and rerun the **Test Connectivity** check to make the changes effective. > - To remove GCS access from TiDB Cloud, simply delete the principal that you added. -
-
- ## Specify auditing filter rules After enabling audit logging, you must specify auditing filter rules to control which user access events to capture and write to audit logs versus which events to ignore. If no filter rules are specified, TiDB Cloud does not log anything. @@ -193,7 +183,7 @@ To specify auditing filter rules for a cluster, take the following steps: TiDB Cloud audit logs are readable text files with the cluster ID, Pod ID, and log creation date incorporated into the fully qualified filenames. -For example, `13796619446086334065/0/tidb-audit-2022-04-21T18-16-29.529.log`. In this example, `13796619446086334065` indicates the cluster ID and `0` indicates the Pod ID. +For example, `13796619446086334065/tidb-0/tidb-audit-2022-04-21T18-16-29.529.log`. In this example, `13796619446086334065` indicates the cluster ID and `tidb-0` indicates the Pod ID. ## Disable audit logging @@ -249,4 +239,4 @@ Depending on the EVENT_CLASS field value set by TiDB, database event records in | 17 | CONNECTION_ID | INTEGER | | Connection ID | | 18 | COMMAND | VARCHAR | 14 | The command type of the MySQL protocol | | 19 | SQL_STATEMENT | VARCHAR | 17 | The SQL statement type | - | 20 | PID | INTEGER | | The PID of the TiDB process | \ No newline at end of file + | 20 | PID | INTEGER | | The PID of the TiDB process | diff --git a/tidb-cloud/tidb-cloud-billing-tcu.md b/tidb-cloud/tidb-cloud-billing-tcu.md index ad1d1904263d6..e449f07707572 100644 --- a/tidb-cloud/tidb-cloud-billing-tcu.md +++ b/tidb-cloud/tidb-cloud-billing-tcu.md @@ -11,7 +11,7 @@ TiDB Cloud measures the capacity of changefeeds in TiCDC Capacity Units (TCUs). For each TiDB cluster, the number of TiCDC Capacity Units is set up by TiDB Cloud according to the total vCPU count of all TiKV nodes in your cluster as follows: -| Total vCPU of all TiKV nodes | Number of TCUs | +| Total vCPUs of all TiKV nodes | Number of TCUs | |------------------------------|----------------| | < 48 | 16 | | >= 48, and < 120 | 24 | diff --git a/tidb-cloud/tidb-cloud-billing.md b/tidb-cloud/tidb-cloud-billing.md index db255b48fa14b..d3c8108e5884a 100644 --- a/tidb-cloud/tidb-cloud-billing.md +++ b/tidb-cloud/tidb-cloud-billing.md @@ -22,15 +22,15 @@ These charges appear as separate items on your monthly TiDB Cloud bills. TiDB Cloud lets you pay for database cluster compute resources by hour, which is ideal for dynamic workloads. -In TiDB Cloud, you can control your cluster size easily by specifying the node quantity and vCPUs size of TiDB, TiKV, and TiFlashbeta. +In TiDB Cloud, you can control your cluster size easily by specifying the node quantity and node size of TiDB, TiKV, and TiFlash. The specified node quantity and associated vCPUs determine your hourly compute cost. -Note that the compute cost of TiDB, TiKV, and TiFlashbeta nodes might vary depending on different cloud providers and different regions. For details, see [TiDB Cloud pricing](https://en.pingcap.com/tidb-cloud-pricing/). +Note that the compute cost of TiDB, TiKV, and TiFlash nodes might vary depending on different cloud providers and different regions. For details, see [TiDB Cloud pricing](https://en.pingcap.com/tidb-cloud-pricing/). ## Storage cost -Both TiKV and TiFlashbeta nodes save your data to persistent block storage. The storage costs are generated according to the total volume of storage that all TiKV and TiFlashbeta nodes in your cluster consume. +Both TiKV and TiFlash nodes save your data to persistent block storage. The storage costs are generated according to the total volume of storage that all TiKV and TiFlash nodes in your cluster consume. TiDB Cloud passes the costs onto customers as they are incurred. For details, see [TiDB Cloud pricing](https://en.pingcap.com/tidb-cloud-pricing/). @@ -124,21 +124,22 @@ If you are the owner or billing administrator of your organization, you can mana > > If you sign up for TiDB Cloud through [AWS Marketplace](https://aws.amazon.com/marketplace), you can pay through your AWS account directly but cannot add payment methods or download invoices in the TiDB Cloud portal. +### Add a credit card + The fee is deducted from a bound credit card according to your cluster usage. To add a valid credit card, you can use either of the following methods: -- When you are creating a cluster: +- When you are creating a cluster: - 1. Before you click **Submit** on the **Create a Cluster** page, click **Add Credit Card** at the bottom of the **Billing Calculator** pane. - 2. In the **Add a Card** dialog box, enter the cardholder's name, email, phone, country/region, card number, valid year and month, and CVC (Card Verification Code). - 3. Click **Submit**. + 1. Before you click **Create Cluster** on the **Create a Cluster** page, click **Add Credit Card** at the bottom of the **Billing Calculator** pane. + 2. In the **Add a Card** dialog box, fill in the card information and billing address. + 3. Click **Save Card**. -- Anytime in the billing console: +- Anytime in the billing console: 1. Click the account name in the upper-right corner of the TiDB Cloud console. 2. Click **Billing**. - 3. Click the **Payment Method** tab, and then click **Add Credit Card**. - 4. In the **Add a Card** dialog box, enter the cardholder's name, email, phone, country/region, card number, valid year and month, and CVC (Card Verification Code). - 5. Click **Submit**. + 3. Under the **Payment Method** tab, click **Add a New Card**. + 4. Fill in the billing address and card information, and then click **Save**. > **Note:** > @@ -152,3 +153,14 @@ To set the default credit card, perform the following steps: 2. Click **Billing**. 3. Click the **Payment Method** tab. 4. Select a credit card in the credit card list, and click **Set as default**. + +### Edit billing profile information + +The billing profile information includes the business legal address and tax registration information. By providing your tax registration number, certain taxes might be exempted from your invoice. + +To edit the billing profile information, perform the following steps: + +1. Click the account name in the upper-right corner of the TiDB Cloud console. +2. Click **Billing**. +3. Click the **Payment Method** tab. +4. Edit the billing profile information, and then click **Save**. \ No newline at end of file diff --git a/tidb-cloud/tidb-cloud-console-auditing.md b/tidb-cloud/tidb-cloud-console-auditing.md new file mode 100644 index 0000000000000..28a0802a93d52 --- /dev/null +++ b/tidb-cloud/tidb-cloud-console-auditing.md @@ -0,0 +1,122 @@ +--- +title: Console Audit Logging +summary: Learn about the log auditing feature for the TiDB Cloud Console. +--- + +# Console Audit Logging + +TiDB Cloud provides the audit logging feature for TiDB Cloud console operations, which records the history of user access details (such as user login to the Console and cluster creation operations). + +> **Note:** +> +> Currently, the **audit logging** feature is experimental. The output is subject to change. + +## Limitations + +Currently, the console audit logging feature has the following limitations: + +- Console audit logging is enabled by default and cannot be disabled by users. +- You cannot specify the audit filtering rules for the feature. +- You can access the audit logs only with the help of PingCAP support. + +## Audit event types + +All user operations on the TiDB Cloud Console are recorded in the audit logs as events. Audit logs cover the following event types: + +| Audit event type | Description | +|---|---| +| AuditEventSignIn | Sign in | +| AuditEventSignOut | Sign out | +| AuditEventUpdateUserProfile | Update user's first name and last name | +| AuditEventUpdateMFA | Enable or disable MFA | +| AuditEventCreateProject | Create a new project | +| AuditEventUpdateProject | Update the project name | +| AuditEventDeleteProject | Delete a project | +| AuditEventInviteUserIntoProject | Invite a user into a project | +| AuditEventDeleteProjectUser | Delete a project user | +| AuditEventUpdateOrg | Update organization name and time zone | +| AuditEventCreateIntegration | Create an integration | +| AuditEventDeleteIntegration | Delete an integration | +| AuditEventListOrgUsers | List users in organization | +| AuditEventListProjectUsers | List users in a project | +| AuditEventAddNewPaymentMethod | Add a new credit card | +| AuditEventUpdatePaymentMethod | Update credit card information | +| AuditEventDeletePaymentMethod | Delete a credit card | +| AuditEventCreateAWSVpcPeering | Create an AWS VPC Peering | +| AuditEventCreateGCPVpcPeering | Create a GCP VPC Peering | +| AuditEventListAWSVpcPeering | List all AWS VPC Peerings in a project | +| AuditEventListGCPVpcPeering | List all GCP VPC Peerings in a project | +| AuditEventDeleteAWSVpcPeering | Delete an AWS VPC Peering | +| AuditEventDeleteGCPVpcPeering | Delete a GCP VPC Peering | +| AuditEventGetProjectTrafficFilter | Get traffic filter list of a project | +| AuditEventUpdateProjectTrafficFilter | Update traffic filter list of a project | +| AuditEventGetTrafficFilter | Get traffic filter list of a cluster | +| AuditEventUpdateTrafficFilter | Update traffic filter list of a cluster | +| AuditEventCreateProjectCIDR | Create a new project CIDR | +| AuditEventGetProjectCIDR | List the CIDR of a region | +| AuditEventGetProjectRegionCIDR | List all CIDRs in a project | +| AuditEventDeleteBackupInRecycleBin | Delete backups of deleted clusters in recycle bin | +| AuditEventChangeClusterRootPassword | Reset the root password of a cluster | +| AuditEventCreateImportTask | Create an import task | +| AuditEventCancleImportTask | Cancel an import task | +| AuditEventExitImportTask | Exit an import task | +| AuditEventCreateCluster | Create a cluster | +| AuditEventDeleteCluster | Delete a cluster | +| AuditEventScaleCluster | Scale a cluster | +| AuditEventCreateBackup | Make a backup | +| AuditEventDeleteBackup | Delete a backup | +| AuditEventRestoreBackup | Restore from a backup | +| AuditEventUpdateAuditLogStatus | Enable or disable database audit logging | +| AuditEventCreateAuditLogAccessRecord | Add database audit log filter conditions | +| AuditEventDeleteAuditLogAccessRecord | Delete database audit log filter conditions | +| AuditEventUpdateUserRole | Modify user roles | + +## Audit log storage policy + +- The audit log information is stored in AWS ES. +- The storage time is 90 days, after which the audit logs will be automatically cleaned up. + +## View audit logs + +The console audit logs are temporarily accessible only to internal personnel of TiDB Cloud. If you need to view the logs, contact [PingCAP support team](/tidb-cloud/tidb-cloud-support.md). + +## Audit log fields + +The fields in audit logs include basic fields and extended fields. + +The basic fields are as follows: + +| Field name | Data type | Description | +|---|---|---| +| timestamp | timestamp | Time of event | +| auditEventType | string | Event type | +| userID | uint64 | User ID | +| clientIP | string | Client IP | +| isSuccess | bool | Event result | + +Extended fields supplement the description information of events based on different event types to ensure the integrity and availability of audit information + +> **Note:** +> +> For scenarios where the basic fields cannot clearly describe the event, the following table shows the extended field information of these event types. Events not in the table have no extension fields. + +| Audit event type | Extended fields | Data type for extended fields | Description for extended fields | +|---|---|---|---| +| AuditEventUpdateMFA | enableMFA | bool |Enable or disable MFA | +| AuditEventCreateProject | projectName | string | Project name | +| AuditEventUpdateProject | oldProjectName
newProjectName | string
string | Old Project name
New project name | +| AuditEventDeleteProject | projectName | string | Project name | +| AuditEventInviteUserIntoProject | email
Role | string
string | Email
Role name | +| AuditEventDeleteProjectUser | email
Role | string
string | Email
Role name | +| AuditEventUpdateOrg | orgName
timeZone | string
uint| Organization name
Time zone | +| AuditEventCreateIntegration | integrationType | string | Integration type | +| AuditEventDeleteIntegration | integrationType | string | Integration type | +| AuditEventAddNewPaymentMethod | cardNumber | string | Payment card number (information desensitized) | +| AuditEventUpdatePaymentMethod | cardNumber | string | Payment card number (information desensitized)
(Currently not getting full field information) | +| AuditEventDeletePaymentMethod | | | (Currently not getting full field information) | +| AuditEventCreateCluster | clusterName | string | Cluster name | +| AuditEventDeleteCluster | clusterName | string | Cluster name | +| AuditEventCreateBackup | backupName | string | Backup name | +| AuditEventRestoreBackup | clusterName | string | Cluster name | +| AuditEventUpdateAuditLogStatus | enableAuditLog | bool | Enable or disable database audit logging | +| AuditEventUpdateUserRole | oldRole
newRole | string
string | Old role name
New role name | diff --git a/tidb-cloud/tidb-cloud-faq.md b/tidb-cloud/tidb-cloud-faq.md index 04f6a24c439ce..bd6a556a6460a 100644 --- a/tidb-cloud/tidb-cloud-faq.md +++ b/tidb-cloud/tidb-cloud-faq.md @@ -91,4 +91,12 @@ TiDB is highly compatible with MySQL. You can migrate data from any MySQL-compat ## How does TiDB protect data privacy and ensure security? -Transport Layer Security (TLS) and Transparent Data Encryption (TDE) are included for encryption at rest. There are two different network planes: the application to the TiDB server and the plane for data communication. We include extended syntax to compare Subject Alternative Name for verification of certificates and TLS context for internal communication. \ No newline at end of file +Transport Layer Security (TLS) and Transparent Data Encryption (TDE) are included for encryption at rest. There are two different network planes: the application to the TiDB server and the plane for data communication. We include extended syntax to compare Subject Alternative Name for verification of certificates and TLS context for internal communication. + +## Can I import my data directly to TiFlash? + +No. When you import data to TiDB Cloud, the data is imported to TiKV. After the import is complete, you can use SQL statements to specify which tables to be replicated to TiFlash. Then, TiDB will create the replicas of the specified tables in TiFlash accordingly. For more information, see [Create TiFlash Replicas](/tiflash/create-tiflash-replicas.md). + +## Can I export TiFlash data in the CSV format? + +No. TiFlash data cannot be exported. diff --git a/tidb-cloud/tidb-cloud-glossary.md b/tidb-cloud/tidb-cloud-glossary.md index 993fd04edc898..f931882e13a3c 100644 --- a/tidb-cloud/tidb-cloud-glossary.md +++ b/tidb-cloud/tidb-cloud-glossary.md @@ -7,11 +7,25 @@ aliases: ['/tidbcloud/glossary'] # TiDB Cloud Glossary +## A + +### ACID + +ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Each of these properties is described below. + +- **Atomicity** means that either all the changes of an operation are performed, or none of them are. TiDB ensures the atomicity of the [TiDB Region](#region) that stores the Primary Key to achieve the atomicity of transactions. + +- **Consistency** means that transactions always bring the database from one consistent state to another. In TiDB, data consistency is ensured before writing data to the memory. + +- **Isolation** means that a transaction in process is invisible to other transactions until it completes. This allows concurrent transactions to read and write data without sacrificing consistency. TiDB currently supports the isolation level of `REPEATABLE READ`. + +- **Durability** means that once a transaction is committed, it remains committed even in the event of a system failure. TiKV uses persistent storage to ensure durability. + ## C ### cluster tier -Determines the functionality and capacity of your cluster. Different cluster tiers provide different numbers of TiDB, TiKV, and TiFlashbeta nodes in your cluster. +Determines the functionality and capacity of your cluster. Different cluster tiers provide different numbers of TiDB, TiKV, and TiFlash nodes in your cluster. ## M @@ -23,7 +37,7 @@ A user that has been invited to an organization, with access to the organization ### node -Refers to either a data instance (TiKV) or a compute instance (TiDB) or an analytical instance (TiFlashbeta). +Refers to either a data instance (TiKV) or a compute instance (TiDB) or an analytical instance (TiFlash). ## O @@ -73,13 +87,13 @@ A separate database that can be located in the same or different region and cont ### TiDB cluster -The collection of [TiDB](https://docs.pingcap.com/tidb/stable/tidb-computing), [TiKV](https://docs.pingcap.com/tidb/stable/tidb-storage), [the Placement Driver](https://docs.pingcap.com/tidb/stable/tidb-scheduling) (PD), and [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview)beta nodes that form a functional working database. +The collection of [TiDB](https://docs.pingcap.com/tidb/stable/tidb-computing), [TiKV](https://docs.pingcap.com/tidb/stable/tidb-storage), [the Placement Driver](https://docs.pingcap.com/tidb/stable/tidb-scheduling) (PD), and [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview) nodes that form a functional working database. ### TiDB node The computing node that aggregates data from queries returned from transactional or analytical stores. Increasing the number of TiDB nodes will increase the number of concurrent queries that the cluster can handle. -### TiFlashbeta node +### TiFlash node The analytical storage node that replicates data from TiKV in real time and supports real-time analytical workloads. diff --git a/tidb-cloud/tidb-cloud-htap-quickstart.md b/tidb-cloud/tidb-cloud-htap-quickstart.md new file mode 100644 index 0000000000000..481bf1cf2cf6b --- /dev/null +++ b/tidb-cloud/tidb-cloud-htap-quickstart.md @@ -0,0 +1,121 @@ +--- +title: TiDB Cloud HTAP Quick Start +summary: Learn how to get started with HTAP in TiDB Cloud. +aliases: ['/tidbcloud/use-htap-cluster'] +--- + +# TiDB Cloud HTAP Quick Start + +[HTAP](https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing) means Hybrid Transactional and Analytical Processing. The HTAP cluster in TiDB Cloud is composed of [TiKV](https://tikv.org), a row-based storage engine designed for transactional processing, and [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview), a columnar storage designed for analytical processing. Your application data is first stored in TiKV and then replicated to TiFlash via the Raft consensus algorithm. So it is a real-time replication from the row storage to the columnar storage. + +This tutorial guides you through an easy way to experience the Hybrid Transactional and Analytical Processing (HTAP) feature of TiDB Cloud. The content includes how to replicate tables to TiFlash, how to run queries with TiFlash, and how to experience the performance boost. + +## Before you begin + +Before experiencing the HTAP feature, follow [TiDB Cloud Quick Start](/tidb-cloud/tidb-cloud-quickstart.md) to create a cluster with TiFlash nodes, connect to the TiDB cluster, and import the Capital Bikeshare sample data to the cluster. + +## Steps + +### Step 1. Replicate the sample data to the columnar storage engine + +After a cluster with TiFlash nodes is created, TiKV does not replicate data to TiFlash by default. You need to execute DDL statements in a MySQL client of TiDB to specify the tables to be replicated. After that, TiDB will create the specified table replicas in TiFlash accordingly. + +For example, to replicate the `trips` table (in the Capital Bikeshare sample data) to TiFlash, execute the following statements: + +```sql +USE bikeshare; +ALTER TABLE trips SET TIFLASH REPLICA 1; +``` + +To check the replication progress, execute the following statement: + +```sql +SELECT * FROM information_schema.tiflash_replica WHERE TABLE_SCHEMA = 'bikeshare' and TABLE_NAME = 'trips'; +``` + +In the result of the preceding statement: + +- `AVAILABLE` indicates whether the TiFlash replica of a specific table is available or not. `1` means available and `0` means unavailable. Once a replica becomes available, this status does not change anymore. +- `PROGRESS` means the progress of the replication. The value is between `0.0` and `1.0`. `1.0` means at least one replica is replicated. + +### Step 2. Query data using HTAP + +When the process of replication is completed, you can start to run some queries. + +For example, you can check the number of trips by different start and end stations: + +```sql +SELECT start_station_name, end_station_name, COUNT(ride_id) as count from `trips` +GROUP BY start_station_name, end_station_name +ORDER BY count ASC; +``` + +### Step 3. Compare the query performance between row-based storage and columnar storage + +In this step, you can compare the execution statistics between TiKV (row-based storage) and TiFlash (columnar storage). + +- To get the execution statistics of this query using TiKV, execute the following statement: + + ```sql + EXPLAIN ANALYZE SELECT /*+ READ_FROM_STORAGE(TIKV[trips]) */ start_station_name, end_station_name, COUNT(ride_id) as count from `trips` + GROUP BY start_station_name, end_station_name + ORDER BY count ASC; + ``` + + For tables with TiFlash replicas, the TiDB optimizer automatically determines whether to use either TiKV or TiFlash replicas based on the cost estimation. In the preceding `EXPLAIN ANALYZE` statement, `HINT /*+ READ_FROM_STORAGE(TIKV[trips]) */` is used to force the optimizer to choose TiKV so you can check the execution statistics of TiKV. + + > **Note:** + > + > MySQL command-line clients earlier than 5.7.7 strip optimizer hints by default. If you are using the `Hint` syntax in these earlier versions, add the `--comments` option when starting the client. For example: `mysql -h 127.0.0.1 -P 4000 -uroot --comments`. + + In the output, you can get the execution time from the `execution info` column. + + ```sql + id | estRows | actRows | task | access object | execution info | operator info | memory | disk + ---------------------------+-----------+---------+-----------+---------------+-------------------------------------------+-----------------------------------------------+---------+--------- + Sort_5 | 633.00 | 73633 | root | | time:1.62s, loops:73 | Column#15 | 6.88 MB | 0 Bytes + └─Projection_7 | 633.00 | 73633 | root | | time:1.57s, loops:76, Concurrency:OFF... | bikeshare.trips.start_station_name... | 6.20 MB | N/A | 6.20 MB | N/A + └─HashAgg_15 | 633.00 | 73633 | root | | time:1.57s, loops:76, partial_worker:... | group by:bikeshare.trips.end_station_name... | 58.0 MB | N/A + └─TableReader_16 | 633.00 | 111679 | root | | time:1.34s, loops:3, cop_task: {num: ... | data:HashAgg_8 | 7.55 MB | N/A + └─HashAgg_8 | 633.00 | 111679 | cop[tikv] | | tikv_task:{proc max:830ms, min:470ms,... | group by:bikeshare.trips.end_station_name... | N/A | N/A + └─TableFullScan_14 | 816090.00 | 816090 | cop[tikv] | table:trips | tikv_task:{proc max:490ms, min:310ms,... | keep order:false | N/A | N/A + (6 rows) + ``` + +- To get the execution statistics of this query using TiFlash, execute the following statement: + + ```sql + EXPLAIN ANALYZE SELECT start_station_name, end_station_name, COUNT(ride_id) as count from `trips` + GROUP BY start_station_name, end_station_name + ORDER BY count ASC; + ``` + + In the output, you can get the execution time from the `execution info` column. + + ```sql + id | estRows | actRows | task | access object | execution info | operator info | memory | disk + -----------------------------------+-----------+---------+--------------+---------------+-------------------------------------------+------------------------------------+---------+--------- + Sort_5 | 633.00 | 73633 | root | | time:420.2ms, loops:73 | Column#15 | 5.61 MB | 0 Bytes + └─Projection_7 | 633.00 | 73633 | root | | time:368.7ms, loops:73, Concurrency:OFF | bikeshare.trips.start_station_... | 4.94 MB | N/A + └─TableReader_34 | 633.00 | 73633 | root | | time:368.6ms, loops:73, cop_task: {num... | data:ExchangeSender_33 | N/A | N/A + └─ExchangeSender_33 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:360.7ms, loops:1,... | ExchangeType: PassThrough | N/A | N/A + └─Projection_29 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:330.7ms, loops:1,... | Column#15, bikeshare.trips.star... | N/A | N/A + └─HashAgg_30 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:330.7ms, loops:1,... | group by:bikeshare.trips.end_st... | N/A | N/A + └─ExchangeReceiver_32 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:280.7ms, loops:12,... | | N/A | N/A + └─ExchangeSender_31 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:272.3ms, loops:256,... | ExchangeType: HashPartition, Ha... | N/A | N/A + └─HashAgg_12 | 633.00 | 73633 | mpp[tiflash] | | tiflash_task:{time:252.3ms, loops:256,... | group by:bikeshare.trips.end_st... | N/A | N/A + └─TableFullScan_28 | 816090.00 | 816090 | mpp[tiflash] | table:trips | tiflash_task:{time:92.3ms, loops:16,... | keep order:false | N/A | N/A + (10 rows) + ``` + +> **Note:** +> +> Because the size of sample data is small and the query in this document is very simple, if you have already forced the optimizer to choose TiKV for this query and run the same query again, TiKV will reuse its cache, so the query might be much faster. If the data is updated frequently, the cache will be missed. + +## Learn more + +- [TiFlash Overview](/tiflash/tiflash-overview.md) +- [Create TiFlash Replicas](/tiflash/create-tiflash-replicas.md) +- [Read Data from TiFlash](/tiflash/use-tidb-to-read-tiflash.md) +- [Use MPP Mode](/tiflash/use-tiflash-mpp-mode.md) +- [Supported Push-down Calculations](/tiflash/tiflash-supported-pushdown-calculations.md) diff --git a/tidb-cloud/tidb-cloud-poc.md b/tidb-cloud/tidb-cloud-poc.md index a1af3fc64642e..c6d391acf76ec 100644 --- a/tidb-cloud/tidb-cloud-poc.md +++ b/tidb-cloud/tidb-cloud-poc.md @@ -54,7 +54,7 @@ TiDB Cloud is suitable for various use cases that require high availability and - Real-time HTAP - Compatible with the MySQL 5.7 protocol and MySQL ecosystem -You might also be interested in using [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview)beta, a columnar storage engine that helps speed up analytical processing. During the PoC, you can use the TiFlashbeta feature at any time. +You might also be interested in using [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview), a columnar storage engine that helps speed up analytical processing. During the PoC, you can use the TiFlash feature at any time. ## Step 3. Sign up and create a dedicated cluster for the PoC @@ -69,10 +69,10 @@ To create a dedicated cluster for the PoC, take the following steps: 2. Refer to [Quick Start](/tidb-cloud/tidb-cloud-quickstart.md) to create a [Dedicated Tier](/tidb-cloud/select-cluster-tier.md#dedicated-tier) cluster for the PoC. -Capacity planning is recommended for cluster sizing before you create a cluster. You can start with estimated numbers of TiDB, TiKV, or TiFlashbeta nodes, and scale out the cluster later to meet performance requirements. You can find more details in the following documents or consult our support team. +Capacity planning is recommended for cluster sizing before you create a cluster. You can start with estimated numbers of TiDB, TiKV, or TiFlash nodes, and scale out the cluster later to meet performance requirements. You can find more details in the following documents or consult our support team. - For more information about estimation practice, see [Size Your TiDB](/tidb-cloud/size-your-cluster.md). -- For configurations of the dedicated cluster, see [Create a TiDB Cluster](/tidb-cloud/create-tidb-cluster.md). Configure the cluster size for TiDB, TiKV, and TiFlashbeta (optional) respectively. +- For configurations of the dedicated cluster, see [Create a TiDB Cluster](/tidb-cloud/create-tidb-cluster.md). Configure the cluster size for TiDB, TiKV, and TiFlash (optional) respectively. - For how to plan and optimize your PoC trial points consumption effectively, see [FAQ](#faq) in this document. - For more information about scaling, see [Scale Your TiDB Cluster](/tidb-cloud/scale-tidb-cluster.md). @@ -134,9 +134,9 @@ Before testing the workload, consider performing a manual backup, so that you ca After kicking off the workload, you can observe the system using the following methods: -- The commonly used metrics of the cluster can be found on the cluster overview page, including Total QPS, Latency, Connections, TiFlashbeta Request QPS, TiFlashbeta Request Duration, TiFlashbeta Storage Size, TiKV Storage Size, TiDB CPU, TiKV CPU, TiKV IO Read, and TiKV IO Write. See [Monitor a TiDB Cluster](/tidb-cloud/monitor-tidb-cluster.md). -- Go to **Diagnostic > Statements**, where you can observe SQL execution and easily locate performance problems without querying the system tables. See [Statement Analysis](/tidb-cloud/tune-performance.md). -- Go to **Diagnostic > Key Visualizer**, where you can view TiDB data access patterns and data hotspots. See [Key Visualizer](/tidb-cloud/tune-performance.md#key-visualizer). +- The commonly used metrics of the cluster can be found on the cluster overview page, including Total QPS, Latency, Connections, TiFlash Request QPS, TiFlash Request Duration, TiFlash Storage Size, TiKV Storage Size, TiDB CPU, TiKV CPU, TiKV IO Read, and TiKV IO Write. See [Monitor a TiDB Cluster](/tidb-cloud/monitor-tidb-cluster.md). +- Go to **Diagnosis > Statements**, where you can observe SQL execution and easily locate performance problems without querying the system tables. See [Statement Analysis](/tidb-cloud/tune-performance.md). +- Go to **Diagnosis > Key Visualizer**, where you can view TiDB data access patterns and data hotspots. See [Key Visualizer](/tidb-cloud/tune-performance.md#key-visualizer). - You can also integrate these metrics to your own Datadog and Prometheus. See [Third-party integrations](/tidb-cloud/monitor-tidb-cluster.md#third-party-integrations). Now it is time for evaluating the test results. @@ -163,7 +163,7 @@ The following are tips for performance tuning: - Check the SQL execution plan on the **Diagnostic > Statements** page. - Check hotspot issues on the **Dashboard > Key Visualizer** page. - Monitor if the TiDB cluster is running out of capacity on the **Overview > Capacity Metrics** page. - - Use the TiFlashbeta feature to optimize analytical processing. See [Use an HTAP Cluster](/tidb-cloud/use-htap-cluster.md). + - Use the TiFlash feature to optimize analytical processing. See [Use an HTAP Cluster](/tiflash/tiflash-overview.md). ## Step 7. Explore more features @@ -175,7 +175,7 @@ Now the workload testing is finished, you can explore more features, for example - Backup - To avoid vendor lock-in, you can use daily full backup to migrate data to a new cluster and use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export data. For more information, see [Export Data from TiDB](/tidb-cloud/export-data-from-tidb-cloud.md). + To avoid vendor lock-in, you can use daily full backup to migrate data to a new cluster and use [Dumpling](/dumpling-overview.md) to export data. For more information, see [Export Data from TiDB](/tidb-cloud/export-data-from-tidb-cloud.md). ## Step 8. Clean up the environment and finish the PoC @@ -212,7 +212,7 @@ You can scale out clusters on the console by yourself. If you need to scale in a Once your application for the PoC is approved, you will receive trial points in your account. Generally, the trial points are sufficient for a 14-day PoC. The trial points are charged by the type of nodes and the number of nodes, on an hourly basis. For more information, see [TiDB Cloud Billing](/tidb-cloud/tidb-cloud-billing.md#trial-points). -To check the points left for your PoC, go to the **Clusters** page, as shown in the following screenshot. +To check the points left for your PoC, go to the **Active Clusters** page, as shown in the following screenshot. ![TiDB Cloud PoC Points](/media/tidb-cloud/poc-points.png) diff --git a/tidb-cloud/tidb-cloud-quickstart.md b/tidb-cloud/tidb-cloud-quickstart.md index c8d990b98365f..1fbe6d2ac1168 100644 --- a/tidb-cloud/tidb-cloud-quickstart.md +++ b/tidb-cloud/tidb-cloud-quickstart.md @@ -13,11 +13,13 @@ This tutorial guides you through an easy way to get started with your TiDB Cloud ## Step 1. Create a TiDB cluster -You can either create a free [Developer Tier (Dev Tier)](/tidb-cloud/select-cluster-tier.md#developer-tier) cluster or a [Dedicated Tier](/tidb-cloud/select-cluster-tier.md#dedicated-tier). +You can either create a free [Developer Tier](/tidb-cloud/select-cluster-tier.md#developer-tier) cluster or a [Dedicated Tier](/tidb-cloud/select-cluster-tier.md#dedicated-tier).
+To create a free Developer Tier cluster, take the following steps: + 1. If you do not have a TiDB Cloud account, click [here](https://tidbcloud.com/free-trial) to sign up for an account. - For Google users, you can also sign up with Google. To do that, click **Sign up with Google** on the [sign up](https://tidbcloud.com/signup) page. Your email address and password will be managed by Google and cannot be changed using TiDB Cloud console. @@ -29,7 +31,7 @@ You can either create a free [Developer Tier (Dev Tier)](/tidb-cloud/select-clus 3. On the plan selection page, click **Get Started for Free** in the **Developer Tier** plan. -4. On the **Create a Cluster (Dev Tier)** page, update the default cluster name if necessary, and then select the region where you want to create your cluster. +4. On the **Create a Cluster (Developer Tier)** page, update the default cluster name if necessary, and then select the region where you want to create your cluster. 5. Click **Create**. @@ -43,6 +45,8 @@ You can either create a free [Developer Tier (Dev Tier)](/tidb-cloud/select-clus
+To create a Dedicated Tier cluster, take the following steps: + 1. If you do not have a TiDB Cloud account, click [here](https://tidbcloud.com/signup) to sign up for an account. - For Google users, you can also sign up with Google. To do that, click **Sign up with Google** on the [sign up](https://tidbcloud.com/signup) page. Your email address and password will be managed by Google and cannot be changed using TiDB Cloud console. @@ -67,7 +71,7 @@ You can either create a free [Developer Tier (Dev Tier)](/tidb-cloud/select-clus > > When setting the project CIDR, avoid any conflicts with the CIDR of the VPC where your application is located. The CIDR of a project cannot be modified once it is set. -6. Configure the [cluster size](/tidb-cloud/size-your-cluster.md) for TiDB, TiKV, and TiFlashbeta (optional) respectively, and then click **Next**. +6. Configure the [cluster size](/tidb-cloud/size-your-cluster.md) for TiDB, TiKV, and TiFlash (optional) respectively, and then click **Next**. 7. Confirm the cluster information in the middle area and also the billing information in the right pane. @@ -94,9 +98,10 @@ You can either create a free [Developer Tier (Dev Tier)](/tidb-cloud/select-clus 3. Under **Step 2: Connect with a SQL client** in the dialog box, click the tab of your preferred connection method, and then connect to your cluster with the connection string. - > **Tip:** + > **Note:** > - > TiDB Cloud is MySQL-compatible, so you can connect to your cluster using any MySQL client tools. We recommend using [mysql — The MySQL Command-Line Client](https://dev.mysql.com/doc/refman/8.0/en/mysql.html) or [mysql — The MySQL Command-Line Client from MariaDB](https://mariadb.com/kb/en/mysql-command-line-client/). + > - For [Developer Tier clusters](/tidb-cloud/select-cluster-tier.md#developer-tier), when you connect to your cluster, you must include the prefix for your cluster in the user name and wrap the name with quotation marks. For more information, see [User name prefix](/tidb-cloud/select-cluster-tier.md#user-name-prefix). + > - TiDB Cloud is MySQL-compatible, so you can connect to your cluster using any MySQL client tools. We recommend using [mysql — The MySQL Command-Line Client](https://dev.mysql.com/doc/refman/8.0/en/mysql.html) or [mysql — The MySQL Command-Line Client from MariaDB](https://mariadb.com/kb/en/mysql-command-line-client/). 4. After logging into your TiDB cluster, you can use the following SQL statement to validate the connection: @@ -121,7 +126,7 @@ We provide Capital Bikeshare sample data for you to easily import data and run s
- If your TiDB cluster is hosted by AWS (the Dev Tier is hosted by AWS by default), fill in the following parameters: + If your TiDB cluster is hosted by AWS (the Developer Tier is hosted by AWS by default), fill in the following parameters: - **Data Source Type**: `AWS S3`. - **Bucket URL**: enter the sample data URL `s3://tidbcloud-samples/data-ingestion/`. @@ -151,7 +156,13 @@ We provide Capital Bikeshare sample data for you to easily import data and run s 4. Click **Import**. - The data import process will take 5 to 10 minutes. When the data import progress bar shows **Success**, you successfully import the sample data and the database schema in your database. + A warning message about the database resource consumption is displayed. For a newly created cluster, you can ignore the warning message. + +5. Click **Confirm**. + + TiDB Cloud starts validating whether it can access the sample data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. + +The data import process will take 5 to 10 minutes. When the data import progress bar shows **Success**, you successfully import the sample data and the database schema in your database. ## Step 4. Query data diff --git a/tidb-cloud/tidb-cloud-sql-tuning-overview.md b/tidb-cloud/tidb-cloud-sql-tuning-overview.md new file mode 100644 index 0000000000000..e2a1f29063661 --- /dev/null +++ b/tidb-cloud/tidb-cloud-sql-tuning-overview.md @@ -0,0 +1,117 @@ +--- +title: SQL Tuning Overview +summary: Learn about how to tune SQL performance in TiDB Cloud. +--- + +# SQL Tuning Overview + +This document introduces how to tune SQL performance in TiDB Cloud. To get the best SQL performance, you can do the following: + +- Tune SQL performance. There are many ways to optimize SQL performance, such as analyzing query statements, optimizing execution plans, and optimizing full table scan. +- Optimize schema design. Depending on your business workload type, you may need to optimize the schemas to avoid transaction conflicts or hotspots. + +## Tune SQL performance + +To improve the performance of SQL statements, consider the following principles. + +- Minimize the scope of the scanned data. It is always a best practice to scan only the minimum scope of data and avoid scanning all data. +- Use appropriate indexes. For each column in the `WHERE` clause in a SQL statement, make sure that there is a corresponding index. Otherwise, the `WHERE` clause will scan the full table and result in poor performance. +- Use appropriate Join types. Depending on the size and correlation of each table in the query, it is very important to choose the right Join type. Generally, the cost-based optimizer in TiDB automatically chooses the optimal Join type. However, in some cases, you may need to specify the Join type manually. For details, see [Explain Statements That Use Joins](/explain-joins.md). +- Use appropriate storage engines. It is recommended to use the TiFlash storage engine for Hybrid Transactional and Analytical Processing (HTAP) workloads. See [HTAP Queries](https://docs.pingcap.com/tidb/stable/dev-guide-hybrid-oltp-and-olap-queries). + +TiDB Cloud provides several tools to help you analyze slow queries on a cluster. The following sections describe several approaches to optimize slow queries. + +### Use Statement on the Diagnosis tab + +The TiDB Cloud console provides a **[Statement](/tidb-cloud/tune-performance.md#statement-analysis)** sub-tab on the **Diagnosis** tab. It collects the execution statistics of SQL statements of all databases on the cluster. You can use it to identify and analyze SQL statements that consume a long time in total or in a single execution. + +Note that on this sub-tab, SQL queries with the same structure (even if the query parameters do not match) are grouped into the same SQL statement. For example, `SELECT * FROM employee WHERE id IN (1, 2, 3)` and `select * from EMPLOYEE where ID in (4, 5)` are both part of the same SQL statement `select * from employee where id in (...)`. + +You can view some key information in **Statement**. + +- SQL statement overview: including SQL digest, SQL template ID, the time range currently viewed, the number of execution plans, and the database where the execution takes place. +- Execution plan list: if a SQL statement has more than one execution plan, the list is displayed. You can select different execution plans and the details of the selected execution plan are displayed at the bottom of the list. If there is only one execution plan, the list will not be displayed. +- Execution plan details: shows the details of the selected execution plan. It collects the execution plans of such SQL type and the corresponding execution time from several perspectives to help you get more information. See [Execution plan in details](https://docs.pingcap.com/tidb/stable/dashboard-statement-details#statement-execution-details-of-tidb-dashboard) (area 3 in the image below). + +![Details](/media/dashboard/dashboard-statement-detail.png) + +In addition to the information in the **Statement** dashboard, there are also some SQL best practices for TiDB Cloud as described in the following sections. + +### Check the execution plan + +You can use [`EXPLAIN`](/explain-overview.md) to check the execution plan calculated by TiDB for a statement during compiling. In other words, TiDB estimates hundreds or thousands of possible execution plans and selects an optimal execution plan that consumes the least resource and executes the fastest. + +If the execution plan selected by TiDB is not optimal, you can use EXPLAIN or [`EXPLAIN ANALYZE`](/sql-statements/sql-statement-explain-analyze.md) to diagnose it. + +### Optimize the execution plan + +After parsing the original query text by `parser` and basic validity verification, TiDB first makes some logical equivalent changes to the query. For more information, see [SQL Logical Optimization](/sql-logical-optimization.md). + +Through these equivalence changes, the query can become easier to handle in the logical execution plan. After the equivalence changes, TiDB gets a query plan structure that is equivalent to the original query, and then gets a final execution plan based on the data distribution and the specific execution overhead of an operator. For more information, see [SQL Physical Optimization](/sql-physical-optimization.md). + +Also, TiDB can choose to enable execution plan cache to reduce the creation overhead of the execution plan when executing the `PREPARE` statement, as introduced in [Prepare Execution Plan Cache](/sql-prepared-plan-cache.md). + +### Optimize full table scan + +The most common reason for slow SQL queries is that the `SELECT` statements perform full table scan or use incorrect indexes. You can use EXPLAIN or EXPLAIN ANALYZE to view the execution plan of a query and locate the cause of the slow execution. There are [three methods](https://docs.pingcap.com/tidb/stable/dev-guide-optimize-sql) that you can use to optimize. + +- Use secondary index +- Use covering index +- Use primary index + +### DML best practices + +See [DML best practices](https://docs.pingcap.com/tidb/stable/dev-guide-optimize-sql-best-practices#dml-best-practices). + +### DDL best practices when selecting primary keys + +See [Guidelines to follow when selecting primary keys](https://docs.pingcap.com/tidb/stable/dev-guide-create-table#guidelines-to-follow-when-selecting-primary-key). + +### Index best practices + +[Best practices for indexing](https://docs.pingcap.com/tidb/stable/dev-guide-index-best-practice) include best practices for creating indexes and using indexes. + +The speed of creating indexes is conservative by default, and the index creation process can be accelerated by [modifying variables](https://docs.pingcap.com/tidb/stable/dev-guide-optimize-sql-best-practices#add-index-best-practices) in some scenarios. + + + +## Optimize schema design + +If you still cannot get better performance based on SQL performance tuning, you may need to check your schema design and data read model to avoid transaction conflicts and hotspots. + +### Transaction conflicts + +For more information on how to locate and resolve transaction conflicts, see [Troubleshoot Lock Conflicts](https://docs.pingcap.com/tidb/stable/troubleshoot-lock-conflicts#troubleshoot-lock-conflicts). + +### Hotspot issues + +You can analyze hotspot issues using [Key Visualizer](/tidb-cloud/tune-performance.md#key-visualizer). + +You can use Key Visualizer to analyze the usage patterns of TiDB clusters and troubleshoot traffic hotspots. This page provides a visual representation of the TiDB cluster's traffic over time. + +You can observe the following information in Key Visualizer. You may need to understand some [basic concepts](https://docs.pingcap.com/tidb/stable/dashboard-key-visualizer#basic-concepts) first. + +- A large heat map that shows the overall traffic over time +- The detailed information about a coordinate of the heat map +- The identification information such as tables and indexes that is displayed on the left side + +In Key Visualizer, there are [four common heat map results](https://docs.pingcap.com/tidb/stable/dashboard-key-visualizer#common-heatmap-types). + +- Evenly distributed workload: desired result +- Alternating brightness and darkness along the X-axis (time): need to check the resources at peak times +- Alternating brightness and darkness along the Y-axis: need to check the degree of hotspot aggregation generated +- Bright diagonal lines: need to check the business model + +In both cases of X-axis and Y-axis alternating bright and dark, you need to address read and write pressure. + +For more information about SQL performance optimization, see [SQL Optimization](https://docs.pingcap.com/tidb/stable/sql-faq#sql-optimization) in SQL FAQs. diff --git a/tidb-cloud/tidb-cloud-tune-performance-overview.md b/tidb-cloud/tidb-cloud-tune-performance-overview.md new file mode 100644 index 0000000000000..d44304f7f1804 --- /dev/null +++ b/tidb-cloud/tidb-cloud-tune-performance-overview.md @@ -0,0 +1,127 @@ +--- +title: Overview for Analyzing and Tuning Performance +summary: Learn about how to analyze and tune SQL performance in TiDB Cloud. +--- + +# Overview for Analyzing and Tuning Performance + +This document describes steps to help you analyze and tune SQL performance in TiDB Cloud. + +## User response time + +User response time indicates how long an application takes to return the results of a request to users. As you can see from the following sequential timing diagram, the time of a typical user request contains the following: + +- The network latency between the user and the application +- The processing time of the application +- The network latency during the interaction between the application and the database +- The service time of the database + +The user response time is affected by various subsystems on the request chain, such as network latency and bandwidth, number and request types of concurrent users, and resource usage of server CPU and I/O. To optimize the entire system effectively, you need to first identify the bottlenecks in user response time. + +To get a total user response time within a specified time range (`ΔT`), you can use the following formula: + +Total user response time in `ΔT` = Average TPS (Transactions Per Second) x Average user response time x `ΔT`. + +![user_response_time](/media/performance/user_response_time_en.png) + +## Relationship between user response time and system throughput + +User response time consists of service time, queuing time, and concurrent waiting time to complete a user request. + +``` +User Response time = Service time + Queuing delay + Coherency delay +``` + +- Service time: the time a system consumes on certain resources when processing a request, for example, the CPU time that a database consumes to complete a SQL request. +- Queuing delay: the time a system waits in a queue for service of certain resources when processing a request. +- Coherency delay: the time a system communicates and collaborates with other concurrent tasks, so that it can access shared resources when processing a request. + +System throughput indicates the number of requests that can be completed by a system per second. User response time and throughput are usually inverse of each other. When the throughput increases, the system resource utilization and the queuing latency for a requested service increase accordingly. Once resource utilization exceeds a certain inflection point, the queuing latency will increase dramatically. + +For example, for a database system running OLTP loads, after its CPU utilization exceeds 65%, the CPU queueing scheduling latency increases significantly. This is because concurrent requests of a system are not completely independent, which means that these requests can collaborate and compete for shared resources. For example, requests from different users might perform mutually exclusive locking operations on the same data. When the resource utilization increases, the queuing and scheduling latency increases too, which causes that the shared resources cannot be released in time and in turn prolongs the waiting time for shared resources by other tasks. + +## Troubleshoot bottlenecks in user response time + +There are several pages on the TiDB Cloud console that help you troubleshoot user response time. + +- **Overview**: on this tab, you can view TiDB metrics such as total QPS, latency, connections, request QPS, request duration, storage size, CPU, IO Read, and IO Write. +- **Diagnosis**: + + - **Statement** enables you to directly observe SQL execution on the page, and easily locate performance problems without querying the system tables. You can click a SQL statement to further view the execution plan of the query for troubleshooting and analysis. For more information about SQL performance tuning, see [SQL Tuning Overview](/tidb-cloud/tidb-cloud-sql-tuning-overview.md). + - **Key Visualizer** helps you observe TiDB's data access patterns and data hotspots. + +If you require additional metrics, you can contact the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md). + +If you experience latency and performance issues, refer to the steps in the following sections for analysis and troubleshooting. + +### Bottlenecks outside the TiDB cluster + +Observe Latency(P80) on the **Overview** tab. If this value is much lower than the P80 value for user response time, you can determine that the main bottleneck might be outside the TiDB cluster. In this case, you can use the following steps to troubleshoot the bottleneck. + +1. Check the TiDB version on the left side of the [Overview tab](/tidb-cloud/monitor-tidb-cluster.md). If it is v6.0.0 or earlier versions, it is recommended to contact the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) to confirm if the Prepared plan cache, Raft-engine and TiKV AsyncIO features can be enabled. Enabling these features, along with application-side tuning, can significantly improve throughput performance and reduce latency and resource utilization. +2. If necessary, you can increase the TiDB token limit to increase the throughput. +3. If the prepared plan cache feature is enabled, and you use JDBC on the user side, it is recommended to use the following configuration: + + ``` + useServerPrepStmts=true&cachePrepStmts=true& prepStmtCacheSize=1000&prepStmtCacheSqlLimit=20480&useConfigs=maxPerformance + ``` + + If you do not use JDBC and want to take full advantage of the prepared plan cache feature of the current TiDB cluster, you need to cache the prepared statement objects on the client side. You do not need to reset the calls to StmtPrepare and StmtClose. Reduce the number of commands to be called for each query from 3 to 1. It requires some development effort, depending on your performance requirements and the amount of client-side changes. You can consult the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) for help. + +### Bottlenecks in the TiDB cluster + +If you determine that the performance bottleneck is within a TiDB cluster, it is recommended that you do the following: + +- Optimize slow SQL queries. +- Resolve hotspot issues. +- Scale out the cluster to expand the capacity. + +#### Optimize slow SQL queries + +For more information about SQL performance tuning, see [SQL Tuning Overview](/tidb-cloud/tidb-cloud-sql-tuning-overview.md). + +#### Resolve hotstpot issues + +You can view hotspot issues on the [Key Visualizer tab](/tidb-cloud/tune-performance.md#key-visualizer). The following screenshot shows a sample heat map. The horizontal coordinate of the map is the time, and the vertical coordinate is the table and index. Brighter color indicates higher traffic. You can toggle the display of read or write traffic in the toolbar. + +![Hotspot issues](/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot.png) + +The following screenshot shows an example of a write hotspot. A bright diagonal line (diagonal up or diagonal down) appears in the write flow graph, and the write traffic appears only at the end of the line. It becomes a stepped pattern as the number of table Regions grows. It indicates that there is a write hotspot in the table. When a write hotspot occurs, you need to check whether you are using a self-incrementing primary key, or no primary key, or using a time-dependent insert statement or index. + +![Write hotspot](/media/tidb-cloud/tidb-cloud-troubleshoot-write-hotspot.png) + +A read hotspot is generally represented in the heat map as a bright horizontal line, usually a small table with a large number of queries, as shown in the following screenshot. + +![Read hotspot](/media/tidb-cloud/tidb-cloud-troubleshoot-read-hotspot-new.png) + +Hover over the highlighted block to see which table or index has high traffic, as shown in the following screenshot. + +![Hotspot index](/media/tidb-cloud/tidb-cloud-troubleshoot-hotspot-index.png) + +#### Scale out + +On the cluster [Overview](/tidb-cloud/monitor-tidb-cluster.md) page, check the storage space, CPU utilization, and TiKV IO rate metrics. If any of them are reaching the upper limit for a long time, it is possible that the current cluster size cannot meet the business requirements. It is recommended to contact the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) to confirm if you need to scale out the cluster. + +#### Other issues + +If the previous methods cannot resolve the performance issue, you can contact the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) for help. It is recommended to provide the following information to speed up the troubleshooting process. + +- The cluster ID +- The issue interval and a comparable normal interval +- The problem phenomenon and expected behavior +- The business workload characteristics, such as read or write ratios and primary behavior + +## Summary + +In general, you can use the following optimization methods to analyze and resolve performance issues. + +| Action | Effect | +|:--|:--| +| Prepared plan cache + JDBC | Throughput performance will be greatly improved, latency will be significantly reduced, and the average TiDB CPU utilization will be significantly reduced. | +| Enable AsyncIO and Raft-engine in TiKV | There will be some improvement in throughput performance. You need to contact the [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) to enable it. | +| Clustered Index | Throughput performance will be greatly improved. | +| Scale out TiDB nodes |Throughput performance will be greatly improved. | +| Client-side optimization. Split 1 JVM into 3 | Throughput performance will improve significantly and may further continue to improve throughput capacity if further split. | +| Limit the network latency between the application and the database | High network latency can lead to decreased throughput and increased latency. | + +In the future, TiDB Cloud will introduce more observable metrics and self-diagnostic services. They will provide you with a more comprehensive understanding of performance metrics and operational advice to improve your experience. diff --git a/tidb-cloud/troubleshoot-import-access-denied-error.md b/tidb-cloud/troubleshoot-import-access-denied-error.md new file mode 100644 index 0000000000000..cad734d9dad9c --- /dev/null +++ b/tidb-cloud/troubleshoot-import-access-denied-error.md @@ -0,0 +1,172 @@ +--- +title: Troubleshoot Access Denied Errors during Data Import from Amazon S3 +summary: Learn how to troubleshoot access denied errors when importing data from Amazon S3 to TiDB Cloud. +--- + +# Troubleshoot Access Denied Errors during Data Import from Amazon S3 + +This document describes how to troubleshoot access denied errors that might occur when you import data from Amazon S3 into TiDB Cloud. + +After you click **Import** on the **Data Import Task** page of the TiDB Cloud console and confirm the import process, TiDB Cloud starts validating whether it can access your data in your specified bucket URL. If you see an error message with the keyword `AccessDenied`, an access denied error has occurred. + +To troubleshoot the access denied errors, perform the following checks in the AWS Management Console. + +## Check the policy of the IAM role + +1. In the AWS Management Console, go to **IAM** > **Access Management** > **Roles**. +2. In the list of roles, find and click the role you have created for the target TiDB cluster. The role summary page is displayed. +3. In the **Permission policies** area of the role summary page, a list of policies is displayed. Take the following steps for each policy: + 1. Click the policy to enter the policy summary page. + 2. On the policy summary page, click the **{}JSON** tab to check the permission policy. Make sure that the `Resource` fields in the policy are correctly configured. + +The following is a sample policy. + +``` +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "VisualEditor0", + "Effect": "Allow", + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Resource": "arn:aws:s3:::tidb-cloud-source-data/mydata/*" + }, + { + "Sid": "VisualEditor1", + "Effect": "Allow", + "Action": [ + "s3:ListBucket", + "s3:GetBucketLocation" + ], + "Resource": "arn:aws:s3:::tidb-cloud-source-data" + }, + { + "Sid": "AllowKMSkey", + "Effect": "Allow", + "Action": [ + "kms:Decrypt" + ], + "Resource": "arn:aws:kms:ap-northeast-1:105880447796:key/c3046e91-fdfc-4f3a-acff-00597dd3801f" + } + ] +} +``` + +In this sample policy, pay attention to the following: + +- In `"arn:aws:s3:::tidb-cloud-source-data/mydata/*"`, `"arn:aws:s3:::tidb-cloud-source-data"` is a sample S3 bucket ARN, and `/mydata/*` is a directory that you can customize in your S3 bucket root level for data storage. The directory needs to end with `/*`, for example, `"//*"`. If `/*` is not added, the `AccessDenied` error occurs. + +- If you have enabled AWS Key Management Service key (SSE-KMS) with customer-managed key encryption, make sure the following configuration is included in the policy. `"arn:aws:kms:ap-northeast-1:105880447796:key/c3046e91-fdfc-4f3a-acff-00597dd3801f"` is a sample KMS key of the bucket. + + ``` + { + "Sid": "AllowKMSkey", + "Effect": "Allow", + "Action": [ + "kms:Decrypt" + ], + "Resource": "arn:aws:kms:ap-northeast-1:105880447796:key/c3046e91-fdfc-4f3a-acff-00597dd3801f" + } + ``` + + If the objects in your bucket have been copied from another encrypted bucket, the KMS key value needs to include the keys of both buckets. For example, `"Resource": ["arn:aws:kms:ap-northeast-1:105880447796:key/c3046e91-fdfc-4f3a-acff-00597dd3801f","arn:aws:kms:ap-northeast-1:495580073302:key/0d7926a7-6ecc-4bf7-a9c1-a38f0faec0cd"]`. + +If your policy is not correctly configured as the preceding example shows, correct the `Resource` fields in your policy and try importing data again. + +> **Tip:** +> +> If you have updated the permission policy multiple times and still get the `AccessDenied` error during data import, you can try to revoke active sessions. Go to **IAM** > **Access Management** > **Roles**, click your target role to enter the role summary page. On the role summary page, find **Revoke active sessions** and click the button to revoke active sessions. Then, retry the data import. +> +> Note that this might affect your other applications. + +## Check the bucket policy + +1. In the AWS Management Console, open the Amazon S3 console, and then go to the **Buckets** page. A list of buckets is displayed. +2. In the list, find and click the target bucket. The bucket information page is displayed. +3. Click the **Permissions** tab, and then scroll down to the **Bucket policy** area. By default, this area has no policy value. If any denied policy is displayed in this area, the `AccessDenied` error might occur during data import. + +If you see a denied policy, check whether the policy relates to the current data import. If yes, delete it from the area and retry the data import. + +## Check the trust entity + +1. In the AWS Management Console, go to **IAM** > **Access Management** > **Roles**. +2. In the list of roles, find and click the role you have created for the target TiDB cluster. The role summary page is displayed. +3. On the role summary page, click the **Trust relationships** tab, and you will see the trusted entities. + +The following is a sample trust entity: + +``` +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::380838443567:root" + }, + "Action": "sts:AssumeRole", + "Condition": { + "StringEquals": { + "sts:ExternalId": "696e6672612d617069a79c22fa5740944bf8bb32e4a0c4e3fe" + } + } + } + ] +} +``` + +In the sample trust entity: + +- `380838443567` is the TiDB Cloud Account ID. Make sure that this field in your trust entity matches your TiDB Cloud Account ID. +- `696e6672612d617069a79c22fa5740944bf8bb32e4a0c4e3fe` is the TiDB Cloud External ID. Make sure that this field in your trusted entity matches your TiDB Cloud External ID. + +## Check the Object Ownership + +1. In the AWS Management Console, open the Amazon S3 console, and then go to the **Buckets** page. A list of buckets is displayed. +2. In the list of buckets, find and click the target bucket. The bucket information page is displayed. +3. On the bucket information page, click the **Permissions** tab, and then scroll down to the **Object Ownership** area. Make sure that the "Object Ownership" configuration is "Bucket owner enforced". + + If the configuration is not "Bucket owner enforced", the `AccessDenied` error occurs, because your account does not have enough permissions for all objects in this bucket. + +To handle the error, click **Edit** in the upper-right corner of the Object Ownership area and change the ownership to "Bucket owner enforced". Note that this might affect your other applications that are using this bucket. + +## Check your bucket encryption type + +There are more than one way to encrypt an S3 bucket. When you try to access the objects in a bucket, the role you have created must have the permission to access the encryption key for data decryption. Otherwise, the `AccessDenied` error occurs. + +To check the encryption type of your bucket, take the following steps: + +1. In the AWS Management Console, open the Amazon S3 console, and then go to the **Buckets** page. A list of buckets is displayed. +2. In the list of buckets, find and click the target bucket. The bucket information page is displayed. +3. On the bucket information page, click the **Properties** tab, scroll down to the **Default encryption** area, and then check the configurations in this area. + +There are two types of server-side encryption: Amazon S3-managed key (SSE-S3) and AWS Key Management Service (SSE-KMS). For SSE-S3, further check is not needed because this encryption type does not cause access denied errors. For SSE-KMS, you need to check the following: + +- If the AWS KMS key ARN in the area is displayed in black without an underline, the AWS KMS key is an AWS-managed key (aws/s3). +- If the AWS KMS key ARN in the area is displayed in blue with a link, click the key ARN to open the key information page. Check the left navigation bar to see the specific encryption type. It might be an AWS managed key (aws/s3) or a customer managed key. + +
+For the AWS managed key (aws/s3) in SSE-KMS + +In this situation, if the `AccessDenied` error occurs, the reason might be that the key is read-only and cross-account permission grants are not allowed. See the AWS article [Why are cross-account users getting Access Denied errors when they try to access S3 objects encrypted by a custom AWS KMS key](https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-denied-error-s3/) for details. + +To solve the access denied error, click **Edit** in the upper-right corner of the **Default encryption** area, and change the AWS KMS key to "Choose from your AWS KMS keys" or "Enter AWS KMS key ARN", or change the server-side encryption type to "AWS S3 Managed Key (SSE-S3). In addition to this method, you can also create a new bucket and use the custom-managed key or the SSE-S3 encryption method. +
+ +
+For the customer-managed key in SSE-KMS + +To solve the `AccessDenied` error in this situation, click the key ARN or manually find the key in KMS. A **Key users** page is displayed. Click **Add** in the upper-right corner of the area to add the role you have used to import data to TiDB Cloud. Then, try importing data again. + +
+ +> **Note:** +> +> If the objects in your bucket have been copied from an existing encrypted bucket, you also need to include the key of the source bucket in the AWS KMS key ARN. This is because the objects in the your bucket use the same encryption method as the source object encryption. For more information, see the AWS document [Using default encryption with replication](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html). + +## Check the AWS article for instruction + +If you have performed all the checks above and still get the `AccessDenied` error, you can check the AWS article [How do I troubleshoot 403 Access Denied errors from Amazon S3](https://aws.amazon.com/premiumsupport/knowledge-center/s3-troubleshoot-403/) for more instruction. diff --git a/tidb-cloud/use-htap-cluster.md b/tidb-cloud/use-htap-cluster.md index 137b3528f0653..233c10e5b3268 100644 --- a/tidb-cloud/use-htap-cluster.md +++ b/tidb-cloud/use-htap-cluster.md @@ -5,15 +5,15 @@ summary: Learn how to use HTAP cluster in TiDB Cloud. # Use an HTAP Cluster -[HTAP](https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing) means Hybrid Transactional/Analytical Processing. The HTAP cluster in TiDB Cloud is composed of [TiKV](https://tikv.org), a row-based storage engine designed for transactional processing, and [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview)beta, a columnar storage designed for analytical processing. Your application data is first stored in TiKV and then replicated to TiFlashbeta via the Raft consensus algorithm. So it is real time replication from the row store to the columnar store. +[HTAP](https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing) means Hybrid Transactional/Analytical Processing. The HTAP cluster in TiDB Cloud is composed of [TiKV](https://tikv.org), a row-based storage engine designed for transactional processing, and [TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview), a columnar storage designed for analytical processing. Your application data is first stored in TiKV and then replicated to TiFlash via the Raft consensus algorithm. So it is real time replication from the row store to the columnar store. -With TiDB Cloud, you can create an HTAP cluster easily by specifying one or more TiFlashbeta nodes according to your HTAP workload. If the TiFlashbeta node count is not specified when you create the cluster or you want to add more TiFlashbeta nodes, you can change the node count by [scaling the cluster](/tidb-cloud/scale-tidb-cluster.md). +With TiDB Cloud, you can create an HTAP cluster easily by specifying one or more TiFlash nodes according to your HTAP workload. If the TiFlash node count is not specified when you create the cluster or you want to add more TiFlash nodes, you can change the node count by [scaling the cluster](/tidb-cloud/scale-tidb-cluster.md). > **Note:** > -> A Developer Tier cluster has one TiFlashbeta node by default and you cannot change the number. +> A Developer Tier cluster has one TiFlash node by default and you cannot change the number. -TiKV data is not replicated to TiFlashbeta by default. You can select which table to replicate to TiFlashbeta using the following SQL statement: +TiKV data is not replicated to TiFlash by default. You can select which table to replicate to TiFlash using the following SQL statement: {{< copyable "sql" >}} @@ -21,7 +21,7 @@ TiKV data is not replicated to TiFlashbeta by default. You can select ALTER TABLE table_name SET TIFLASH REPLICA 1; ``` -The number of replicas count must be smaller than the number of TiFlashbeta nodes. Setting the number of replicas to `0` means deleting the replica in TiFlashbeta. +The number of replicas count must be no larger than the number of TiFlash nodes. Setting the number of replicas to `0` means deleting the replica in TiFlash. To check the replication progress, use the following command: @@ -31,13 +31,13 @@ To check the replication progress, use the following command: SELECT * FROM information_schema.tiflash_replica WHERE TABLE_SCHEMA = '' and TABLE_NAME = ''; ``` -## Use TiDB to read TiFlashbeta replicas +## Use TiDB to read TiFlash replicas -After data is replicated to TiFlashbeta, you can use one of the following three ways to read TiFlashbeta replicas to accelerate your analytical computing. +After data is replicated to TiFlash, you can use one of the following three ways to read TiFlash replicas to accelerate your analytical computing. ### Smart selection -For tables with TiFlashbeta replicas, the TiDB optimizer automatically determines whether to use TiFlashbeta replicas based on the cost estimation. For example: +For tables with TiFlash replicas, the TiDB optimizer automatically determines whether to use TiFlash replicas based on the cost estimation. For example: {{< copyable "sql" >}} @@ -55,7 +55,7 @@ explain analyze select count(*) from test.t; +--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ ``` -`cop[tiflash]` means that the task will be sent to TiFlashbeta for processing. If your queries have not selected a TiFlashbeta replica, try to update the statistics using the `analyze table` statement, and then check the result using the `explain analyze` statement. +`cop[tiflash]` means that the task will be sent to TiFlash for processing. If your queries have not selected a TiFlash replica, try to update the statistics using the `analyze table` statement, and then check the result using the `explain analyze` statement. ### Engine isolation @@ -77,4 +77,4 @@ Manual hint can force TiDB to use specified replicas for one or more specific ta select /*+ read_from_storage(tiflash[table_name]) */ ... from table_name; ``` -To learn more about TiFlashbeta, refer to the documentation [here](https://docs.pingcap.com/tidb/stable/tiflash-overview/). +To learn more about TiFlash, refer to the documentation [here](https://docs.pingcap.com/tidb/stable/tiflash-overview/). diff --git a/tidb-lightning/tidb-lightning-backends.md b/tidb-lightning/tidb-lightning-backends.md index ae64aa177abd3..756ce53154d75 100644 --- a/tidb-lightning/tidb-lightning-backends.md +++ b/tidb-lightning/tidb-lightning-backends.md @@ -1,5 +1,5 @@ --- -title: TiDB Lightning Import Mode +title: TiDB Lightning Import Modes summary: Learn how to choose different import modes of TiDB Lightning. aliases: ['/docs/dev/tidb-lightning/tidb-lightning-tidb-backend/','/docs/dev/reference/tools/tidb-lightning/tidb-backend/','/tidb/dev/tidb-lightning-tidb-backend','/docs/dev/loader-overview/','/docs/dev/reference/tools/loader/','/docs/dev/load-misuse-handling/','/docs/dev/reference/tools/error-case-handling/load-misuse-handling/','/tidb/dev/load-misuse-handling','/tidb/dev/loader-overview/'] --- diff --git a/tidb-lightning/tidb-lightning-configuration.md b/tidb-lightning/tidb-lightning-configuration.md index 98d1dccc8c29f..90799a83fb9a4 100644 --- a/tidb-lightning/tidb-lightning-configuration.md +++ b/tidb-lightning/tidb-lightning-configuration.md @@ -6,7 +6,7 @@ aliases: ['/docs/dev/tidb-lightning/tidb-lightning-configuration/','/docs/dev/re # TiDB Lightning Configuration -This document provides samples for global configuration, task configuration, and TiKV Importer configuration in TiDB Lightning, and describes the usage of command-line parameters. +This document provides samples for global configuration and task configuration, and describes the usage of command-line parameters. ## Configuration files @@ -116,8 +116,8 @@ driver = "file" # keep-after-success = false [tikv-importer] -# "local": The default mode. It applies to large dataset import, for example, greater than 1 TiB. However, during the import, downstream TiDB is not available to provide services. -# "tidb": You can use this mode for small dataset import, for example, smaller than 1 TiB. During the import, downstream TiDB is available to provide services. +# "local": Physical import mode, used by default. It applies to large dataset import, for example, greater than 1 TiB. However, during the import, downstream TiDB is not available to provide services. +# "tidb": Logical import mode. You can use this mode for small dataset import, for example, smaller than 1 TiB. During the import, downstream TiDB is available to provide services. # backend = "local" # Whether to allow importing data to tables with data. The default value is `false`. # When you use parallel import mode, you must set it to `true`, because multiple TiDB Lightning instances are importing the same table at the same time. @@ -125,12 +125,13 @@ driver = "file" # The listening address of tikv-importer when backend is "importer". Change it to the actual address. addr = "172.16.31.10:8287" -# Action to do when trying to insert a duplicated entry in the "tidb" backend. +# Action to do when trying to insert a duplicated entry in logical import mode. # - replace: use new entry to replace the existing entry # - ignore: keep the existing entry, and ignore the new entry # - error: report error and quit the program # on-duplicate = "replace" -# Whether to detect and resolve duplicate records (unique key conflict) when the backend is 'local'. + +# Whether to detect and resolve duplicate records (unique key conflict) in physical import mode. # The following resolution algorithms are supported: # - record: only records duplicate records to the `lightning_task_info.conflict_error_v1` table on the target TiDB. Note that the # required version of the target TiKV is no earlier than v5.2.0; otherwise it falls back to 'none'. @@ -139,16 +140,19 @@ addr = "172.16.31.10:8287" # - remove: records all duplicate records to the lightning_task_info database, like the 'record' algorithm. But it removes all duplicate records from the target table to ensure a consistent # state in the target TiDB. # duplicate-resolution = 'none' -# The number of KV pairs sent in one request in the "local" backend. +# The number of KV pairs sent in one request in physical import mode. # send-kv-pairs = 32768 -# The directory of local KV sorting in the "local" backend. If the disk +# The directory of local KV sorting in physical import mode. If the disk # performance is low (such as in HDD), it is recommended to set the directory # on a different disk from `data-source-dir` to improve import speed. # sorted-kv-dir = "" -# The concurrency that TiKV writes KV data in the "local" backend. +# The concurrency that TiKV writes KV data in physical import mode. # When the network transmission speed between TiDB Lightning and TiKV # exceeds 10 Gigabit, you can increase this value accordingly. # range-concurrency = 16 +# Limits the bandwidth in which TiDB Lightning writes data into each TiKV +# node in physical import mode. 0 by default, which means no limit. +# store-write-bwlimit = "128MiB" [mydumper] # Block size for file reading. Keep it longer than the longest string of the data source. @@ -289,10 +293,12 @@ max-allowed-packet = 67_108_864 # Private key of this service. Default to copy of `security.key-path` # key-path = "/path/to/lightning.key" -# When data importing is complete, tidb-lightning can automatically perform -# the Checksum, Compact and Analyze operations. It is recommended to leave -# these as true in the production environment. -# The execution order: Checksum -> Analyze +# In physical import mode, when data importing is complete, tidb-lightning can +# automatically perform the Checksum and Analyze operations. It is recommended +# to leave these as true in the production environment. +# The execution order: Checksum -> Analyze. +# In logical import mode, Checksum and Analyze is not needed, and they are always +# skipped in the actual operation. [post-restore] # Specifies whether to perform `ADMIN CHECKSUM TABLE ` for each table to verify data integrity after importing. # The following options are available: @@ -327,85 +333,6 @@ switch-mode = "5m" log-progress = "5m" ``` -### TiKV Importer - -```toml -# TiKV Importer configuration file template. - -# Log file. -log-file = "tikv-importer.log" -# Log level: trace, debug, info, warn, error, off. -log-level = "info" - -# Listening address of the status server. Prometheus can scrape metrics from this address. -status-server-address = "0.0.0.0:8286" - -[server] -# The listening address of tikv-importer. tidb-lightning needs to connect to -# this address to write data. -addr = "0.0.0.0:8287" -# Size of the thread pool for the gRPC server. -grpc-concurrency = 16 - -[metric] -# These settings are relevant when using Prometheus Pushgateway. Normally you should let Prometheus -# to scrape metrics from the status-server-address. -# The Prometheus client push job name. -job = "tikv-importer" -# The Prometheus client push interval. -interval = "15s" -# The Prometheus Pushgateway address. -address = "" - -[rocksdb] -# The maximum number of concurrent background jobs. -max-background-jobs = 32 - -[rocksdb.defaultcf] -# Amount of data to build up in memory before flushing data to the disk. -write-buffer-size = "1GB" -# The maximum number of write buffers that are built up in memory. -max-write-buffer-number = 8 - -# The compression algorithms used in different levels. -# The algorithm at level-0 is used to compress KV data. -# The algorithm at level-6 is used to compress SST files. -# The algorithms at level-1 to level-5 are unused for now. -compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] - -[rocksdb.writecf] -# (same as above) -compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] - -[security] -# The path for TLS certificates. Empty string means disabling secure connections. -# ca-path = "" -# cert-path = "" -# key-path = "" - -[import] -# The directory to store engine files. -import-dir = "/mnt/ssd/data.import/" -# Number of threads to handle RPC requests. -num-threads = 16 -# Number of concurrent import jobs. -num-import-jobs = 24 -# Maximum duration to prepare Regions. -#max-prepare-duration = "5m" -# Split Regions into this size according to the importing data. -#region-split-size = "512MB" -# Stream channel window size. The stream will be blocked on channel full. -#stream-channel-window = 128 -# Maximum number of open engines. -max-open-engines = 8 -# Maximum upload speed (bytes per second) from Importer to TiKV. -# upload-speed-limit = "512MB" -# Minimum ratio of available space on the target store: `store_available_space`/`store_capacity`. -# Importer pauses uploading SST if the availability ratio of the target store is less than this -# value, to allow enough time for PD to balance Regions. -min-available-ratio = 0.05 -``` - ## Command line parameters ### Usage of `tidb-lightning` @@ -417,7 +344,7 @@ min-available-ratio = 0.05 | -d *directory* | Directory or [external storage URL](/br/backup-and-restore-storages.md) of the data dump to read from | `mydumper.data-source-dir` | | -L *level* | Log level: debug, info, warn, error, fatal (default = info) | `lightning.log-level` | | -f *rule* | [Table filter rules](/table-filter.md) (can be specified multiple times) | `mydumper.filter` | -| --backend *backend* | [Delivery backend](/tidb-lightning/tidb-lightning-backends.md) (`local`, `importer`, or `tidb`) | `tikv-importer.backend` | +| --backend *[backend](/tidb-lightning/tidb-lightning-overview.md)* | Select an import mode. `local` refers to physical import mode; `tidb` refers to logical import mode. | `local` | | --log-file *file* | Log file path. By default, it is `/tmp/lightning.log.{timestamp}`. If set to '-', it means that the log files will be output to stdout. | `lightning.log-file` | | --status-addr *ip:port* | Listening address of the TiDB Lightning server | `lightning.status-port` | | --importer *host:port* | Address of TiKV Importer | `tikv-importer.addr` | @@ -457,15 +384,3 @@ This tool can execute various actions given one of the following parameters: The *tablename* must either be a qualified table name in the form `` `db`.`tbl` `` (including the backquotes), or the keyword "all". Additionally, all parameters of `tidb-lightning` described in the section above are valid in `tidb-lightning-ctl`. - -## Usage of `tikv-importer` - -| Parameter | Explanation | Corresponding setting | -|:----|:----|:----| -| -C, --config *file* | Reads configuration from *file*. If not specified, the default configuration would be used. | | -| -V, --version | Prints program version | | -| -A, --addr *ip:port* | Listening address of the TiKV Importer server | `server.addr` | -| --status-server *ip:port* | Listening address of the status server | `status-server-address` | -| --import-dir *dir* | Stores engine files in this directory | `import.import-dir` | -| --log-level *level* | Log level: trace, debug, info, warn, error, off | `log-level` | -| --log-file *file* | Log file path | `log-file` | diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index c557a4dc2488b..99412ff71f490 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -137,13 +137,7 @@ tidb-lightning-ctl --config tidb-lightning.toml --fetch-mode The TiDB Lightning toolset is best used with a 10-Gigabit network card. 1-Gigabit network cards are *not recommended*, especially for `tikv-importer`. -1-Gigabit network cards can only provide a total bandwidth of 120 MB/s, which has to be shared among all target TiKV stores. TiDB Lightning can easily saturate all bandwidth of the 1-Gigabit network and bring down the cluster because PD is unable to be contacted anymore. To avoid this, set an *upload speed limit* in [Importer's configuration](/tidb-lightning/tidb-lightning-configuration.md#tikv-importer): - -```toml -[import] -# Restricts the total upload speed to TiKV to 100 MB/s or less -upload-speed-limit = "100MB" -``` +1-Gigabit network cards can only provide a total bandwidth of 120 MB/s, which has to be shared among all target TiKV stores. TiDB Lightning can easily saturate all bandwidth of the 1-Gigabit network and bring down the cluster because PD is unable to be contacted anymore. ## Why TiDB Lightning requires so much free space in the target TiKV cluster? diff --git a/tidb-lightning/tidb-lightning-overview.md b/tidb-lightning/tidb-lightning-overview.md index 0237a71b3e9d4..36701cfe4ccd4 100644 --- a/tidb-lightning/tidb-lightning-overview.md +++ b/tidb-lightning/tidb-lightning-overview.md @@ -6,54 +6,40 @@ aliases: ['/docs/dev/tidb-lightning/tidb-lightning-overview/','/docs/dev/referen # TiDB Lightning Overview -[TiDB Lightning](https://github.com/pingcap/tidb-lightning) is a tool used for fast full import of large amounts of data into a TiDB cluster. You can download TiDB Lightning from [here](/download-ecosystem-tools.md). +[TiDB Lightning](https://github.com/pingcap/tidb-lightning) is a tool used for importing data at TB scale to TiDB clusters. It is often used for initial data import to TiDB clusters. -Currently, TiDB Lightning can mainly be used in the following two scenarios: +TiDB Lightning supports the following file formats: -- Importing **large amounts** of **new** data **quickly** -- Restore all backup data +- Files exported by [Dumpling](/dumpling-overview.md) +- CSV files +- [Apache Parquet files generated by Amazon Aurora](/migrate-aurora-to-tidb.md) -Currently, TiDB Lightning supports: +TiDB Lightning can read data from the following sources: -- Importing files exported by [Dumpling](/dumpling-overview.md), CSV files, and [Apache Parquet files generated by Amazon Aurora](/migrate-aurora-to-tidb.md). -- Reading data from a local disk or from the Amazon S3 storage. For details, see [External Storages](/br/backup-and-restore-storages.md). +- Local +- [Amazon S3](/br/backup-and-restore-storages.md#s3-url-parameters) +- [Google Cloud Storage](/br/backup-and-restore-storages.md#gcs-url-parameters) ## TiDB Lightning architecture ![Architecture of TiDB Lightning tool set](/media/tidb-lightning-architecture.png) -The complete import process is as follows: +TiDB Lightning supports two import modes, configured by `backend`. The import mode determines the way data is imported into TiDB. -1. Before importing, `tidb-lightning` switches the TiKV cluster to "import mode", which optimizes the cluster for writing and disables automatic compaction. +- [Physical Import Mode](/tidb-lightning/tidb-lightning-physical-import-mode.md): TiDB Lightning first encodes data into key-value pairs and stores them in a local temporary directory, then uploads these key-value pairs to each TiKV node, and finally calls the TiKV Ingest interface to insert data into TiKV's RocksDB. If you need to perform initial import, consider physical import mode, which has higher import speed. -2. `tidb-lightning` creates the skeleton of all tables from the data source. +- [Logical Import Mode](/tidb-lightning/tidb-lightning-backends.md#tidb-backend): TiDB Lightning first encodes the data into SQL statements and then runs these SQL statements directly for data import. If the cluster to be imported is in production, or if the target table to be imported already contains data, use logical import mode. -3. Each table is split into multiple continuous *batches*, so that data from a huge table (200 GB+) can be imported incrementally and concurrently. +| Import mode | Physical Import Mode | Logical Import Mode | +|:---|:---|:---| +| Speed | Fast (100~500 GiB/hour) | Low (10~50 GiB/hour)| +| Resource consumption| High | Low | +| Network bandwidth consumption | High | Low | +| ACID compliance during import | No | Yes | +| Target tables | Must be empty | Can contain data | +| TiDB cluster version | >= 4.0.0 | All | +| Whether the TiDB cluster can provide service during import | [Limited service](/tidb-lightning/tidb-lightning-physical-import-mode.md#limitations) | Yes | -4. For each batch, `tidb-lightning` creates an *engine file* to store KV pairs. `tidb-lightning` then reads the data source in parallel, transforms each row into KV pairs according to the TiDB rules, and writes these KV pairs into the local files for temporary storage. - -5. Once a complete engine file is written, `tidb-lightning` divides and schedules these data and imports them into the target TiKV cluster. - - There are two kinds of engine files: *data engines* and *index engines*, each corresponding to two kinds of KV pairs: the row data and secondary indices. Normally, the row data are entirely sorted in the data source, while the secondary indices are out of order. Because of this, the data engines are uploaded as soon as a batch is completed, while the index engines are imported only after all batches of the entire table are encoded. - -6. After all engines associated to a table are imported, `tidb-lightning` performs a checksum comparison between the local data source and those calculated from the cluster, to ensure there is no data corruption in the process; tells TiDB to `ANALYZE` all imported tables, to prepare for optimal query planning; and adjusts the `AUTO_INCREMENT` value so future insertions will not cause conflict. - - The auto-increment ID of a table is computed by the estimated *upper bound* of the number of rows, which is proportional to the total file size of the data files of the table. Therefore, the final auto-increment ID is often much larger than the actual number of rows. This is expected since in TiDB auto-increment is [not necessarily allocated sequentially](/mysql-compatibility.md#auto-increment-id). - -7. Finally, `tidb-lightning` switches the TiKV cluster back to "normal mode", so the cluster resumes normal services. - -If the target cluster of data import is v3.x or earlier versions, you need to use the Importer-backend to import data. In this mode, `tidb-lightning` sends the parsed KV pairs to `tikv-importer` via gRPC and `tikv-importer` imports the data. - -TiDB Lightning also supports using TiDB-backend for data import. In this mode, `tidb-lightning` transforms data into `INSERT` SQL statements and directly executes them on the target cluster. See [TiDB Lightning Backends](/tidb-lightning/tidb-lightning-backends.md) for details. - -## Restrictions - -- If you use TiDB Lightning together with TiFlash: - - No matter a table has TiFlash replica(s) or not, you can import data to that table using TiDB Lightning. Note that this might slow the TiDB Lightning procedure, which depends on the NIC bandwidth on the lightning host, the CPU and disk load of the TiFlash node, and the number of TiFlash replicas. - -- If you use TiDB Lightning together with TiDB: - - TiDB Lightning does not support importing `charset=GBK` tables to TiDB clusters earlier than v5.4.0. - -- For Apache Parquet files, TiDB Lightning currently only accepts Amazon Aurora Parquet files. + +The preceding performance data is used to compare the import performance difference between the two modes. The actual import speed is affected by various factors such as hardware configuration, table schema, and the number of indexes. + diff --git a/tidb-lightning/tidb-lightning-physical-import-mode-usage.md b/tidb-lightning/tidb-lightning-physical-import-mode-usage.md new file mode 100644 index 0000000000000..61704f5b0f1cd --- /dev/null +++ b/tidb-lightning/tidb-lightning-physical-import-mode-usage.md @@ -0,0 +1,250 @@ +--- +title: Use Physical Import Mode +summary: Learn how to use the physical import mode in TiDB Lightning. +--- + +# Use Physical Import Mode + +This document introduces how to use the physical import mode in TiDB Lightning, including writing the configuration file, tuning performance, and configuring disk quota. + +## Configure and use the physical import mode + +You can use the following configuration file to execute data import using Physical Import Mode: + +```toml +[lightning] +# log +level = "info" +file = "tidb-lightning.log" +max-size = 128 # MB +max-days = 28 +max-backups = 14 + +# Checks the cluster minimum requirements before start. +check-requirements = true + +[mydumper] +# The local data source directory or the external storage URL. +data-source-dir = "/data/my_database" + +[tikv-importer] +# Import mode. "local" means using the physical import mode. +backend = "local" + +# The method to resolve the conflicting data. +duplicate-resolution = 'remove' + +# The directory of local KV sorting. +sorted-kv-dir = "./some-dir" + +# Limits the bandwidth in which TiDB Lightning writes data into each TiKV +# node in physical import mode. 0 by default, which means no limit. +# store-write-bwlimit = "128MiB" + +[tidb] +# The information of the target cluster. The address of any tidb-server from the cluster. +host = "172.16.31.1" +port = 4000 +user = "root" +# Configure the password to connect to TiDB. Either plaintext or Base64 encoded. +password = "" +# Required. Table schema information is fetched from TiDB via this status-port. +status-port = 10080 +# Required. The address of any pd-server from the cluster. +pd-addr = "172.16.31.4:2379" +# tidb-lightning import the TiDB library, and generates some logs. +# Set the log level of the TiDB library. +log-level = "error" + +[post-restore] +# Specifies whether to perform `ADMIN CHECKSUM TABLE
` for each table to verify data integrity after importing. +# The following options are available: +# - "required" (default): Perform admin checksum after importing. If checksum fails, TiDB Lightning will exit with failure. +# - "optional": Perform admin checksum. If checksum fails, TiDB Lightning will report a WARN log but ignore any error. +# - "off": Do not perform checksum after importing. +# Note that since v4.0.8, the default value has changed from "true" to "required". +# +# Note: +# 1. Checksum failure usually means import exception (data loss or data inconsistency), so it is recommended to always enable Checksum. +# 2. For backward compatibility, bool values "true" and "false" are also allowed for this field. +# "true" is equivalent to "required" and "false" is equivalent to "off". +checksum = "required" + +# Specifies whether to perform `ANALYZE TABLE
` for each table after checksum is done. +# Options available for this field are the same as `checksum`. However, the default value for this field is "optional". +analyze = "optional" +``` + +For the complete configuration file, refer to [the configuration file and command line parameters](/tidb-lightning/tidb-lightning-configuration.md). + +### Conflict detection + +Conflicting data refers to two or more records with the same PK/UK column data. When the data source contains conflicting data, the actual number of rows in the table is different from the total number of rows returned by the query using unique index. + +TiDB Lightning offers three strategies for detecting conflicting data: + +- `record`: only records conflicting records to the `lightning_task_info.conflict_error_v1` table on the target TiDB. Note that the required version of the target TiKV is v5.2.0 or later versions; otherwise, it falls back to 'none'. +- `remove` (recommended): records all conflicting records, like the `record` strategy. But it removes all conflicting records from the target table to ensure a consistent state in the target TiDB. +- `none`: does not detect duplicate records. `none` has the best performance in the three strategies, but might lead to inconsistent data in the target TiDB. + +Before v5.3, Lightning does not support conflict detection. If there is conflicting data, the import process fails at the checksum step. When conflict detection is enabled, regardless of the `record` or `remove` strategy, if there is conflicting data, Lightning skips the checksum step (because it always fails). + +Suppose an `order_line` table has the following schema: + +```sql +CREATE TABLE IF NOT EXISTS `order_line` ( + `ol_o_id` int(11) NOT NULL, + `ol_d_id` int(11) NOT NULL, + `ol_w_id` int(11) NOT NULL, + `ol_number` int(11) NOT NULL, + `ol_i_id` int(11) NOT NULL, + `ol_supply_w_id` int(11) DEFAULT NULL, + `ol_delivery_d` datetime DEFAULT NULL, + `ol_quantity` int(11) DEFAULT NULL, + `ol_amount` decimal(6,2) DEFAULT NULL, + `ol_dist_info` char(24) DEFAULT NULL, + PRIMARY KEY (`ol_w_id`,`ol_d_id`,`ol_o_id`,`ol_number`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +``` + +If Lightning detects conflicting data during the import, you can query the `lightning_task_info.conflict_error_v1` table as follows: + +```sql +mysql> select table_name,index_name,key_data,row_data from conflict_error_v1 limit 10; ++---------------------+------------+----------+-----------------------------------------------------------------------------+ +| table_name | index_name | key_data | row_data | ++---------------------+------------+----------+-----------------------------------------------------------------------------+ +| `tpcc`.`order_line` | PRIMARY | 21829216 | (2677, 10, 10, 11, 75656, 10, NULL, 5, 5831.97, "HT5DN3EVb6kWTd4L37bsbogj") | +| `tpcc`.`order_line` | PRIMARY | 49931672 | (2677, 10, 10, 11, 75656, 10, NULL, 5, 5831.97, "HT5DN3EVb6kWTd4L37bsbogj") | +| `tpcc`.`order_line` | PRIMARY | 21829217 | (2677, 10, 10, 12, 76007, 10, NULL, 5, 9644.36, "bHuVoRfidQ0q2rJ6ZC9Hd12E") | +| `tpcc`.`order_line` | PRIMARY | 49931673 | (2677, 10, 10, 12, 76007, 10, NULL, 5, 9644.36, "bHuVoRfidQ0q2rJ6ZC9Hd12E") | +| `tpcc`.`order_line` | PRIMARY | 21829218 | (2677, 10, 10, 13, 85618, 10, NULL, 5, 7427.98, "t3rsesgi9rVAKi9tf6an5Rpv") | +| `tpcc`.`order_line` | PRIMARY | 49931674 | (2677, 10, 10, 13, 85618, 10, NULL, 5, 7427.98, "t3rsesgi9rVAKi9tf6an5Rpv") | +| `tpcc`.`order_line` | PRIMARY | 21829219 | (2677, 10, 10, 14, 15873, 10, NULL, 5, 133.21, "z1vH0e31tQydJGhfNYNa4ScD") | +| `tpcc`.`order_line` | PRIMARY | 49931675 | (2677, 10, 10, 14, 15873, 10, NULL, 5, 133.21, "z1vH0e31tQydJGhfNYNa4ScD") | +| `tpcc`.`order_line` | PRIMARY | 21829220 | (2678, 10, 10, 1, 44644, 10, NULL, 5, 8463.76, "TWKJBt5iJA4eF7FIVxnugNmz") | +| `tpcc`.`order_line` | PRIMARY | 49931676 | (2678, 10, 10, 1, 44644, 10, NULL, 5, 8463.76, "TWKJBt5iJA4eF7FIVxnugNmz") | ++---------------------+------------+----------------------------------------------------------------------------------------+ +10 rows in set (0.14 sec) +``` + +You can manually identify the records that need to be retained and insert these records into the table. + +## Import data into a cluster in production + +Starting from TiDB Lightning v6.2.0, you can import data into a cluster in production using physical import mode. TiDB Lightning implements a new mechanism to limit the impact of the import on the online application. + +With the new mechanism, TiDB Lightning does not pause the global scheduling, but only pauses scheduling for the region that stores the target table data. This significantly reduces the impact of the import on the online application. + + +TiDB Lightning does not support importing data into a table that already contains data. + +The TiDB cluster must be v6.1.0 or later versions. For earlier versions, TiDB Lightning keeps the old behavior, which pauses scheduling globally and severely impacts the online application during the import. + + +By default, TiDB Lightning pauses the cluster scheduling for the minimum range possible. However, under the default configuration, the cluster performance still might be affected by fast import. To avoid this, you can configure the following options to control the import speed and other factors that might impact the cluster performance: + +```toml +[tikv-importer] +# Limits the bandwidth in which TiDB Lightning writes data into each TiKV node in physical import mode. +store-write-bwlimit = "128MiB" + +[tidb] +# Use smaller concurrency to reduce the impact of Checksum and Analyze on the transaction latency. +distsql-scan-concurrency = 3 + +[cron] +# Prevent TiKV from switching to import mode. +switch-mode = '0' +``` + +You can measure the impact of data import on TPCC results by simulating the online application using TPCC and importing data into a TiDB cluster using TiDB Lightning. The test result is as follows: + +| Concurrency | TPM | P99 | P90 | AVG | +| ----- | --- | --- | --- | --- | +| 1 | 20%~30% | 60%~80% | 30%~50% | 30%~40% | +| 8 | 15%~25% | 70%~80% | 35%~45% | 20%~35% | +| 16 | 20%~25% | 55%~85% | 35%~40% | 20%~30% | +| 64 | No significant impact | +| 256 | No significant impact | + +The percentage in the preceding table indicates the impact of data import on TPCC results. + +* For the TPM column, the number indicates the percentage of TPM decrease. +* For the P99, P90, and AVG columns, the number indicates the percentage of latency increase. + +The test results show that the smaller the concurrency, the larger the impact of data import on TPCC results. When the concurrency is 64 or more, the impact of data import on TPCC results is negligible. + +Therefore, if your TiDB cluster has a latency-sensitive application and a low concurrency, it is strongly recommended **not** to use TiDB Lightning to import data into the cluster. This will cause a significant impact on the online application. + +## Performance tuning + +**The most direct and effective ways to improve import performance of the physical import mode are as follows:** + +- **Upgrade the hardware of the node where Lightning is deployed, especially the CPU and the storage device of `sorted-key-dir`.** +- **Use the [parallel import](/tidb-lightning/tidb-lightning-distributed-import.md) feature to achieve horizontal scaling.** + +Lightning provides some concurrency-related configurations to affect Physical Import Mode import performance. However, from long-term experience, it is recommended to keep the following four configuration items in the default value. Adjusting the four configuration items does not bring significant performance boost. + +``` +[lightning] +# The maximum concurrency of engine files. +# Each table is split into one "index engine" to store indices, and multiple +# "data engines" to store row data. These settings control the maximum +# concurrent number for each type of engines. +# The two settings controls the maximum concurrency of the two engine files. +index-concurrency = 2 +table-concurrency = 6 + +# The concurrency of data. The default value is the number of logical CPUs. +region-concurrency = + +# The maximum concurrency of I/O. When the concurrency is too high, the disk +# cache may be frequently refreshed, causing the cache miss and read speed +# to slow down. For different storage mediums, this parameter may need to be +# adjusted to achieve the best performance. +io-concurrency = 5 +``` + +During the import, each table is split into one "index engine" to store indices, and multiple "data engines" to store row data. + +`index-concurrency` controls the maximum concurrency of the index engine. When you adjust `index-concurrency`, make sure that `index-concurrency * the number of source files of each table > region-concurrency` to ensure that the CPU is fully utilized. The ratio is usually between 1.5 ~ 2. Do not set `index-concurrency` too high and not lower than 2 (default). Too high `index-concurrency` causes too many pipelines to be built, which causes the index-engine import stage to pile up. + +The same goes for `table-concurrency`. Make sure that `table-concurrency * the number of source files of each table > region-concurrency` to ensure that the CPU is fully utilized. A recommended value is around `region-concurrency * 4 / the number of source files of each table` and not lower than 4. + +If the table is large, Lightning will split the table into multiple batches of 100 GiB. The concurrency is controlled by `table-concurrency`. + +`index-concurrency` and `table-concurrency` has little effect on the import speed. You can leave them in the default value. + +`io-concurrency` controls the concurrency of file read. The default value is 5. At any given time, only 5 handles are performing read operations. Because the file read speed is usually not a bottleneck, you can leave this configuration in the default value. + +After the file data is read, Lightning needs to do some post-processing, such as encoding and sorting the data locally. The concurrency of these operations is controlled by `region-concurrency`. The default value is the number of CPU cores. You can leave this configuration in the default value. It is recommended to deploy Lightning on a separate server from other components. If you must deploy Lightning together with other components, you need to lower the value of `region-concurrency` according to the load. + +The [`num-threads`](/tikv-configuration-file.md#num-threads) configuration of TiKV can also affect the performance. For new clusters, it is recommended to set `num-threads` to the number of CPU cores. + +## Configure disk quota New in v6.2.0 + +> **Warning:** +> +> Disk quota is still an experimental feature. It is **NOT** recommended that you use it in the production environment. + +When you import data in physical import mode, TiDB Lightning creates a large number of temporary files on the local disk to encode, sort, and split the original data. When the local disk space is insufficient, TiDB Lightning reports an error and exits because of write failure. + +To avoid this situation, you can configure disk quota for TiDB Lightning. When the size of the temporary files exceeds the disk quota, TiDB Lightning pauses the process of reading the source data and writing temporary files. TiDB Lightning prioritizes writing the sorted key-value pairs to TiKV. After deleting the local temporary files, TiDB Lightning continues the import process. + +To enable disk quota, add the following configuration to your configuration file: + +```toml +[tikv-importer] +# MaxInt64 by default, which is 9223372036854775807 bytes. +disk-quota = "10GB" +backend = "local" + +[cron] +# The interval of checking disk quota. 60 seconds by default. +check-disk-quota = "30s" +``` + +`disk-quota` limits the storage space used by TiDB Lightning. The default value is MaxInt64, which is 9223372036854775807 bytes. This value is much larger than the disk space you might need for the import, so leaving it as the default value is equivalent to not setting the disk quota. + +`check-disk-quota` is the interval of checking disk quota. The default value is 60 seconds. When TiDB Lightning checks the disk quota, it acquires an exclusive lock for the relevant data, which blocks all the import threads. Therefore, if TiDB Lightning checks the disk quota before every write, it significantly slows down the write efficiency (as slow as a single-thread write). To achieve efficient write, disk quota is not checked before every write; instead, TiDB Lightning pauses all the import threads and checks the disk quota every `check-disk-quota` interval. That is, if the value of `check-disk-quota` is set to a large value, the disk space used by TiDB Lightning might exceed the disk quota you set, which leaves the disk quota ineffective. Therefore, it is recommended to set the value of `check-disk-quota` to a small value. The specific value of this item is determined by the environment in which TiDB Lightning is running. In different environments, TiDB Lightning writes temporary files at different speeds. Theoretically, the faster the speed, the smaller the value of `check-disk-quota` should be. diff --git a/tidb-lightning/tidb-lightning-physical-import-mode.md b/tidb-lightning/tidb-lightning-physical-import-mode.md new file mode 100644 index 0000000000000..bfd59efbf8a14 --- /dev/null +++ b/tidb-lightning/tidb-lightning-physical-import-mode.md @@ -0,0 +1,80 @@ +--- +title: Physical Import Mode +summary: Learn about the physical import mode in TiDB Lightning. +--- + +# Physical Import Mode + +Physical import mode is an efficient and fast import mode that inserts data directly into TiKV nodes as key-value pairs without going through the SQL interface. It is suitable for importing up to 100 TB of data. + +Before you use the physical import mode, make sure to read [Requirements and restrictions](#requirements-and-restrictions). + +## Implementation + +1. Before importing data, TiDB Lightning automatically switches the TiKV nodes to "import mode", which improves write performance and stops auto-compaction. TiDB Lightning determines whether to pause global scheduling according to the TiDB cluster version. + + - When the TiDB cluster >= v6.1.0 and TiDB Lightning >= v6.2.0, TiDB Lightning pauses scheduling for the region that stores the target table data. After the import is completed, TiDB Lightning recovers scheduling. + - When the TiDB cluster < v6.1.0 or TiDB Lightning < v6.2.0, TiDB Lightning pauses global scheduling. + +2. TiDB Lightning creates table schemas in the target database and fetches the metadata. + +3. Each table is divided into multiple contiguous **blocks**, so that TiDB Lightning can import data from large tables (greater than 200 GB) in parallel. + +4. TiDB Lightning prepares an "engine file" for each block to handle key-value pairs. TiDB Lightning reads the SQL dump in parallel, converts the data source to key-value pairs in the same encoding as TiDB, sorts the key-value pairs and writes them to a local temporary storage file. + +5. When an engine file is written, TiDB Lightning starts to split and schedule data on the target TiKV cluster, and then imports data to TiKV cluster. + + The engine file contains two types of engines: **data engine** and **index engine**. Each engine corresponds to a type of key-value pairs: row data and secondary index. Normally, row data is completely ordered in the data source, and the secondary index is unordered. Therefore, the data engine files are imported immediately after the corresponding block is written, and all index engine files are imported only after the entire table is encoded. + +6. After all engine files are imported, TiDB Lightning compares the checksum between the local data source and the downstream cluster, and ensures that the imported data is not corrupted. Then TiDB Lightning analyzes the new data (`ANALYZE`) to optimize the future operations. Meanwhile, `tidb-lightning` adjusts the `AUTO_INCREMENT` value to prevent conflicts in the future. + + The auto-increment ID is estimated by the **upper bound** of the number of rows, and is proportional to the total size of the table data file. Therefore, the auto-increment ID is usually larger than the actual number of rows. This is normal because the auto-increment ID [is not necessarily contiguous](/mysql-compatibility.md#auto-increment-id). + +7. After all steps are completed, TiDB Lightning automatically switches the TiKV nodes to "normal mode". If global scheduling is paused, TiDB Lightning also recovers global scheduling. After that, the TiDB cluster can provide services normally. + +## Requirements and restrictions + +### Environment requirements + +**Operating system**: + +It is recommended to use fresh CentOS 7 instances. You can deploy a virtual machine either on your local host or in the cloud. Because TiDB Lightning consumes as much CPU resources as needed by default, it is recommended that you deploy it on a dedicated server. If this is not possible, you can deploy it on a single server together with other TiDB components (for example, tikv-server) and then configure `region-concurrency` to limit the CPU usage from TiDB Lightning. Usually, you can configure the size to 75% of the logical CPU. + +**Memory and CPU**: + +It is recommended that you allocate CPU more than 32 cores and memory greater than 64 GiB to get better performance. + +> **Note:** +> +> When you import a large amount of data, one concurrent import may consume about 2 GiB memory. The total memory usage can be `region-concurrency * 2 GiB`. `region-concurrency` is the same as the number of logical CPUs by default. If the memory size (GiB) is less than twice of the CPU or OOM occurs during the import, you can decrease `region-concurrency` to avoid OOM. + +**Storage**: The `sorted-kv-dir` configuration item specifies the temporary storage directory for the sorted key-value files. The directory must be empty, and the storage space must be greater than the size of the dataset to be imported. For better import performance, it is recommended to use a directory different from `data-source-dir` and use flash storage and exclusive I/O for the directory. + +**Network**: A 10Gbps Ethernet card is recommended. + +### Version requirements + +- TiDB Lightning >= v4.0.3. +- TiDB >= v4.0.0. +- If the target TiDB cluster is v3.x or earlier, you need to use Importer-backend to complete the data import. In this mode, `tidb-lightning` needs to send the parsed key-value pairs to `tikv-importer` via gRPC, and `tikv-importer` will complete the data import. + +### Limitations + +- Do not use physical import mode to directly import data to TiDB clusters in production. It has severe performance implications. If you need to do so, refer to [Import data into a cluster in production](/tidb-lightning/tidb-lightning-physical-import-mode-usage.md#import-data-into-a-cluster-in-production). +- Do not use multiple TiDB Lightning instances to import data to the same TiDB cluster by default. Use [Parallel Import](/tidb-lightning/tidb-lightning-distributed-import.md) instead. +- When you use multiple TiDB Lightning to import data to the same target, do not mix the backends. That is, do not use physical import mode and logical import mode at the same time. +- A single Lightning process can import a single table of 10 TB at most. Parallel import can use 10 Lightning instances at most. + +### Tips for using with other components + +- When you use TiDB Lightning with TiFlash, note the following: + + - Whether you have created a TiFlash replica for a table, you can use TiDB Lightning to import data to the table. However, the import might take longer than the normal import. The import time is influenced by the network bandwidth of the server TiDB Lightning is deployed on, the CPU and disk load on the TiFlash node, and the number of TiFlash replicas. + +- TiDB Lightning character sets: + + - TiDB Lightning earlier than v5.4.0 cannot import tables of `charset=GBK`. + +- When you use TiDB Lightning with TiCDC, not the following: + + - TiCDC cannot capture the data inserted in physical import mode. diff --git a/tidb-limitations.md b/tidb-limitations.md index 994e27ac08103..083671216f456 100644 --- a/tidb-limitations.md +++ b/tidb-limitations.md @@ -75,3 +75,7 @@ This document describes the common usage limitations of TiDB, including the maxi | Type | Upper limit | |:----------|:----------| | The maximum number of SQL statements in a single transaction | When the optimistic transaction is used and the transaction retry is enabled, the default upper limit is 5000, which can be modified using [`stmt-count-limit`](/tidb-configuration-file.md#stmt-count-limit). | + +## Limitations on TiKV version + +In your cluster, if the version of the TiDB component is v6.2.0 or later, the version of TiKV must be v6.2.0 or later. diff --git a/tiflash/tiflash-configuration.md b/tiflash/tiflash-configuration.md index 5a21bc5a39169..a8be4fe6e2ae8 100644 --- a/tiflash/tiflash-configuration.md +++ b/tiflash/tiflash-configuration.md @@ -76,8 +76,9 @@ delta_index_cache_size = 0 ## DTFile format ## * format_version = 1, the old format, deprecated. ## * format_version = 2, the default format for versions < v6.0.0. - ## * format_version = 3, the default format for versions >= v6.0.0, which provides more data validation features. - # format_version = 3 + ## * format_version = 3, the default format for v6.0.0 and v6.1.x, which provides more data validation features. + ## * format_version = 4, the default format for v6.2.0 and later versions, which reduces write amplification and background task resource consumption + # format_version = 4 [storage.main] ## The list of directories to store the main data. More than 90% of the total data is stored in @@ -201,6 +202,11 @@ delta_index_cache_size = 0 # Compression level of the TiFlash storage engine. The default value is 1. It is recommended that you set this value to 1 if dt_compression_method is LZ4, -1 (smaller compression rate, but better read performance) or 1 if dt_compression_method is zstd, and 9 if dt_compression_method is LZ4HC. dt_compression_level = 1 + ## New in v6.2.0. Use the thread pool to handle read requests from the storage engine. The default value is false. + ## Warning: This is still an experimental feature. It is NOT recommended that you use it in the production environment. + + # dt_enable_read_thread = false + ## Security settings take effect starting from v4.0.5. [security] ## New in v5.0. This configuration item enables or disables log redaction. If the configuration value diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index f6c1b1415b17d..d9841619f730a 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -400,6 +400,7 @@ Configuration items related to storage. + When API V2 is used, you are expected to set `storage.enable-ttl = true` at the same time. Because API V2 supports the TTL feature, you must turn on `enable-ttl` explicitly. Otherwise, it will be in conflict because `storage.enable-ttl` defaults to `false`. + When API V2 is enabled, you need to deploy at least one tidb-server instance to reclaim expired data. Note that this tidb-server instance cannot provide read or write services. To ensure high availability, you can deploy multiple tidb-server instances. + Client support is required for API V2. For details, see the corresponding instruction of the client for the API V2. + + Since v6.2.0, Change Data Capture (CDC) for RawKV is supported using the component [TiKV-CDC](https://github.com/tikv/migration/tree/main/cdc). + Default value: `1` > **Warning:** @@ -1389,11 +1390,6 @@ Configuration items related to `rocksdb.defaultcf.titan`. + Determines whether to optimize the read performance. When `level-merge` is enabled, there is more write amplification. + Default value: `false` -### `gc-merge-rewrite` - -+ Determines whether to use the merge operator to write back blob indexes for Titan GC. When `gc-merge-rewrite` is enabled, it reduces the effect of Titan GC on the writes in the foreground. -+ Default value: `false` - ## raftdb Configuration items related to `raftdb` diff --git a/tispark-overview.md b/tispark-overview.md index 20e26063274ff..a5bb38450c9cb 100644 --- a/tispark-overview.md +++ b/tispark-overview.md @@ -41,6 +41,7 @@ The following table lists the compatibility information of the supported TiSpark | 2.4.x-scala_2.11 | 5.x, 4.x | 2.3.x, 2.4.x | 2.11 | | 2.4.x-scala_2.12 | 5.x, 4.x | 2.4.x | 2.12 | | 2.5.x | 5.x, 4.x | 3.0.x, 3.1.x | 2.12 | +| 3.0.x | 5.x, 4.x | 3.0.x, 3.1.x, 3.2.x | 2.12 | TiSpark runs in any Spark mode such as YARN, Mesos, and Standalone. diff --git a/tiup/tiup-component-cluster-scale-in.md b/tiup/tiup-component-cluster-scale-in.md index 4766f941bffb2..cf6406d7dac9f 100644 --- a/tiup/tiup-component-cluster-scale-in.md +++ b/tiup/tiup-component-cluster-scale-in.md @@ -43,13 +43,13 @@ tiup cluster scale-in [flags] ### --force -- Controls whether to forcibly remove the specified nodes from the cluster. Sometimes, the host of the node to take offline might be down, which makes it impossible to connect to the node via SSH for operations, so you can forcibly remove the node from the cluster using the `-force` option. +- Controls whether to forcibly remove the specified nodes from the cluster. Sometimes, the host of the node to take offline might be down, which makes it impossible to connect to the node via SSH for operations, so you can forcibly remove the node from the cluster using the `--force` option. - Data type: `BOOLEAN` - This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value. > **Warning:** > -> When you use this option to forcibly remove TiKV or TiFlash nodes that are in service or are pending offline, these nodes will be deleted immediately without waiting for data to be migrated. This imposes a high risk of data loss. Therefore, it is recommended to use this option only on down nodes. +> When you use this option to forcibly remove TiKV or TiFlash nodes that are in service or are pending offline, these nodes will be deleted immediately without waiting for data to be migrated. This imposes a very high risk of data loss. If data loss occurs in the region where the metadata is located, the entire cluster will be unavailable and unrecoverable. ### --transfer-timeout