From 5ba542ca4ca9794ed5982289903887bf7a232045 Mon Sep 17 00:00:00 2001 From: yikeke Date: Thu, 11 Jul 2019 13:07:02 +0800 Subject: [PATCH 1/7] *: fix markdownlint issues in all docs --- .circleci/config.yml | 2 +- .github/ISSUE_TEMPLATE/bug-report.md | 4 + .github/ISSUE_TEMPLATE/feature-request.md | 5 +- .github/ISSUE_TEMPLATE/question.md | 8 +- .markdownlint.yaml | 2 +- _index.md | 2 +- dev/benchmark/sysbench-v3.md | 2 +- dev/benchmark/sysbench.md | 8 +- dev/benchmark/tpcc.md | 2 +- dev/how-to/deploy/tidb-binlog.md | 8 +- .../deploy-tidb-from-kubernetes-dind.md | 2 +- dev/how-to/maintain/tidb-binlog.md | 2 +- dev/how-to/scale/with-ansible.md | 2 +- .../generate-self-signed-certificates.md | 4 +- dev/how-to/upgrade/from-previous-version.md | 2 +- .../language-structure/schema-object-names.md | 2 +- dev/reference/sql/statements/split-region.md | 4 +- dev/reference/tispark.md | 2 +- .../data-migration/cluster-operations.md | 2 +- .../tools/data-migration/skip-replace-sqls.md | 2 +- dev/reference/tools/loader.md | 4 +- dev/reference/tools/mydumper.md | 2 +- dev/reference/tools/sync-diff-inspector.md | 1 - .../transactions/transaction-pessimistic.md | 2 +- dev/releases/2.0.10.md | 2 +- dev/releases/2.1.8.md | 4 +- dev/releases/2.1ga.md | 2 +- dev/releases/3.0.0-beta.1.md | 2 +- dev/releases/3.0.0-rc.2.md | 2 +- v1.0/README.md | 22 +-- v1.0/benchmark/sysbench.md | 125 ++++++++-------- v1.0/op-guide/backup-restore.md | 24 ++- v1.0/op-guide/binary-deployment.md | 13 +- v1.0/op-guide/docker-deployment.md | 2 +- .../generate-self-signed-certificates.md | 30 ++-- v1.0/op-guide/migration-overview.md | 12 +- v1.0/op-guide/migration.md | 2 - v1.0/op-guide/monitor-overview.md | 3 - v1.0/op-guide/offline-ansible-deployment.md | 27 ++-- v1.0/op-guide/security.md | 15 +- v1.0/op-guide/tune-tikv.md | 13 +- v1.0/releases/rc3.md | 2 +- v1.0/releases/rc4.md | 12 +- v1.0/sql/admin.md | 6 +- v1.0/sql/cast-functions-and-operators.md | 3 - v1.0/sql/comment-syntax.md | 1 - v1.0/sql/connection-and-APIs.md | 5 +- v1.0/sql/datatype.md | 14 +- v1.0/sql/dml.md | 9 +- .../encryption-and-compression-functions.md | 1 - v1.0/sql/error.md | 1 - v1.0/sql/literal-value-bit-value.md | 1 - .../literal-value-date-and-time-literals.md | 2 +- v1.0/sql/literal-value-string-literals.md | 6 +- v1.0/sql/literal-values.md | 21 ++- v1.0/sql/mysql-compatibility.md | 6 +- v1.0/sql/numeric-functions-and-operators.md | 1 - v1.0/sql/precision-math.md | 1 - v1.0/sql/schema-object-names.md | 6 +- v1.0/sql/transaction-isolation.md | 3 - v1.0/sql/transaction.md | 21 ++- v1.0/sql/util.md | 2 +- v1.0/tools/loader.md | 22 +-- v1.0/tools/pd-control.md | 21 ++- v1.0/tools/syncer.md | 39 ++--- v1.0/tools/tidb-binlog-kafka.md | 26 ++-- v1.0/tools/tidb-binlog.md | 40 +++-- v1.0/trouble-shooting.md | 47 +++--- v2.0/README.md | 15 +- v2.0/benchmark/sysbench.md | 131 +++++++++-------- v2.0/op-guide/backup-restore.md | 24 ++- v2.0/op-guide/binary-deployment.md | 13 +- v2.0/op-guide/docker-deployment.md | 2 +- .../generate-self-signed-certificates.md | 30 ++-- v2.0/op-guide/migration-overview.md | 12 +- v2.0/op-guide/migration.md | 2 - v2.0/op-guide/monitor-overview.md | 3 - v2.0/op-guide/offline-ansible-deployment.md | 27 ++-- v2.0/op-guide/security.md | 15 +- v2.0/op-guide/tune-tikv.md | 13 +- v2.0/releases/rc3.md | 2 +- v2.0/releases/rc4.md | 12 +- v2.0/sql/admin.md | 6 +- v2.0/sql/cast-functions-and-operators.md | 3 - v2.0/sql/comment-syntax.md | 1 - v2.0/sql/connection-and-APIs.md | 5 +- v2.0/sql/datatype.md | 14 +- v2.0/sql/dml.md | 9 +- .../encryption-and-compression-functions.md | 1 - v2.0/sql/error.md | 1 - v2.0/sql/literal-value-bit-value.md | 1 - .../literal-value-date-and-time-literals.md | 2 +- v2.0/sql/literal-value-string-literals.md | 6 +- v2.0/sql/literal-values.md | 21 ++- v2.0/sql/mysql-compatibility.md | 8 +- v2.0/sql/numeric-functions-and-operators.md | 1 - v2.0/sql/precision-math.md | 1 - v2.0/sql/schema-object-names.md | 6 +- v2.0/sql/transaction-isolation.md | 3 - v2.0/sql/transaction.md | 23 ++- v2.0/sql/util.md | 2 +- v2.0/tools/loader.md | 22 +-- v2.0/tools/pd-control.md | 17 +-- v2.0/tools/syncer.md | 39 ++--- v2.0/tools/tidb-binlog-kafka.md | 28 ++-- v2.0/tools/tidb-binlog.md | 40 +++-- v2.0/trouble-shooting.md | 41 +++--- v2.1-legacy/benchmark/sysbench-v2.md | 14 +- v2.1-legacy/benchmark/sysbench-v3.md | 4 +- v2.1-legacy/benchmark/sysbench.md | 39 +++-- v2.1-legacy/media/tidb-lightning.svg | 2 +- .../ansible-deployment-rolling-update.md | 8 +- .../op-guide/ansible-deployment-scale.md | 8 +- v2.1-legacy/op-guide/cross-dc-deployment.md | 1 - v2.1-legacy/op-guide/docker-compose.md | 2 +- .../generate-self-signed-certificates.md | 14 +- v2.1-legacy/op-guide/migration.md | 2 - .../op-guide/offline-ansible-deployment.md | 16 +- v2.1-legacy/op-guide/tune-tikv.md | 5 +- v2.1-legacy/overview.md | 2 +- v2.1-legacy/releases/2.0.10.md | 2 +- v2.1-legacy/releases/2.1ga.md | 6 +- v2.1-legacy/releases/21rc4.md | 40 ++--- v2.1-legacy/releases/rc3.md | 2 +- v2.1-legacy/releases/rc4.md | 10 +- v2.1-legacy/sql/admin.md | 2 +- v2.1-legacy/sql/datatype.md | 4 +- .../encryption-and-compression-functions.md | 1 - v2.1-legacy/sql/literal-value-bit-value.md | 1 - .../literal-value-date-and-time-literals.md | 2 +- v2.1-legacy/sql/literal-values.md | 21 ++- v2.1-legacy/sql/schema-object-names.md | 4 +- v2.1-legacy/tools/loader.md | 10 +- v2.1-legacy/tools/mydumper.md | 2 +- v2.1-legacy/tools/sync-diff-inspector.md | 11 +- v2.1-legacy/tools/syncer.md | 32 ++-- v2.1-legacy/tools/tidb-binlog-cluster.md | 36 ++--- v2.1-legacy/tools/tidb-binlog-kafka.md | 4 +- v2.1-legacy/tools/tidb-binlog-monitor.md | 6 +- v2.1-legacy/tools/tidb-binlog.md | 33 ++--- v2.1-legacy/trouble-shooting.md | 39 +++-- v2.1/benchmark/sysbench-v2.md | 14 +- v2.1/benchmark/sysbench-v3.md | 4 +- v2.1/benchmark/sysbench.md | 37 +++-- .../deploy/data-migration-with-ansible.md | 9 +- .../deploy/geographic-redundancy/overview.md | 1 - .../deploy/orchestrated/offline-ansible.md | 2 +- v2.1/how-to/deploy/tidb-binlog.md | 4 +- v2.1/how-to/get-started/tidb-binlog.md | 4 +- v2.1/how-to/get-started/tispark.md | 6 +- v2.1/how-to/maintain/tidb-binlog.md | 2 +- v2.1/how-to/migrate/from-aurora.md | 10 +- .../migrate/incrementally-from-mysql.md | 1 - v2.1/how-to/scale/with-ansible.md | 10 +- .../generate-self-signed-certificates.md | 14 +- v2.1/how-to/troubleshoot/cluster-setup.md | 36 ++--- v2.1/how-to/upgrade/from-previous-version.md | 2 +- .../upgrade/rolling-updates-with-ansible.md | 8 +- v2.1/overview.md | 4 +- .../tidb-server/mysql-variables.md | 18 +-- v2.1/reference/performance/tune-tikv.md | 21 ++- .../encryption-and-compression-functions.md | 1 - .../sql/language-structure/literal-values.md | 21 ++- .../language-structure/schema-object-names.md | 6 +- v2.1/reference/sql/statements/admin.md | 4 +- v2.1/reference/sql/statements/begin.md | 1 - .../reference/sql/statements/change-column.md | 7 +- v2.1/reference/sql/statements/create-index.md | 3 +- v2.1/reference/sql/statements/drop-column.md | 3 +- v2.1/reference/sql/statements/drop-user.md | 3 +- v2.1/reference/tidb-binlog-overview.md | 2 +- v2.1/reference/tispark.md | 17 +-- .../data-migration/cluster-operations.md | 19 +-- .../tools/data-migration/dm-upgrade.md | 30 ++-- .../tools/data-migration/features/overview.md | 11 +- .../tools/data-migration/from-aurora.md | 12 +- .../reference/tools/data-migration/monitor.md | 4 +- .../tools/data-migration/overview.md | 2 +- .../tools/data-migration/skip-replace-sqls.md | 74 +++++----- v2.1/reference/tools/loader.md | 22 +-- v2.1/reference/tools/mydumper.md | 2 +- v2.1/reference/tools/sync-diff-inspector.md | 3 +- v2.1/reference/tools/syncer.md | 7 +- .../tools/tidb-binlog/tidb-binlog-kafka.md | 2 +- .../tools/tidb-binlog/tidb-binlog-local.md | 29 ++-- .../tools/tidb-lightning/deployment.md | 2 +- .../reference/tools/tidb-lightning/monitor.md | 8 +- v2.1/reference/tools/tikv-control.md | 2 - v2.1/releases/2.0.10.md | 2 +- v2.1/releases/2.1.11.md | 1 - v2.1/releases/2.1.3.md | 1 - v2.1/releases/2.1.8.md | 4 +- v2.1/releases/2.1ga.md | 6 +- v2.1/releases/21rc4.md | 40 ++--- v2.1/releases/3.0.0-beta.1.md | 40 ++--- v2.1/releases/3.0.0-rc.2.md | 8 +- v2.1/releases/rc3.md | 2 +- v2.1/releases/rc4.md | 12 +- v3.0/benchmark/sysbench-v2.md | 14 +- v3.0/benchmark/sysbench-v3.md | 4 +- v3.0/benchmark/sysbench.md | 37 +++-- v3.0/benchmark/tpcc.md | 2 +- v3.0/faq/tidb-in-kubernetes.md | 4 +- .../deploy/data-migration-with-ansible.md | 9 +- .../deploy/geographic-redundancy/overview.md | 1 - .../deploy/orchestrated/offline-ansible.md | 2 +- .../tidb-in-kubernetes/access-tidb.md | 2 +- .../tidb-in-kubernetes/aws-eks.md | 24 +-- v3.0/how-to/deploy/tidb-binlog.md | 4 +- .../deploy-tidb-from-docker-compose.md | 2 +- .../deploy-tidb-from-kubernetes-dind.md | 2 +- v3.0/how-to/get-started/tidb-binlog.md | 4 +- v3.0/how-to/get-started/tispark.md | 6 +- v3.0/how-to/maintain/identify-slow-queries.md | 4 +- v3.0/how-to/maintain/tidb-binlog.md | 2 +- .../maintain/tidb-in-kubernetes/tidb-node.md | 44 +++--- v3.0/how-to/migrate/from-aurora.md | 9 +- .../migrate/incrementally-from-mysql.md | 1 - v3.0/how-to/scale/tidb-in-kubernetes.md | 4 +- v3.0/how-to/scale/with-ansible.md | 10 +- .../generate-self-signed-certificates.md | 16 +- v3.0/how-to/troubleshoot/cluster-setup.md | 35 +++-- v3.0/how-to/upgrade/from-previous-version.md | 2 +- .../upgrade/rolling-updates-with-ansible.md | 8 +- v3.0/how-to/upgrade/tidb-in-kubernetes.md | 4 +- v3.0/overview.md | 4 +- .../backup-configuration.md | 8 +- .../tikv-server/configuration-file.md | 17 ++- v3.0/reference/performance/tune-tikv.md | 21 ++- .../encryption-and-compression-functions.md | 1 - .../sql/language-structure/literal-values.md | 21 ++- .../language-structure/schema-object-names.md | 6 +- v3.0/reference/sql/statements/admin.md | 4 +- v3.0/reference/sql/statements/begin.md | 1 - .../reference/sql/statements/change-column.md | 7 +- v3.0/reference/sql/statements/create-index.md | 3 +- v3.0/reference/sql/statements/drop-column.md | 3 +- v3.0/reference/sql/statements/drop-user.md | 3 +- v3.0/reference/sql/statements/split-region.md | 4 +- v3.0/reference/tidb-binlog-overview.md | 2 +- v3.0/reference/tispark.md | 18 +-- .../data-migration/cluster-operations.md | 19 +-- .../tools/data-migration/dm-upgrade.md | 30 ++-- .../tools/data-migration/features/overview.md | 11 +- .../tools/data-migration/from-aurora.md | 12 +- .../reference/tools/data-migration/monitor.md | 4 +- .../tools/data-migration/overview.md | 4 +- .../tools/data-migration/skip-replace-sqls.md | 138 +++++++++--------- v3.0/reference/tools/loader.md | 22 +-- v3.0/reference/tools/mydumper.md | 2 +- v3.0/reference/tools/sync-diff-inspector.md | 3 +- v3.0/reference/tools/syncer.md | 7 +- .../tools/tidb-binlog/tidb-binlog-kafka.md | 10 +- .../tools/tidb-binlog/tidb-binlog-local.md | 29 ++-- .../tools/tidb-lightning/deployment.md | 12 +- .../reference/tools/tidb-lightning/monitor.md | 10 +- v3.0/reference/tools/tikv-control.md | 2 - .../transactions/transaction-pessimistic.md | 4 +- v3.0/releases/2.0.10.md | 4 +- v3.0/releases/2.1.11.md | 1 - v3.0/releases/2.1.3.md | 9 +- v3.0/releases/2.1.8.md | 14 +- v3.0/releases/2.1ga.md | 18 +-- v3.0/releases/21rc4.md | 40 ++--- v3.0/releases/3.0.0-beta.1.md | 38 ++--- v3.0/releases/3.0.0-rc.2.md | 8 +- v3.0/releases/rc3.md | 2 +- v3.0/releases/rc4.md | 12 +- 268 files changed, 1527 insertions(+), 1619 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3b23cfb19d6..815fdbb225c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ jobs: command: | sudo npm install -g markdownlint-cli markdownlint --version - + - run: name: "Lint dev" command: markdownlint dev/ diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index d158793d3bc5..aafaced030f3 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -3,6 +3,10 @@ name: "\U0001F41B Bug Report" about: Typo, Grammatical error, etc.。 --- + + + + ## Bug 报告 **This repository is ONLY used to solve problems related to DOCS-CN. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 50692bca9d0a..8b684e1725c3 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -3,8 +3,11 @@ name: "\U0001F680 Feature Request" about: Any suggestion? Want to add something new? --- -## Feature Request + + + +## Feature Request **This repository is ONLY used to solve problems related to DOCS-CN. For other issues (TiDB, TiKV, etc), please move to [other repositories](https://github.com/pingcap/).** diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index d5d10a6d32f5..093fb2da55b1 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -3,10 +3,12 @@ name: "\U0001F914 Question" about: Usage question that isn't answered in docs or discussion --- + + ## Question **This repository is ONLY used to solve problems related to DOCS-CN. -For other issues (TiDB, TiKV, etc), please move to [other repositories](https://github.com/pingcap/).** +For other issues (TiDB, TiKV, etc), please move to [other repositories](https://github.com/pingcap/).** @@ -19,6 +21,6 @@ Before asking a question, make sure you have: - Searched open and closed [GitHub issues](https://github.com/pingcap/docs-cn/issues?utf8=%E2%9C%93&q=is%3Aissue). - Read the documentation: + - [TiDB Doc](https://github.com/pingcap/docs) + - [TiDB Doc-cn](https://github.com/pingcap/docs-cn) - - [TiDB Doc](https://github.com/pingcap/docs) - - [TiDB Doc-cn](https://github.com/pingcap/docs-cn) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index ef8945ef538d..3143e254b364 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -16,7 +16,7 @@ no-missing-space-atx: true no-multiple-space-atx: true blanks-around-headings: true heading-start-left: true -no-duplicate-heading: +no-duplicate-heading: siblings_only: true single-title: front_matter_title: '' diff --git a/_index.md b/_index.md index ae6d37ef8baa..63e9c03182e4 100755 --- a/_index.md +++ b/_index.md @@ -10,7 +10,7 @@ TiDB 是 PingCAP 公司设计的开源分布式 HTAP (Hybrid Transactional and A TiDB 具备如下特性: - 高度兼容 MySQL - + [大多数情况下](/v3.0/reference/mysql-compatibility.md),无需修改代码即可从 MySQL 轻松迁移至 TiDB,分库分表后的 MySQL 集群亦可通过 TiDB 工具进行实时迁移。 - 水平弹性扩展 diff --git a/dev/benchmark/sysbench-v3.md b/dev/benchmark/sysbench-v3.md index a330e35a120c..35270f2451c3 100644 --- a/dev/benchmark/sysbench-v3.md +++ b/dev/benchmark/sysbench-v3.md @@ -26,7 +26,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD \* 1 | +| DISK | Optane 500GB SSD \* 1 | Sysbench 版本:1.1.0 diff --git a/dev/benchmark/sysbench.md b/dev/benchmark/sysbench.md index 133bda389433..c35585687b9e 100644 --- a/dev/benchmark/sysbench.md +++ b/dev/benchmark/sysbench.md @@ -49,7 +49,7 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB +) ENGINE=InnoDB ``` 部署方案以及配置参数 @@ -59,7 +59,7 @@ CREATE TABLE `sbtest` ( 172.16.20.4 4*tikv 1*tidb 1*sysbench 172.16.20.6 4*tikv 1*tidb 1*sysbench 172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench // 每个物理节点有三块盘: data3: 2 tikv (Optane SSD) @@ -89,8 +89,8 @@ Mysql version: 5.6.37 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql max_connections = 2000 ``` diff --git a/dev/benchmark/tpcc.md b/dev/benchmark/tpcc.md index e8dc0a3ee658..569144c2b6b3 100644 --- a/dev/benchmark/tpcc.md +++ b/dev/benchmark/tpcc.md @@ -26,7 +26,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5TB SSD \* 2 | +| DISK | 1.5TB SSD \* 2 | 本文使用开源的 BenchmarkSQL 5.0 作为 TPC-C 测试工具并添加对 MySQL 协议支持, 可以通过以下命令下载测试程序: diff --git a/dev/how-to/deploy/tidb-binlog.md b/dev/how-to/deploy/tidb-binlog.md index 15950c05249d..55e8626a5250 100644 --- a/dev/how-to/deploy/tidb-binlog.md +++ b/dev/how-to/deploy/tidb-binlog.md @@ -82,9 +82,9 @@ category: reference 参照上文配置完 `inventory.ini` 文件后,从以下两种方式中选择一种进行部署。 **方式一**:在已有的 TiDB 集群上增加 Pump 组件,需按以下步骤逐步进行。 - + 1. 部署 pump_servers 和 node_exporters - + ``` ansible-playbook deploy.yml -l ${pump1_ip},${pump2_ip},[${alias1_name},${alias2_name}] ``` @@ -336,7 +336,7 @@ Drainer="192.168.0.13" ```bash ./bin/pump -config pump.toml ``` - + 如果命令行参数与配置文件中的参数重合,则使用命令行设置的参数的值。 2. 使用 binary 部署 Drainer @@ -474,7 +474,7 @@ Drainer="192.168.0.13" # topic-name = "" ``` - - 启动示例 + - 启动示例 > **注意:** > diff --git a/dev/how-to/get-started/deploy-tidb-from-kubernetes-dind.md b/dev/how-to/get-started/deploy-tidb-from-kubernetes-dind.md index 817fb3e78b3d..b024fa58125d 100644 --- a/dev/how-to/get-started/deploy-tidb-from-kubernetes-dind.md +++ b/dev/how-to/get-started/deploy-tidb-from-kubernetes-dind.md @@ -427,7 +427,7 @@ demo-tikv-2 1/1 Running 0 1m mkdir -p /home/tidb/demo && \ helm inspect values pingcap/tidb-cluster --version=${chartVersion} > /home/tidb/demo/values-demo.yaml ``` - + 2. 编辑 `/home/tidb/demo/values-demo.yaml`。 例如,要扩容集群,可以将 TiKV `replicas` 从 3 修改为 5,或者将 TiDB `replicas` 从 2 修改为 3。 diff --git a/dev/how-to/maintain/tidb-binlog.md b/dev/how-to/maintain/tidb-binlog.md index 7aef614c4f26..d09bc058dbdd 100644 --- a/dev/how-to/maintain/tidb-binlog.md +++ b/dev/how-to/maintain/tidb-binlog.md @@ -116,7 +116,7 @@ Usage of binlogctl: ``` - 修改 Pump/Drainer 的状态 - + 设置 `cmd` 为 `update-pump` 或者 `update-drainer` 来更新 Pump 或者 Drainer 的状态。Pump 和 Drainer 的状态可以为:online,pausing,paused,closing 以及 offline。例如: {{< copyable "shell-regular" >}} diff --git a/dev/how-to/scale/with-ansible.md b/dev/how-to/scale/with-ansible.md index 802d8d72dec3..fb635fff7e20 100644 --- a/dev/how-to/scale/with-ansible.md +++ b/dev/how-to/scale/with-ansible.md @@ -117,7 +117,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 例如,如果要添加一个 PD 节点(node103),IP 地址为 172.16.10.103,可以进行如下操作: -1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: +1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: ```ini [tidb_servers] diff --git a/dev/how-to/secure/generate-self-signed-certificates.md b/dev/how-to/secure/generate-self-signed-certificates.md index 5e1fc328a7f3..b6dd089c532b 100644 --- a/dev/how-to/secure/generate-self-signed-certificates.md +++ b/dev/how-to/secure/generate-self-signed-certificates.md @@ -54,7 +54,7 @@ cfssl print-defaults csr > ca-csr.json ### 配置 CA 选项 -根据实际需求修改 `ca-config.json`: +根据实际需求修改 `ca-config.json`: ```json { @@ -85,7 +85,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { diff --git a/dev/how-to/upgrade/from-previous-version.md b/dev/how-to/upgrade/from-previous-version.md index 6c6003f5527f..d960f2864697 100644 --- a/dev/how-to/upgrade/from-previous-version.md +++ b/dev/how-to/upgrade/from-previous-version.md @@ -115,7 +115,7 @@ $ ansible-playbook local_prepare.yml > > 为优化 TiDB 集群组件的运维管理,TiDB 3.0 版本对 `systemd` 模式下的 `PD service` 名称进行了调整。与之前版本相比,滚动升级 TiDB 3.0 版本集群组件的操作略有不同,注意升级前后 `process_supervision` 参数配置须保持一致。 -如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 +如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 ``` $ ansible-playbook excessive_rolling_update.yml diff --git a/dev/reference/sql/language-structure/schema-object-names.md b/dev/reference/sql/language-structure/schema-object-names.md index 62cf45271065..8bbfc292072a 100644 --- a/dev/reference/sql/language-structure/schema-object-names.md +++ b/dev/reference/sql/language-structure/schema-object-names.md @@ -60,7 +60,7 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: diff --git a/dev/reference/sql/statements/split-region.md b/dev/reference/sql/statements/split-region.md index 8635d2544c2e..24181192ce10 100644 --- a/dev/reference/sql/statements/split-region.md +++ b/dev/reference/sql/statements/split-region.md @@ -160,7 +160,7 @@ SPLIT TABLE t INDEX idx3 BETWEEN ("2010-01-01 00:00:00", "a") AND ("2010-01-01 0 {{< copyable "sql" >}} ```sql -SPLIT TABLE t1 INDEX idx4 ("a", "2000-01-01 00:00:01"), ("b", "2019-04-17 14:26:19"), ("c", ""); +SPLIT TABLE t1 INDEX idx4 ("a", "2000-01-01 00:00:01"), ("b", "2019-04-17 14:26:19"), ("c", ""); ``` 该语句指定了 3 个值,会切分出 4 个 Region,每个 Region 的范围如下。 @@ -193,7 +193,7 @@ create table t (a int, b int,index idx1(a)) shard_row_id_bits = 4 pre_split_regi 4 个 table Region 的范围区间如下: ``` -region1: [ -inf , 1<<61 ) +region1: [ -inf , 1<<61 ) region2: [ 1<<61 , 2<<61 ) region3: [ 2<<61 , 3<<61 ) region4: [ 3<<61 , +inf ) diff --git a/dev/reference/tispark.md b/dev/reference/tispark.md index 374b946eeaa4..9f7c1e9d278f 100644 --- a/dev/reference/tispark.md +++ b/dev/reference/tispark.md @@ -304,7 +304,7 @@ TiSpark 可以使用 TiDB 的统计信息: 统计信息将在 Spark Driver 进行缓存,请确定 Driver 内存足够缓存统计信息。 可以在`spark-defaults.conf`中开启或关闭统计信息读取: - + | Property Name | Default | Description | -------- | -----: | :----: | | spark.tispark.statistics.auto_load | true | 是否默认进行统计信息读取 | diff --git a/dev/reference/tools/data-migration/cluster-operations.md b/dev/reference/tools/data-migration/cluster-operations.md index 6fb4156392ad..cd6fafdf057f 100644 --- a/dev/reference/tools/data-migration/cluster-operations.md +++ b/dev/reference/tools/data-migration/cluster-operations.md @@ -253,7 +253,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 为中控机设置 SSH 互信以及 sudo 规则。 - 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 ```bash $ cd /home/tidb/dm-ansible diff --git a/dev/reference/tools/data-migration/skip-replace-sqls.md b/dev/reference/tools/data-migration/skip-replace-sqls.md index 8f131c24b444..bac950d29f64 100644 --- a/dev/reference/tools/data-migration/skip-replace-sqls.md +++ b/dev/reference/tools/data-migration/skip-replace-sqls.md @@ -591,7 +591,7 @@ err:Error 1105: can't drop column c2 with index covered now args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" - sharding:true + sharding:true with key ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`; ``` diff --git a/dev/reference/tools/loader.md b/dev/reference/tools/loader.md index a172940cefda..f40050ed4cff 100644 --- a/dev/reference/tools/loader.md +++ b/dev/reference/tools/loader.md @@ -33,7 +33,7 @@ Loader 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/referen 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -125,7 +125,7 @@ port = 4000 ## FAQ ### 合库合表场景案例说明 - + 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 diff --git a/dev/reference/tools/mydumper.md b/dev/reference/tools/mydumper.md index 0ec84ba6852a..5f413a2be20f 100644 --- a/dev/reference/tools/mydumper.md +++ b/dev/reference/tools/mydumper.md @@ -15,7 +15,7 @@ mydumper 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/refer ## 相比于普通的 mydumper,此工具有哪些改进之处? + 使用 `tidb_snapshot` 而非 `FLUSH TABLES WITH READ LOCK` 提供备份一致性 -+ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ++ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ### 新添参数 diff --git a/dev/reference/tools/sync-diff-inspector.md b/dev/reference/tools/sync-diff-inspector.md index ec622ec13593..acf702a49a3e 100644 --- a/dev/reference/tools/sync-diff-inspector.md +++ b/dev/reference/tools/sync-diff-inspector.md @@ -171,7 +171,6 @@ schema = "test" # 需要检查的表的名称 tables = ["test"] - # 配置该表对应的分表的相关配置 [[table-config]] # 目标库的名称 diff --git a/dev/reference/transactions/transaction-pessimistic.md b/dev/reference/transactions/transaction-pessimistic.md index 3e189d878793..ec2bc1ae9a9c 100644 --- a/dev/reference/transactions/transaction-pessimistic.md +++ b/dev/reference/transactions/transaction-pessimistic.md @@ -67,7 +67,7 @@ default = true - 其次是 session 变量 `tidb_txn_mode`。 -- 最后是配置文件里的 `default`,当使用普通的 `BEGIN` 语句,且 `tidb_txn_mode` 的值为空字符串 `''` 时,根据 `default` 来决定启用悲观事务还是乐观事务。 +- 最后是配置文件里的 `default`,当使用普通的 `BEGIN` 语句,且 `tidb_txn_mode` 的值为空字符串 `''` 时,根据 `default` 来决定启用悲观事务还是乐观事务。 ## 相关配置参数 diff --git a/dev/releases/2.0.10.md b/dev/releases/2.0.10.md index 2c5994e26218..0b47d0a741e4 100644 --- a/dev/releases/2.0.10.md +++ b/dev/releases/2.0.10.md @@ -23,7 +23,7 @@ category: Releases - 修复统计信息某些情况下对点查估算的问题 [#8493](https://github.com/pingcap/tidb/pull/8493) - 修复某些情况下返回 Enum 默认值为字符串导致的 panic [#8476](https://github.com/pingcap/tidb/pull/8476) - 修复在宽表场景下,占用太多内存的问题 [#8467](https://github.com/pingcap/tidb/pull/8467) -- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) +- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) - 修复某些情况下添加外键约束导致的 panic 问题 [#8421](https://github.com/pingcap/tidb/pull/8421),[#8410](https://github.com/pingcap/tidb/pull/8410) - 修复 `YEAR` 类型错误转换零值的问题 [#8396](https://github.com/pingcap/tidb/pull/8396) - 修复 `VALUES` 函数在参数不为列的时候 panic 的问题 [#8404](https://github.com/pingcap/tidb/pull/8404) diff --git a/dev/releases/2.1.8.md b/dev/releases/2.1.8.md index a2dc8095aa9b..6856212e6301 100644 --- a/dev/releases/2.1.8.md +++ b/dev/releases/2.1.8.md @@ -28,7 +28,7 @@ TiDB-Ansible 版本:2.1.8 - 统一日志格式规范,利于工具收集分析 [日志规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md) - 修复大量 NULL 值导致统计信息估算不准确的问题 [#9979](https://github.com/pingcap/tidb/pull/9979) - 修复 TIMESTAMP 类型默认值为边界值的时候报错的问题 [#9987](https://github.com/pingcap/tidb/pull/9987) -- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) +- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) - 支持时间格式 `2019.01.01` [#10001](https://github.com/pingcap/tidb/pull/10001) - 修复某些情况下 `EXPLAIN` 结果中行数估计错误显示的问题 [#10044](https://github.com/pingcap/tidb/pull/10044) - 修复 `KILL TIDB [session id]` 某些情况下无法快速停止语句执行的问题 [#9976](https://github.com/pingcap/tidb/pull/9976) @@ -45,7 +45,7 @@ TiDB-Ansible 版本:2.1.8 ## TiKV - 修复读流量统计错误的问题 [#4441](https://github.com/tikv/tikv/pull/4441) -- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) +- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) - 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) ## Tools diff --git a/dev/releases/2.1ga.md b/dev/releases/2.1ga.md index 3ba5b2bfaa74..84942b00400e 100644 --- a/dev/releases/2.1ga.md +++ b/dev/releases/2.1ga.md @@ -46,7 +46,7 @@ category: Releases + 支持内建函数: - - `json_contains` + - `json_contains` - `json_contains_path` - `encode/decode` diff --git a/dev/releases/3.0.0-beta.1.md b/dev/releases/3.0.0-beta.1.md index b4fb665aad77..9bd66e5f5385 100644 --- a/dev/releases/3.0.0-beta.1.md +++ b/dev/releases/3.0.0-beta.1.md @@ -73,7 +73,7 @@ TiDB-Ansible 版本:3.0.0-beta.1 + 增加 store 地址为维度的监控项,代替原有的 Store ID [#1429](https://github.com/pingcap/pd/pull/1429) + 优化 `GetStores` 开销,加快 Region 巡检周期 [#1410](https://github.com/pingcap/pd/pull/1410) + 新增删除 Tombstone Store 的接口 [#1472](https://github.com/pingcap/pd/pull/1472) - + ## TiKV + 优化 Coprocessor 计算执行框架,完成 TableScan 算子,单 TableScan 即扫表操作性能提升 5% ~ 30% diff --git a/dev/releases/3.0.0-rc.2.md b/dev/releases/3.0.0-rc.2.md index 278598b8ee00..930f646c735c 100644 --- a/dev/releases/3.0.0-rc.2.md +++ b/dev/releases/3.0.0-rc.2.md @@ -66,7 +66,7 @@ TiDB Ansible 版本:3.0.0-rc.2 - 主动下发 operator 加快调度速度 [#1536](https://github.com/pingcap/pd/pull/1536) - 添加 store limit 机制,限制单个 store 的调度速度 [#1474](https://github.com/pingcap/pd/pull/1474) - 修复 `config` 状态不一致的问题 [#1476](https://github.com/pingcap/pd/pull/1476) - + ## TiKV + Engine diff --git a/v1.0/README.md b/v1.0/README.md index 7557cc08a134..18d8683a8093 100755 --- a/v1.0/README.md +++ b/v1.0/README.md @@ -1,11 +1,13 @@ # TiDB 中文技术文档 + + ## 目录 + TiDB 简介与整体架构 - [TiDB 简介](overview.md#tidb-简介) - [TiDB 整体架构](overview.md#tidb-整体架构) -- [TiDB 快速入门指南](QUICKSTART.md) ++ [TiDB 快速入门指南](QUICKSTART.md) + TiDB 用户文档 + TiDB 数据库管理 - [TiDB 服务](sql/tidb-server.md) @@ -73,7 +75,7 @@ - [历史数据回溯](op-guide/history-read.md) + TiDB 运维文档 - [软硬件环境需求](op-guide/recommendation.md) - + 部署集群  + + 部署集群 - [Ansible 部署方案(强烈推荐)](op-guide/ansible-deployment.md) - [离线 Ansible 部署方案](op-guide/offline-ansible-deployment.md) - [Docker 部署方案](op-guide/docker-deployment.md) @@ -108,10 +110,10 @@ + TiSpark 文档 - [TiSpark 快速入门指南](tispark/tispark-quick-start-guide.md) - [TiSpark 用户指南](tispark/tispark-user-guide.md) -- [常见问题与解答(FAQ)](FAQ.md) -- [最佳实践](https://pingcap.com/blog-cn/tidb-best-practice/) -- [版本发布历史](releases/README.md) -- [TiDB 路线图](https://github.com/pingcap/docs-cn/blob/master/ROADMAP.md) ++ [常见问题与解答(FAQ)](FAQ.md) ++ [最佳实践](https://pingcap.com/blog-cn/tidb-best-practice/) ++ [版本发布历史](releases/README.md) ++ [TiDB 路线图](https://github.com/pingcap/docs-cn/blob/master/ROADMAP.md) + 用户案例 - [海航](http://t.cn/REXx0Qe) - [Mobike](http://t.cn/RT8FbP6) @@ -137,8 +139,6 @@ - [Weekly](https://pingcap.com/weekly/) - [英文文档](https://pingcap.com/docs) - - ## TiDB 简介 TiDB 是 PingCAP 公司受 Google [Spanner](http://research.google.com/archive/spanner.html) / [F1](http://research.google.com/pubs/pub41344.html) 论文启发而设计的开源分布式 NewSQL 数据库。 @@ -195,14 +195,14 @@ TiKV Server 负责存储数据,从外部看 TiKV 是一个分布式的提供 高可用是 TiDB 的另一大特点,TiDB/TiKV/PD 这三个组件都能容忍部分实例失效,不影响整个集群的可用性。下面分别说明这三个组件的可用性、单个实例失效后的后果以及如何恢复。 -+ TiDB ++ TiDB TiDB 是无状态的,推荐至少部署两个实例,前端通过负载均衡组件对外提供服务。当单个实例失效时,会影响正在这个实例上进行的 Session,从应用的角度看,会出现单次请求失败的情况,重新连接后即可继续获得服务。单个实例失效后,可以重启这个实例或者部署一个新的实例。 -+ PD ++ PD PD 是一个集群,通过 Raft 协议保持数据的一致性,单个实例失效时,如果这个实例不是 Raft 的 leader,那么服务完全不受影响;如果这个实例是 Raft 的 leader,会重新选出新的 Raft leader,自动恢复服务。PD 在选举的过程中无法对外提供服务,这个时间大约是3秒钟。推荐至少部署三个 PD 实例,单个实例失效后,重启这个实例或者添加新的实例。 -+ TiKV ++ TiKV TiKV 是一个集群,通过 Raft 协议保持数据的一致性(副本数量可配置,默认保存三副本),并通过 PD 做负载均衡调度。单个节点失效时,会影响这个节点上存储的所有 Region。对于 Region 中的 Leader 节点,会中断服务,等待重新选举;对于 Region 中的 Follower 节点,不会影响服务。当某个 TiKV 节点失效,并且在一段时间内(默认 10 分钟)无法恢复,PD 会将其上的数据迁移到其他的 TiKV 节点上。 diff --git a/v1.0/benchmark/sysbench.md b/v1.0/benchmark/sysbench.md index d116a4e79905..f8e206edd487 100755 --- a/v1.0/benchmark/sysbench.md +++ b/v1.0/benchmark/sysbench.md @@ -1,47 +1,47 @@ --- title: TiDB Sysbench 性能测试报告 - v1.0.0 -category: benchmark +category: benchmark draft: true ---- +--- # TiDB Sysbench 性能测试报告 - v1.0.0 ## 测试目的 + 测试 TiDB 在 OLTP 场景下的性能以及水平扩展能力。 > **注意:** > > 不同的测试环境可能使测试结果发生改变。 -## 测试版本、时间、地点 +## 测试版本、时间、地点 -TiDB 版本:v1.0.0 +TiDB 版本:v1.0.0 时间:2017 年 10 月 20 日 -地点:北京 +地点:北京 ## 测试环境 - - IDC机器 - + + IDC机器 + | 类别 | 名称 | | :--------: | :---------: | | OS | linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5T SSD * 2 + Optane SSD * 1 | - -Sysbench 版本: 1.0.6 +| DISK | 1.5T SSD \* 2 + Optane SSD * 1 | -测试脚本: https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench +Sysbench 版本: 1.0.6 +测试脚本: ## 测试方案 ### 场景一:sysbench 标准性能测试 -测试表结构 +测试表结构: -``` +``` CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned NOT NULL DEFAULT '0', @@ -49,26 +49,27 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB -``` - -部署方案以及配置参数 -``` +) ENGINE=InnoDB +``` + +部署方案以及配置参数: + +``` // TiDB 部署方案 -172.16.20.4 4*tikv 1*tidb 1*sysbench -172.16.20.6 4*tikv 1*tidb 1*sysbench -172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.20.4 4*tikv 1*tidb 1*sysbench +172.16.20.6 4*tikv 1*tidb 1*sysbench +172.16.20.7 4*tikv 1*tidb 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench -// 每个物理节点有三块盘: -data3: 2 tikv (Optane SSD) -data2: 1 tikv -data1: 1 tikv +// 每个物理节点有三块盘: +data3: 2 tikv (Optane SSD) +data2: 1 tikv +data1: 1 tikv -// TiKV 参数配置 +// TiKV 参数配置 sync-log = false grpc-concurrency = 8 -grpc-raft-conn-num = 24 +grpc-raft-conn-num = 24 [defaultcf] block-cache-size = "12GB" [writecf] @@ -78,22 +79,22 @@ block-cache-size = "2GB" // Mysql 部署方案 // 分别使用半同步复制和异步复制,部署两副本 -172.16.20.4 master -172.16.20.6 slave +172.16.20.4 master +172.16.20.6 slave 172.16.20.7 slave -172.16.10.8 1*sysbench +172.16.10.8 1*sysbench Mysql version: 5.6.37 // Mysql 参数配置 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql -max_connections = 2000 -``` +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql +max_connections = 2000 +``` -* 标准 oltp 测试 +* 标准 oltp 测试 | - | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | @@ -108,11 +109,11 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 1902 | 38045 | 134.56 ms / 363.18 ms | | Mysql | 32 | 1000 万 | 256 | 1770 | 35416 | 144.55 ms / 383.33 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) +![threads_oltp](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) +![table_size_oltp](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) -* 标准 select 测试 +* 标准 select 测试 | - | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -127,9 +128,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 386866 | 0.66 ms / 1.64 ms | | Mysql | 32 | 1000 万 | 256 | 388273 | 0.66 ms / 1.64 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) +![threads_select](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) +![table_size_select](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -145,39 +146,38 @@ max_connections = 2000 | Mysql | 32 | 100 万 | 256 | 14508 | 17.64 ms / 44.98 ms | | Mysql | 32 | 500 万 | 256 | 10593 | 24.16 ms / 82.96 ms | | Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | - -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) +![threads_insert](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +![table_size_insert](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) ### 场景二:TiDB 水平扩展能力测试 -部署方案以及配置参数 +部署方案以及配置参数 ``` -// TiDB 部署方案 -172.16.20.3 4*tikv +// TiDB 部署方案 +172.16.20.3 4*tikv 172.16.10.2 1*tidb 1*pd 1*sysbench -每个物理节点有三块盘: -data3: 2 tikv (Optane SSD) -data2: 1 tikv -data1: 1 tikv +每个物理节点有三块盘: +data3: 2 tikv (Optane SSD) +data2: 1 tikv +data1: 1 tikv -// TiKV 参数配置 +// TiKV 参数配置 sync-log = false grpc-concurrency = 8 -grpc-raft-conn-num = 24 +grpc-raft-conn-num = 24 [defaultcf] block-cache-size = "12GB" [writecf] block-cache-size = "5GB" [raftdb.defaultcf] block-cache-size = "2GB" -``` +``` -* 标准 oltp 测试 +* 标准 oltp 测试 | - | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | @@ -186,11 +186,9 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 8984 | 179692 | 114.96 ms / 176.73 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 12953 | 259072 | 117.80 ms / 200.47 ms | +![scale_tidb_oltp](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) - - -* 标准 select 测试 +* 标准 select 测试 | - | table count | table size | sysbench threads | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -199,10 +197,9 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 289933 | 3.53 ms / 8.74 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 435313 | 3.55 ms / 9.17 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_select](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) - -* 标准 insert 测试 +* 标准 insert 测试 | - | table count | table size | sysbench threads | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -210,4 +207,4 @@ block-cache-size = "2GB" | 5 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 60689 | 37.96 ms / 29.9 ms | | 7 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 80087 | 9.62 ms / 21.37 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) +![scale_tikv_insert](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) diff --git a/v1.0/op-guide/backup-restore.md b/v1.0/op-guide/backup-restore.md index b8e073a200e2..95fc1ca2518a 100755 --- a/v1.0/op-guide/backup-restore.md +++ b/v1.0/op-guide/backup-restore.md @@ -7,7 +7,6 @@ category: advanced ## 概述 - 该文档详细介绍了如何对 TiDB 进行备份恢复。本文档暂时只考虑全量备份与恢复。 这里我们假定 TiDB 服务信息如下: @@ -16,13 +15,11 @@ category: advanced |----|-------|----|----|--------| |TiDB|127.0.0.1|4000|root|*| - 在这个备份恢复过程中,我们会用到下面的工具: - mydumper 从 TiDB 导出数据 - loader 导入数据到 TiDB - ### 下载 TiDB 工具集 (Linux) ```bash @@ -37,7 +34,6 @@ tar -xzf tidb-enterprise-tools-latest-linux-amd64.tar.gz cd tidb-enterprise-tools-latest-linux-amd64 ``` - ## 使用 `mydumper`/`loader` 全量备份恢复数据 `mydumper` 是一个强大的数据备份工具,具体可以参考 [https://github.com/maxbube/mydumper](https://github.com/maxbube/mydumper)。 @@ -49,19 +45,21 @@ cd tidb-enterprise-tools-latest-linux-amd64 > 虽然 TiDB 也支持使用 MySQL 官方的 `mysqldump` 工具来进行数据的备份恢复工作,但相比于 `mydumper`/`loader`,性能会慢很多,大量数据的备份恢复会花费很多时间,这里我们并不推荐。 ### `mydumper`/`loader` 全量备份恢复最佳实践 + 为了快速的备份恢复数据 (特别是数据量巨大的库), 可以参考下面建议 -* 使用 mydumper 导出来的数据文件尽可能的小, 最好不要超过 64M, 可以设置参数 -F 64 +* 使用 mydumper 导出来的数据文件尽可能的小, 最好不要超过 64M, 可以设置参数 -F 64 * loader的 `-t` 参数可以根据 tikv 的实例个数以及负载进行评估调整,例如 3个 tikv 的场景, 此值可以设为 `3 *(1 ~ n)`;当 tikv 负载过高,loader 以及 tidb 日志中出现大量 `backoffer.maxSleep 15000ms is exceeded` 可以适当调小该值,当 tikv 负载不是太高的时候,可以适当调大该值。 #### 某次数据恢复示例,以及相关的配置 - - mydumper 导出后总数据量 214G,单表 8 列,20 亿行数据 - - 集群拓扑 - - TIKV * 12 - - TIDB * 4 - - PD * 3 - - mydumper -F 设置为 16, loader -t 参数 64 - + +- mydumper 导出后总数据量 214G,单表 8 列,20 亿行数据 +- 集群拓扑 + - TIKV * 12 + - TIDB * 4 + - PD * 3 +- mydumper -F 设置为 16, loader -t 参数 64 + 结果:导入时间 11 小时左右,19.4 G/小时 ### 从 TiDB 备份数据 @@ -78,8 +76,6 @@ cd tidb-enterprise-tools-latest-linux-amd64 `--skip-tz-utc` 添加这个参数忽略掉 TiDB 与导数据的机器之间时区设置不一致的情况,禁止自动转换。 - - ### 向 TiDB 恢复数据 我们使用 `loader` 将之前导出的数据导入到 TiDB,完成恢复操作。Loader 的下载和具体的使用方法见 [Loader 使用文档](../tools/loader.md) diff --git a/v1.0/op-guide/binary-deployment.md b/v1.0/op-guide/binary-deployment.md index 79e7fc69bcb5..e3d0190e7f07 100755 --- a/v1.0/op-guide/binary-deployment.md +++ b/v1.0/op-guide/binary-deployment.md @@ -5,7 +5,6 @@ category: deployment # TiDB Binary 部署指导 - ## 概述 一个完整的 TiDB 集群包括 PD,TiKV 以及 TiDB。启动顺序依次是 PD,TiKV 以及 TiDB。在关闭数据库服务时,请按照启动的相反顺序进行逐一关闭服务。 @@ -33,7 +32,6 @@ category: deployment | PD | 2379 | TCP | 提供 TiDB 和 PD 通信端口 | | PD | 2380 | TCP | PD 集群节点间通信端口 | - ### 2. TiDB 数据库组件(选装) | 组件 | 默认端口 | 协议 | 说明 | @@ -61,7 +59,6 @@ category: deployment | :-- | :---------------------------- | | 防火墙 / 端口 | 请查看 TiDB 所需端口在各个节点之间是否能正常访问 | - ### 操作系统参数 | 配置 | 说明 | @@ -178,6 +175,7 @@ cd tidb-latest-linux-amd64 --path="127.0.0.1:2379" \ --log-file=tidb.log ``` + 步骤四. 使用 MySQL 客户端连接 TiDB: ``` @@ -238,6 +236,7 @@ mysql -h 127.0.0.1 -P 4000 -u root -D test --path="192.168.199.113:2379" \ --log-file=tidb.log ``` + 步骤四. 使用 MySQL 客户端连接 TiDB: ``` @@ -360,7 +359,7 @@ tar -xzf pushgateway-0.3.1.linux-amd64.tar.gz ### 启动监控服务 -### 在 node1,node2,node3,node4 启动 `node_exporter`: +### 在 node1,node2,node3,node4 启动 `node_exporter` ``` $cd node_exporter-0.14.0-rc.1.linux-amd64 @@ -370,7 +369,7 @@ $cd node_exporter-0.14.0-rc.1.linux-amd64 --log.level="info" ``` -### 在 node1 启动 pushgateway: +### 在 node1 启动 pushgateway ``` $cd pushgateway-0.3.1.linux-amd64 @@ -381,7 +380,7 @@ $cd pushgateway-0.3.1.linux-amd64 --web.listen-address=":9091" ``` -### 在 node1 启动 Prometheus: +### 在 node1 启动 Prometheus ``` $cd prometheus-1.5.2.linux-amd64 @@ -426,7 +425,7 @@ scrape_configs: --storage.local.retention="360h0m0s" ``` -### 在 node1 启动 Grafana: +### 在 node1 启动 Grafana ``` cd grafana-4.1.2-1486989747.linux-x64 diff --git a/v1.0/op-guide/docker-deployment.md b/v1.0/op-guide/docker-deployment.md index 8518429f23ff..7127eaf69a9a 100755 --- a/v1.0/op-guide/docker-deployment.md +++ b/v1.0/op-guide/docker-deployment.md @@ -12,6 +12,7 @@ category: deployment ## 环境准备 ### 安装 Docker + Docker 可以方便地在 Linux / Mac OS / Windows 平台安装,安装方法请参考 [Docker 官方文档](https://www.docker.com/products/docker)。 ### 拉取 TiDB 的 Docker 镜像 @@ -43,7 +44,6 @@ docker pull pingcap/pd:latest | host5 | 192.168.1.105 | TiKV2 | /data | | host6 | 192.168.1.106 | TiKV3 | /data | - ### 启动 PD 登录 **host1** 执行: diff --git a/v1.0/op-guide/generate-self-signed-certificates.md b/v1.0/op-guide/generate-self-signed-certificates.md index c993f30c4a30..ac33d1240edc 100755 --- a/v1.0/op-guide/generate-self-signed-certificates.md +++ b/v1.0/op-guide/generate-self-signed-certificates.md @@ -20,8 +20,6 @@ category: deployment | node5 | 172.16.10.5 | TiKV2 | | node6 | 172.16.10.6 | TiKV3 | - - ## 下载 cfssl 假设使用 x86_64 Linux 主机: @@ -34,11 +32,9 @@ chmod +x ~/bin/{cfssl,cfssljson} export PATH=$PATH:~/bin ``` - - ## 初始化证书颁发机构 -生成 cfssl 的默认配置,以便于之后修改: +生成 cfssl 的默认配置,以便于之后修改: ```bash mkdir ~/cfssl @@ -47,20 +43,18 @@ cfssl print-defaults config > ca-config.json cfssl print-defaults csr > ca-csr.json ``` - - ## 生成证书 -#### 证书介绍 +### 证书介绍 - tidb-server certificate 由 TiDB 使用,为其他组件和客户端验证 TiDB 身份。 - tikv-server certificate 由 TiKV 使用,为其他组件和客户端验证 TiKV 身份。 - pd-server certificate 由 PD 使用,为其他组件和客户端验证 PD 身份。 - client certificate 用于通过 PD、TiKV、TiDB 验证客户端。例如 `pd-ctl`,`tikv-ctl`,`pd-recover`。 -#### 配置 CA 选项 +### 配置 CA 选项 -根据实际需求修改 `ca-config.json` : +根据实际需求修改 `ca-config.json` : ```json { @@ -91,7 +85,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { @@ -111,7 +105,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -#### 生成 CA 证书 +### 生成 CA 证书 ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - @@ -125,7 +119,7 @@ ca.csr ca.pem ``` -#### 生成服务器端证书 +### 生成服务器端证书 `hostname` 中为各组件的 IP 地址,以及 `127.0.0.1` @@ -145,7 +139,7 @@ tidb-server.csr tikv-server.csr pd-server.csr tidb-server.pem tikv-server.pem pd-server.pem ``` -#### 生成客户端证书 +### 生成客户端证书 ```bash echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client -hostname="" - | cfssljson -bare client @@ -154,9 +148,7 @@ echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gen 将会生成以下几个文件: ```bash -client-key.pem -client.csr -client.pem +client-key.pem +client.csr +client.pem ``` - -### diff --git a/v1.0/op-guide/migration-overview.md b/v1.0/op-guide/migration-overview.md index eedce7b64aae..4648f703fab1 100755 --- a/v1.0/op-guide/migration-overview.md +++ b/v1.0/op-guide/migration-overview.md @@ -28,19 +28,17 @@ category: advanced - 第一种场景:只全量导入历史数据 (需要 checker + mydumper + loader); - 第二种场景:全量导入历史数据后,通过增量的方式同步新的数据 (需要 checker + mydumper + loader + syncer)。该场景需要提前开启 binlog 且格式必须为 ROW。 - ## MySQL 开启 binlog **注意: 只有上文提到的第二种场景才需要在 dump 数据之前先开启 binlog** -+ MySQL 开启 binlog 功能,参考 [Setting the Replication Master Configuration](http://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html) -+ Binlog 格式必须使用 `ROW` format,这也是 MySQL 5.7 之后推荐的 binlog 格式,可以使用如下语句打开: ++ MySQL 开启 binlog 功能,参考 [Setting the Replication Master Configuration](http://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html) ++ Binlog 格式必须使用 `ROW` format,这也是 MySQL 5.7 之后推荐的 binlog 格式,可以使用如下语句打开: ```sql SET GLOBAL binlog_format = ROW; ``` - ## 使用 checker 进行 Schema 检查 在迁移之前,我们可以使用 TiDB 的 checker 工具,来预先检查 TiDB 是否能支持需要迁移的 table schema。如果 check 某个 table schema 失败,表明 TiDB 当前并不支持,我们不能对该 table 里面的数据进行迁移。checker 包含在 TiDB 工具集里面,我们可以直接下载。 @@ -61,7 +59,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 ### 使用 checker 检查的一个示范 -+ 在 MySQL 的 test database 里面创建几张表,并插入数据: ++ 在 MySQL 的 test database 里面创建几张表,并插入数据: ```sql USE test; @@ -72,7 +70,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 INSERT INTO t2 VALUES (1, "a"), (2, "b"), (3, "c"); ``` -+ 使用 checker 检查 test database 里面所有的 table ++ 使用 checker 检查 test database 里面所有的 table ```bash ./bin/checker -host 127.0.0.1 -port 3306 -user root test @@ -84,7 +82,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 2016/10/27 13:11:49 checker.go:69: [info] Check table t2 succ ``` -+ 使用 checker 检查 test database 里面某一个 table ++ 使用 checker 检查 test database 里面某一个 table 这里,假设我们只需要迁移 table `t1`。 diff --git a/v1.0/op-guide/migration.md b/v1.0/op-guide/migration.md index deeccc48fda8..09c8234a7bd1 100755 --- a/v1.0/op-guide/migration.md +++ b/v1.0/op-guide/migration.md @@ -204,7 +204,6 @@ status-addr = "127.0.0.1:10086" #db-name ="test" #tbl-name = "~^a.*" - # sharding 同步规则,采用 wildcharacter # 1. 星号字符 (*) 可以匹配零个或者多个字符, # 例子, doc* 匹配 doc 和 document, 但是和 dodo 不匹配; @@ -272,7 +271,6 @@ mysql> select * from t1; `syncer` 每隔 30s 会输出当前的同步统计,如下 - ```bash 2017/06/08 01:18:51 syncer.go:934: [info] [syncer]total events = 15, total tps = 130, recent tps = 4, master-binlog = (ON.000001, 11992), master-binlog-gtid=53ea0ed1-9bf8-11e6-8bea-64006a897c73:1-74, diff --git a/v1.0/op-guide/monitor-overview.md b/v1.0/op-guide/monitor-overview.md index 421aa3c8284b..8342c73f06d7 100755 --- a/v1.0/op-guide/monitor-overview.md +++ b/v1.0/op-guide/monitor-overview.md @@ -16,6 +16,3 @@ Prometheus 提供了多个组件供用户使用。目前,我们使用 Promethe Grafana 是一个开源的 metric 分析及可视化系统。我们使用 Grafana 来展示 TiDB 的各项性能指标 。如下图所示: ![Grafana Screeshot](../media/grafana-screenshot.png) - - - diff --git a/v1.0/op-guide/offline-ansible-deployment.md b/v1.0/op-guide/offline-ansible-deployment.md index afee38013228..b4c36d31d966 100755 --- a/v1.0/op-guide/offline-ansible-deployment.md +++ b/v1.0/op-guide/offline-ansible-deployment.md @@ -7,21 +7,21 @@ category: deployment ## 准备机器 -1. 下载机一台 +1. 下载机一台 - 该机器需开放外网访问,用于下载 TiDB-Ansible、TiDB 及相关软件安装包。 - 推荐安装 CentOS 7.3 及以上版本 Linux 操作系统。 -2. 部署目标机器若干及部署中控机一台 +2. 部署目标机器若干及部署中控机一台 - 系统要求及配置参考[准备机器](ansible-deployment.md#准备机器)。 - 可以无法访问外网。 ## 在中控机器上离线安装 Ansible 及其依赖 -1. CentOS 7 系统 Ansible 离线安装方式: +1. CentOS 7 系统 Ansible 离线安装方式: - > 下载 [ Ansible ]( http://download.pingcap.org/ansible-2.4-rpms.el7.tar.gz) 离线安装包 ,上传至中控机。 + > 下载 [Ansible](http://download.pingcap.org/ansible-2.4-rpms.el7.tar.gz) 离线安装包,上传至中控机。 ```bash # tar -xzvf ansible-2.4-rpms.el7.tar.gz @@ -33,7 +33,7 @@ category: deployment # rpm -ivh ansible-2.4.2.0-2.el7.noarch.rpm ``` -2. 安装完成后,可通过 `ansible --version` 查看版本: +2. 安装完成后,可通过 `ansible --version` 查看版本: ```bash # ansible --version @@ -42,7 +42,7 @@ category: deployment ## 在下载机上下载 TiDB-Ansible 及 TiDB 安装包 -1. 在下载机上安装 Ansible +1. 在下载机上安装 Ansible 请按以下方式在 CentOS 7 系统的下载机上在线安装 Ansible。 通过 epel 源安装, 会自动安装 Ansible 相关依赖(如 Jinja2==2.7.2 MarkupSafe==0.11),安装完成后,可通过 `ansible --version` 查看版本,请务必确认是 **Ansible 2.4** 及以上版本,否则会有兼容问题。 @@ -50,15 +50,16 @@ category: deployment # yum install epel-release # yum install ansible curl # ansible --version - + ansible 2.4.2.0 ``` -2. 下载 tidb-ansible +2. 下载 tidb-ansible 使用以下命令从 Github [TiDB-Ansible 项目](https://github.com/pingcap/tidb-ansible) 上下载 TiDB-Ansible 相应版本,默认的文件夹名称为 `tidb-ansible`。 下载 GA 版本: + ``` git clone -b release-1.0 https://github.com/pingcap/tidb-ansible.git ``` @@ -66,21 +67,21 @@ category: deployment 或 下载 master 版本: + ``` git clone https://github.com/pingcap/tidb-ansible.git ``` > **注:** 生产环境请下载 GA 版本部署 TiDB。 - -3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 +3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 ``` cd tidb-ansible ansible-playbook local_prepare.yml ``` -4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 +4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 ## 分配机器资源,编辑 inventory.ini 文件 @@ -88,9 +89,9 @@ category: deployment ## 部署任务 -1. 参考[部署任务](ansible-deployment.md#部署任务)即可。 +1. 参考[部署任务](ansible-deployment.md#部署任务)即可。 -2. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 +2. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 ## 测试集群 diff --git a/v1.0/op-guide/security.md b/v1.0/op-guide/security.md index 235390b52771..2c1b2b2883eb 100755 --- a/v1.0/op-guide/security.md +++ b/v1.0/op-guide/security.md @@ -14,21 +14,19 @@ category: deployment MySQL Client 与 TiDB 之间使用一套证书,TiDB 集群组件之间使用另外一套证书。 - - ## TiDB 集群组件间开启 TLS(双向认证) ### 准备证书 推荐为 TiDB、TiKV、PD 分别准备一个 server 证书,并保证可以相互验证,而它们的各种客户端共用 client 证书。 -有多种工具可以生成自签名证书,如 `openssl`,`easy-rsa `,`cfssl`。 +有多种工具可以生成自签名证书,如 `openssl`,`easy-rsa`,`cfssl`。 这里提供一个使用 `cfssl` 生成证书的示例:[生成自签名证书](generate-self-signed-certificates.md)。 ### 配置证书 -##### TiDB +#### TiDB 在 config 文件或命令行参数中设置: @@ -42,7 +40,7 @@ cluster-ssl-cert = "/path/to/tidb-server.pem" cluster-ssl-key = "/path/to/tidb-server-key.pem" ``` -##### TiKV +#### TiKV 在 config 文件或命令行参数中设置,并设置相应 url 为 https: @@ -54,7 +52,7 @@ cert-path = "/path/to/client.pem" key-path = "/path/to/client-key.pem" ``` -##### PD +#### PD 在 config 文件或命令行参数中设置,并设置相应 url 为 https: @@ -78,8 +76,6 @@ key-path = "/path/to/server-key.pem" ./tikv-ctl --host="127.0.0.1:20160" --ca-path="/path/to/ca.pem" --cert-path="/path/to/client.pem" --key-path="/path/to/clinet-key.pem" ``` - - ## MySQL 与 TiDB 间开启 TLS ### 准备证书 @@ -127,6 +123,3 @@ ssl-key = "/path/to/certs/server-key.pem" ```bash mysql -u root --host 127.0.0.1 --port 4000 --ssl-cert=/path/to/certs/client-cert.pem --ssl-key=/path/to/certs/client-key.pem --ssl-ca=/path/to/certs/ca.pem --ssl-mode=VERIFY_IDENTITY ``` - - - diff --git a/v1.0/op-guide/tune-tikv.md b/v1.0/op-guide/tune-tikv.md index b27f2fe47a4e..98c041f17b3b 100755 --- a/v1.0/op-guide/tune-tikv.md +++ b/v1.0/op-guide/tune-tikv.md @@ -233,14 +233,11 @@ block-cache-size = "256MB" 除了以上列出的 `block-cache` 以及 `write-buffer` 会占用系统内存外: -1. 需预留一些内存作为系统的 page cache -2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 - +1. 需预留一些内存作为系统的 page cache +2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 ## TiKV 机器配置推荐 -1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 -2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 -3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 - - +1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 +2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 +3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 diff --git a/v1.0/releases/rc3.md b/v1.0/releases/rc3.md index 6b57c34fdd89..8e7f92da528f 100755 --- a/v1.0/releases/rc3.md +++ b/v1.0/releases/rc3.md @@ -41,7 +41,7 @@ category: Releases - 通过 Key 获取 Region 信息 - 添加、删除 scheduler 和 operator - 获取集群 label 信息 - + ## TiKV + 支持 Async Apply 提升整体写入性能 diff --git a/v1.0/releases/rc4.md b/v1.0/releases/rc4.md index eaf622df3436..a1d037e0dfa3 100755 --- a/v1.0/releases/rc4.md +++ b/v1.0/releases/rc4.md @@ -8,7 +8,7 @@ category: Releases 8 月 4 日,TiDB 正式发布 RC4 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。性能方面重点优化了写入速度,计算任务调度支持优先级,避免分析型大事务影响在线事务。SQL 优化器全新改版,查询代价估算更加准确,且能够自动选择 Join 物理算子。功能方面进一步 MySQL 兼容性。 同时为了更好的支持 OLAP 业务,开源了 TiSpark 项目,可以通过 Spark 读取和分析 TiKV 中的数据。 -## TiDB: +## TiDB + SQL 查询优化器重构 - 更好的支持 TopN 查询 @@ -22,7 +22,7 @@ category: Releases + 支持 Json 类型及其操作 + 支持查询优先级、隔离级别的设置 -## PD: +## PD + 支持通过 PD 设置 TiKV location labels + 调度优化 @@ -31,7 +31,7 @@ category: Releases - 优化 balance 算法 + 优化数据加载,加快 failover 速度 -## TiKV: +## TiKV + 支持查询优先级设置 + 支持 RC 隔离级别 @@ -40,9 +40,9 @@ category: Releases + Coprocessor 支持更多下推函数 + 提升性能,提升稳定性 -## TiSpark Beta Release: - +## TiSpark Beta Release + + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 -+ 通过 TPC-H 测试 (除去一个需要 View 的 Query) \ No newline at end of file ++ 通过 TPC-H 测试 (除去一个需要 View 的 Query) diff --git a/v1.0/sql/admin.md b/v1.0/sql/admin.md index b563d6f11e7c..6b5245641abb 100755 --- a/v1.0/sql/admin.md +++ b/v1.0/sql/admin.md @@ -56,9 +56,11 @@ password_option: { 设置用户密码,具体信息参考[权限管理](privilege.md)。 ### 设置隔离级别 + ```sql SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ``` + 设置事务隔离级别,具体信息参考[事务语句](transaction.md#事务隔离级别)。 ## `SHOW` 语句 @@ -97,13 +99,13 @@ SHOW STATS_META [like_or_where] SHOW STATS_HISTOGRAMS [like_or_where] SHOW STATS_BUCKETS [like_or_where] - like_or_where: LIKE 'pattern' | WHERE expr ``` 说明: + * 通过 `SHOW` 语句展示统计信息请参考[统计信息说明](https://github.com/pingcap/docs-cn/blob/master/sql/statistics.md#统计信息的查看) * 关于 `SHOW` 语句更多信息请参考 [MySQL 文档](https://dev.mysql.com/doc/refman/5.7/en/show.html) @@ -127,4 +129,4 @@ ADMIN CANCEL DDL JOBS 'job_id' [, 'job_id'] ... * `ADMIN CANCEL DDL JOBS 'job_id' [, 'job_id'] ...` -用于取消正在执行的 DDL 作业,其返回值为对应的作业取消是否成功,如果失败会显示失败的具体原因。这个操作可以同时取消多个 DDL 作业,其中 DDL 作业 ID 可以通过 `ADMIN SHOW DDL JOBS` 语句来获取。其中如果希望取消的作业已经完成,则取消操作将会失败。 \ No newline at end of file +用于取消正在执行的 DDL 作业,其返回值为对应的作业取消是否成功,如果失败会显示失败的具体原因。这个操作可以同时取消多个 DDL 作业,其中 DDL 作业 ID 可以通过 `ADMIN SHOW DDL JOBS` 语句来获取。其中如果希望取消的作业已经完成,则取消操作将会失败。 diff --git a/v1.0/sql/cast-functions-and-operators.md b/v1.0/sql/cast-functions-and-operators.md index d99a4098fb36..33093487d57c 100755 --- a/v1.0/sql/cast-functions-and-operators.md +++ b/v1.0/sql/cast-functions-and-operators.md @@ -3,8 +3,6 @@ title: TiDB 用户文档 category: user guide --- - - # Cast 函数和操作符 Cast 函数和操作符用于将某种数据类型的值转换为另一种数据类型。TiDB 中该函数和操作符的使用方法与 MySQL基本一致,详情参见: [Cast Functions and Operators](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html). @@ -16,4 +14,3 @@ Cast 函数和操作符用于将某种数据类型的值转换为另一种数据 | [`BINARY`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#operator_binary) | 将一个字符串转换成一个二进制字符串 | | [`CAST()`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast) | 将一个值转换成一个确定类型 | | [`CONVERT()`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert) | 将一个值转换成一个确定类型 | - diff --git a/v1.0/sql/comment-syntax.md b/v1.0/sql/comment-syntax.md index 4377d2653965..3244be082718 100755 --- a/v1.0/sql/comment-syntax.md +++ b/v1.0/sql/comment-syntax.md @@ -76,7 +76,6 @@ TiDB 也跟 MySQL 保持一致,支持一种 C 风格注释的变体: 如果注释中指定了 Server 版本号,例如 `/*!50110 KEY_BLOCK_SIZE=1024 */`,在 MySQL 中表示只有 MySQL 的版本大于等于 5.1.10 才会处理这个 comment 中的内容。但是在 TiDB 中,这个版本号不会起作用,所有的 comment 都会处理。 - 还有一种注释会被当做是优化器 Hint 特殊对待: ``` diff --git a/v1.0/sql/connection-and-APIs.md b/v1.0/sql/connection-and-APIs.md index 8af17ab3632a..3891075b0881 100755 --- a/v1.0/sql/connection-and-APIs.md +++ b/v1.0/sql/connection-and-APIs.md @@ -19,7 +19,6 @@ TiDB 兼容 MySQL(5.6、5.7) 的所有连接器和 API,包括: + [MySQL Eiffel Wrapper](https://dev.mysql.com/doc/refman/5.7/en/apis-eiffel.html) + [Mysql Go API](https://github.com/go-sql-driver/mysql) - ## 使用 MySQL 连接器连接 TiDB Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 @@ -53,7 +52,7 @@ Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 | Eiffel | Eiffel MySQL | `libmysqlclient` | See [Section 27.14, “MySQL Eiffel Wrapper”](https://dev.mysql.com/doc/refman/5.7/en/apis-eiffel.html). | | Erlang | `erlang-mysql-driver` | `libmysqlclient` | See [`erlang-mysql-driver`.](http://code.google.com/p/erlang-mysql-driver/) | | Haskell | Haskell MySQL Bindings | Native Driver | See [Brian O'Sullivan's pure Haskell MySQL bindings](http://www.serpentine.com/blog/software/mysql/). | -| | `hsql-mysql` | `libmysqlclient` | See [MySQL driver for Haskell ](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsql-mysql-1.7). | +| | `hsql-mysql` | `libmysqlclient` | See [MySQL driver for Haskell](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsql-mysql-1.7). | | Java/JDBC | Connector/J | Native Driver | See [MySQL Connector/J 5.1 Developer Guide](https://dev.mysql.com/doc/connector-j/5.1/en/). | | Kaya | MyDB | `libmysqlclient` | See [MyDB](http://kayalang.org/library/latest/MyDB). | | Lua | LuaSQL | `libmysqlclient` | See [LuaSQL](http://keplerproject.github.io/luasql/doc/us/). | @@ -76,8 +75,6 @@ Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 | SPL | `sql_mysql` | `libmysqlclient` | See [`sql_mysql` for SPL](http://www.clifford.at/spl/spldoc/sql_mysql.html). | | Tcl | MySQLtcl | `libmysqlclient` | See [Section 27.13, “MySQL Tcl API”](https://dev.mysql.com/doc/refman/5.7/en/apis-tcl.html). | - - ## TiDB 支持的连接器版本 | Connector | Connector version | diff --git a/v1.0/sql/datatype.md b/v1.0/sql/datatype.md index e45ebbdebaf2..3a4e5cf7a9f5 100755 --- a/v1.0/sql/datatype.md +++ b/v1.0/sql/datatype.md @@ -31,6 +31,7 @@ TiDB 支持 MySQL 所有的数值类型,按照精度可以分为: TiDB 支持 MySQL 所有的整数类型,包括 INTEGER/INT、TINYINT、SMALLINT、MEDIUMINT 以及 BIGINT,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html)文档。 #### 类型定义 + 语法: ```sql @@ -93,7 +94,7 @@ FLOAT[(M,D)] [UNSIGNED] [ZEROFILL] DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL] > 双精度浮点数。允许的值范围为:-2^1024 ~ +2^1024,也即是 -1.7976931348623157E+308 到 -2.2250738585072014E-308、0 和 2.2250738585072014E-308 到 1.7976931348623157E+308。这些是理论限制,基于 IEEE 标准。实际的范围根据硬件或操作系统的不同可能稍微小些。 - + DOUBLE PRECISION [(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED] [ZEROFILL] > 为 DOUBLE 的同义词。 @@ -120,7 +121,6 @@ FLOAT(p) [UNSIGNED] [ZEROFILL] | `FLOAT(p)` | 如果 0 <= p <= 24 为 4 个字节, 如果 25 <= p <= 53 为 8 个字节| | `DOUBLE` | 8 | - ### 定点类型 TiDB 支持 MySQL 所有的浮点类型,包括 DECIMAL、NUMERIC,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html)文档。 @@ -146,9 +146,6 @@ NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL] | UNSIGNED | 无符号数,如果不加这个标识,则为有符号数 | | ZEROFILL | 补零标识,如果有这个标识,TiDB 会自动给类型增加 UNSIGNED 标识 | - - - ## 日期时间类型 ### 概述 @@ -158,6 +155,7 @@ TiDB 支持 MySQL 所有的日期时间类型,包括 DATE、DATETIME、TIMESTA ### 类型定义 语法: + ```sql DATE > 日期。支持的范围为`1000-01-01`到`9999-12-31`。以`YYYY-MM-DD`格式显示 DATE 值。 @@ -188,6 +186,7 @@ TiDB 支持 MySQL 所有的字符串类型,包括 CHAR、VARCHAR、BINARY、VA ### 类型定义 语法: + ```sql [NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name] > 定长字符串。CHAR 列的长度固定为创建表时声明的长度。长度可以为从 0 到 255 的任何值。当保存 CHAR 值时,在它们的右边填充空格以达到指定的长度。 @@ -240,6 +239,7 @@ Json 类型可以存储 Json 这种半结构化的数据,相比于直接将 Js 2. 多了 Json 合法性验证的步骤,只有合法的 Json 文档才可以放入这个字段中; Json 字段本身上,并不能创建索引。相反,可以对 Json 文档中的某个子字段创建索引。例如: + ```sql CREATE TABLE city ( id INT PRIMARY KEY, @@ -253,6 +253,7 @@ SELECT id FROM city WHERE population >= 100; ## 枚举类型 集合类型是一个字符串,其值必须是从一个固定集合中选取,这个固定集合在创建表的时候定义,语法是: + ```sql ENUM('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name] @@ -284,6 +285,7 @@ SET('1', '2') NOT NULL ``` 上面的例子中,这列的有效值可以是: + ``` '' '1' @@ -304,8 +306,8 @@ SET('1', '2') NOT NULL 更多信息参考 [MySQL 集合文档](https://dev.mysql.com/doc/refman/5.7/en/set.html)。 - ## 数据类型的默认值 + 在一个数据类型描述中的 `DEFAULT value` 段描述了一个列的默认值。这个默认值必须是常量,不可以是一个函数或者是表达式。但是对于时间类型,可以例外的使用 `NOW`、`CURRENT_TIMESTAMP`、`LOCALTIME`、`LOCALTIMESTAMP` 等函数作为 `DATETIME` 或者 `TIMESTAMP` 的默认值。 `BLOB`、`TEXT` 以及 `JSON` 不可以设置默认值。 diff --git a/v1.0/sql/dml.md b/v1.0/sql/dml.md index 701bde99fd5c..d25a72303c7d 100755 --- a/v1.0/sql/dml.md +++ b/v1.0/sql/dml.md @@ -110,7 +110,6 @@ INSERT INTO tbl_name VALUES(1,2,3),(4,5,6),(7,8,9); 上面的例子中,`(1,2,3),(4,5,6),(7,8,9)` 即为 Value List,其中每个括号内部的数据表示一行数据,这个例子中插入了三行数据。Insert 语句也可以只给部分列插入数据,这种情况下,需要在 Value List 之前加上 ColumnName List,如: - ```sql INSERT INTO tbl_name (a,c) VALUES(1,2),(4,5),(7,8); ``` @@ -130,6 +129,7 @@ INSERT INTO tbl_name SET a=1, b=2, c=3; * Select Statement 待插入的数据集是通过一个 Select 语句获取,要插入的列是通过 Select 语句的 Schema 获得。例如: + ```sql CREATE TABLE tbl_name1 ( a int, @@ -150,6 +150,7 @@ Delete 语句用于删除数据库中的数据,TiDB 兼容 MySQL Delete 语句 这种语法用于删除的数据只会涉及一个表的情况。 ### 语法定义 + ```sql DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [WHERE where_condition] @@ -175,7 +176,6 @@ DELETE [LOW_PRIORITY] [QUICK] [IGNORE] 删除多个表的数据的时候,可以用这两种语法。这两种写法都可以指定从多个表查询数据,但只删除其中一些表的数据。在第一种语法中,只会删除 `FROM` 关键字之前的 Table 列表中所列 Table 的表中的数据。对于第二种写法,只会删除 `FROM` 之后 `USING` 之前的 Table 列表中的所列 Table 中的数据。 - ### 语法元素说明 | 语法元素 | 说明 | @@ -197,6 +197,7 @@ Update 语句用于更新表中的数据。 Update 语句一共有两种语法,分别用于更新单表数据和多表数据。 ### 单表 Update + ```sql UPDATE [LOW_PRIORITY] [IGNORE] table_reference SET assignment_list @@ -214,13 +215,14 @@ assignment_list: 单表 Update 语句会更新 Table 中现有行的指定列。`SET assignment_list` 指定了要更新的列名,以及要赋予地新值。 Where/OrderBy/Limit 子句一起用于从 Table 中查询出待更新的数据。 ### 多表 Update + ```sql UPDATE [LOW_PRIORITY] [IGNORE] table_references SET assignment_list [WHERE where_condition] ``` -多表更新语句用于将 `table_references` 中满足 Where 子句的数据地指定列赋予新的值。 +多表更新语句用于将 `table_references` 中满足 Where 子句的数据地指定列赋予新的值。 ### 语法元素说明 @@ -235,7 +237,6 @@ UPDATE [LOW_PRIORITY] [IGNORE] table_references | `ORDER BY` | 对待更新数据集进行排序 | | `LIMIT row_count` | 只对待更新数据集中排序前 row_count 行的内容进行更新 | - ## Replace 语句 Replace 语句是 MySQL 对标准 SQL 语法的扩展,其行为和 Insert 语句一样,但是当现有数据中有和待插入数据在 PRIMARY KEY 或者 UNIQUE KEY 冲突的情况下,会先删除旧数据,再插入新数据。 diff --git a/v1.0/sql/encryption-and-compression-functions.md b/v1.0/sql/encryption-and-compression-functions.md index a5d7171d329d..f1dcaa960b82 100755 --- a/v1.0/sql/encryption-and-compression-functions.md +++ b/v1.0/sql/encryption-and-compression-functions.md @@ -5,7 +5,6 @@ category: user guide # 加密和压缩函数 - | 函数名 | 功能描述 | |:-----------|:----------------------------| | [`MD5()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_md5)                                                             | 计算字符串的 MD5 校验和       | diff --git a/v1.0/sql/error.md b/v1.0/sql/error.md index 6df32d3ecbba..d23f9321bd96 100755 --- a/v1.0/sql/error.md +++ b/v1.0/sql/error.md @@ -21,7 +21,6 @@ TiDB 兼容 MySQL 的错误码,在大多数情况下,返回和 MySQL 一样 | 9006 | GC Life Time 间隔时间过短,长事务本应读到的数据可能被清理了,应增加GC Life Time | | 9500 | 单个事务过大,原因及解决方法请参考[这里](../FAQ.md#出现-transaction-too-large-报错怎么办) | - ## 故障诊断 参见[故障诊断文档](../trouble-shooting.md)以及 [FAQ](../FAQ.md)。 diff --git a/v1.0/sql/literal-value-bit-value.md b/v1.0/sql/literal-value-bit-value.md index 210341fab568..22980153cef2 100755 --- a/v1.0/sql/literal-value-bit-value.md +++ b/v1.0/sql/literal-value-bit-value.md @@ -13,7 +13,6 @@ category: user guide * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v1.0/sql/literal-value-date-and-time-literals.md b/v1.0/sql/literal-value-date-and-time-literals.md index d3078831ba0b..f7c1d3e6d313 100755 --- a/v1.0/sql/literal-value-date-and-time-literals.md +++ b/v1.0/sql/literal-value-date-and-time-literals.md @@ -20,7 +20,7 @@ Dates 如果 year 部分只有两个数字,这是有歧义的(推荐使用 * year 值如果在 `70-99` 范围,那么被转换成 `1970-1999`。 * year 值如果在 `00-69` 范围,那么被转换成 `2000-2069`。 - + 对于小于 10 的 month 或者 day 值,`'2017-8-4'` 跟 `'2017-08-04'` 是一样的。对于 Time 也是一样,比如 `'2017-08-24 1:2:3'` 跟 `'2017-08-24 01:02:03'`是一样的。 在需要 Date 或者 Time 的语境下, 对于数值,TiDB 会根据数值的长度来选定指定的格式: diff --git a/v1.0/sql/literal-value-string-literals.md b/v1.0/sql/literal-value-string-literals.md index 55b2584fe226..e07e5ddbc7f3 100755 --- a/v1.0/sql/literal-value-string-literals.md +++ b/v1.0/sql/literal-value-string-literals.md @@ -50,8 +50,8 @@ SELECT _utf8'some text'; 转义字符: -| 转义序列 | 意义 | -| :-------: | :-------:| +| 转义序列 | 意义 | +| :-------: | :-------:| | \0 | ASCII NUL (X'00') 字符 | | \' | 单引号 | | \" | 双引号 | @@ -72,5 +72,3 @@ SELECT _utf8'some text'; * 在 `'` 中表示 `"` 或者在 `"` 中表示 `'` 都不需要特别的处理。 更多[细节](https://dev.mysql.com/doc/refman/5.7/en/string-literals.html)。 - - diff --git a/v1.0/sql/literal-values.md b/v1.0/sql/literal-values.md index c2494ceba361..9da4c5f32036 100755 --- a/v1.0/sql/literal-values.md +++ b/v1.0/sql/literal-values.md @@ -52,17 +52,17 @@ SELECT _utf8'some text'; 转义字符: -- \\0: ASCII NUL (X'00') 字符 -- \\': 单引号 -- \\": 双引号 -- \\b: 退格符号 -- \\n: 换行符 -- \\r: 回车符 +- \\0: ASCII NUL (X'00') 字符 +- \\': 单引号 +- \\": 双引号 +- \\b: 退格符号 +- \\n: 换行符 +- \\r: 回车符 - \\t: tab 符(制表符) -- \\z: ASCII 26 (Ctrl + Z) -- \\\: 反斜杠 \\ -- \\%: \% -- \\_: \_ +- \\z: ASCII 26 (Ctrl + Z) +- \\\: 反斜杠 \\ +- \\%: \% +- \\_: \_ 如果要在 string literal 中使用 `'` 或者 `"`,有以下几种办法: @@ -211,7 +211,6 @@ mysql> SELECT TRUE, true, tRuE, FALSE, FaLsE, false; * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v1.0/sql/mysql-compatibility.md b/v1.0/sql/mysql-compatibility.md index e8178425ac5b..41c6c9799cf8 100755 --- a/v1.0/sql/mysql-compatibility.md +++ b/v1.0/sql/mysql-compatibility.md @@ -13,7 +13,6 @@ TiDB 支持包括跨行事务,JOIN 及子查询在内的绝大多数 MySQL 的 一些 MySQL 语法在 TiDB 中可以解析通过,但是不会做任何后续的处理,例如 Create Table 语句中 `Engine` 以及 `Partition` 选项,都是解析并忽略。更多兼容性差异请参考具体的文档。 - ## 不支持的特性 * 存储过程 @@ -87,11 +86,12 @@ TiDB 实现了 F1 的异步 Schema 变更算法,DDL 执行过程中不会阻 - 不支持对enum类型的列进行修改 ### 事务 + TiDB 使用乐观事务模型,在执行 Update、Insert、Delete 等语句时,只有在提交过程中才会检查写写冲突,而不是像 MySQL 一样使用行锁来避免写写冲突。所以业务端在执行 SQL 语句后,需要注意检查 commit 的返回值,即使执行时没有出错,commit的时候也可能会出错。 ### Load data -+ 语法: ++ 语法: ```sql LOAD DATA LOCAL INFILE 'file_name' INTO TABLE table_name @@ -102,6 +102,6 @@ TiDB 使用乐观事务模型,在执行 Update、Insert、Delete 等语句时 其中 ESCAPED BY 目前只支持 '/\/\'。 -+ 事务的处理: ++ 事务的处理: TiDB 在执行 load data 时,默认每 2 万行记录作为一个事务进行持久化存储。如果一次 load data 操作插入的数据超过 2 万行,那么会分为多个事务进行提交。如果某个事务出错,这个事务会提交失败,但它前面的事务仍然会提交成功,在这种情况下一次 load data 操作会有部分数据插入成功,部分数据插入失败。而 MySQL 中会将一次 load data 操作视为一个事务,如果其中发生失败情况,将会导致整个 load data 操作失败。 diff --git a/v1.0/sql/numeric-functions-and-operators.md b/v1.0/sql/numeric-functions-and-operators.md index 5ce1b8d7fc98..eda02c8d23cc 100755 --- a/v1.0/sql/numeric-functions-and-operators.md +++ b/v1.0/sql/numeric-functions-and-operators.md @@ -19,7 +19,6 @@ category: user guide ## 数学函数 - | 函数名 | 功能描述 | |:----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------| | [`POW()`](https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_pow) | 返回参数的指定乘方的结果值 | diff --git a/v1.0/sql/precision-math.md b/v1.0/sql/precision-math.md index 014e953b92de..84ed0c8bc065 100755 --- a/v1.0/sql/precision-math.md +++ b/v1.0/sql/precision-math.md @@ -105,7 +105,6 @@ INSERT INTO t SET i = 1/0; | `ERROR_FOR_DIVISION_BY_ZERO` | 有 warning,没有 error,i 被设为 NULL | | strict, `ERROR_FOR_DIVISION_BY_ZERO` | 有 error,插入失败 | - ## 数值修约 `round()` 函数的结果取决于他的参数是否是精确值: diff --git a/v1.0/sql/schema-object-names.md b/v1.0/sql/schema-object-names.md index 22d015be4d79..5234869b196d 100755 --- a/v1.0/sql/schema-object-names.md +++ b/v1.0/sql/schema-object-names.md @@ -61,12 +61,12 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: ``` -`table_name`.`col_name` +`table_name`.`col_name` ``` 而不是: @@ -74,5 +74,5 @@ CREATE TABLE test.t (i int); ``` `table_name.col_name` ``` -更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) +更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) diff --git a/v1.0/sql/transaction-isolation.md b/v1.0/sql/transaction-isolation.md index 848b8a7e3b1e..01c2d6440084 100755 --- a/v1.0/sql/transaction-isolation.md +++ b/v1.0/sql/transaction-isolation.md @@ -3,7 +3,6 @@ title: TiDB 事务隔离级别 category: user guide --- - # TiDB 事务隔离级别 事务隔离级别是数据库事务处理的基础,ACID 中 I,即 Isolation,指的就是事务的隔离性。 @@ -25,7 +24,6 @@ TiDB 使用[percolator事务模型](https://research.google.com/pubs/pub36726.ht ```SET SESSION TRANSACTION ISOLATION LEVEL [read committed|repeatable read]``` - ## 可重复读 可重复读是 TiDB 的默认隔离级别,当事务隔离级别为可重复读时,只能读到该事务启动时已经提交的其他事务修改的数据,未提交的数据或在事务启动后其他事务提交的数据是不可见的。对于本事务而言,事务语句可以看到之前的语句做出的修改。 @@ -72,4 +70,3 @@ MySQL 的可重复读隔离级别并非 snapshot 隔离级别,MySQL 可重复 # The maximum number of retries when commit a transaction. retry-limit = 10 ``` - diff --git a/v1.0/sql/transaction.md b/v1.0/sql/transaction.md index 1d0df11a6cac..333753ef511d 100755 --- a/v1.0/sql/transaction.md +++ b/v1.0/sql/transaction.md @@ -8,23 +8,28 @@ category: user guide TiDB 支持分布式事务。涉及到事务的语句包括 `Autocommit` 变量、 `START TRANSACTION`/`BEGIN`、 `COMMIT` 以及 `ROLLBACK`。 ## 自动提交 + 语法: + ```sql SET autocommit = {0 | 1} ``` + 通过设置 autocommit 的值为 1,可以将当前 Session 设置为自动提交状态,0 则表示当前 Session 为非自动提交状态。默认情况下, autocommit 的值为 1。 在自动提交状态,每条语句运行后,会将其修改自动提交到数据库中。否则,会等到运行 `COMMIT` 语句或者是 `BEGIN` 语句的时候,才会将之前的修改提交到数据库。 另外 autocommit 也是一个 System Variable,所以可以通过变量赋值语句修改当前 Session 或者是 Global 的值。 + ```sql SET @@SESSION.autocommit = {0 | 1}; SET @@GLOBAL.autocommit = {0 | 1}; ``` - ## START TRANSACTION, Begin + 语法: + ```sql BEGIN; @@ -32,35 +37,41 @@ START TRANSACTION; START TRANSACTION WITH CONSISTENT SNAPSHOT; ``` -上述三条语句都是事务开始语句,效果相同。通过事务开始语句可以显式地开始一个新的事务,如果这个时候当前 Session 正在一个事务中间过程中,会将当前事务提交后,开启一个新的事务。 +上述三条语句都是事务开始语句,效果相同。通过事务开始语句可以显式地开始一个新的事务,如果这个时候当前 Session 正在一个事务中间过程中,会将当前事务提交后,开启一个新的事务。 ## COMMIT + 语法: + ```sql COMMIT; ``` -提交当前事务,包括从 `BEGIN` 到 `COMMIT` 之间的所有修改。 +提交当前事务,包括从 `BEGIN` 到 `COMMIT` 之间的所有修改。 ## ROLLBACK + 语法: + ```sql ROLLBACK; ``` -回滚当前事务,撤销从 `BEGIN` 到 `ROLLBACK` 之间的所有修改。 +回滚当前事务,撤销从 `BEGIN` 到 `ROLLBACK` 之间的所有修改。 ## 显式事务和隐式事务 + TiDB 可以显式地使用事务(`BEGIN/COMMIT`) 或者隐式的使用事务 (`SET autocommit = 1`)。 如果在 autocmmit = 1 的状态下,通过 `BEGIN` 语句开启一个新的事务,那么在 `COMMIT`/`ROLLBACK` 之前,会禁用 autocommit,也就是变成显式事务。 对于 DDL 语句,会自动提交并且不能回滚。如果运行 DDL 的时候,正在一个事务的中间过程中,会先将当前的事务提交,再运行 DDL。 - ## 事务隔离级别 + TiDB 默认使用 `SNAPSHOT ISOLATION`,可以通过下面的语句将当前 Session 的隔离级别设置为 `READ COMMITTED`。 + ```sql SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ``` diff --git a/v1.0/sql/util.md b/v1.0/sql/util.md index f18d3b1d2273..5be110f0bb9d 100755 --- a/v1.0/sql/util.md +++ b/v1.0/sql/util.md @@ -74,6 +74,7 @@ label = "cop" ``` 如果电脑上安装了 `dot` 程序 (包含在 graphviz 软件包中),可以通过如下方式生成 PNG 文件: + ```bash dot xx.dot -T png -O @@ -84,7 +85,6 @@ dot xx.dot -T png -O ![Explain Dot](../media/explain_dot.png) - ## `USE` 语句 ```sql diff --git a/v1.0/tools/loader.md b/v1.0/tools/loader.md index c94d653a6fe3..392b2d815d14 100755 --- a/v1.0/tools/loader.md +++ b/v1.0/tools/loader.md @@ -33,13 +33,13 @@ category: advanced ## 使用方法 -#### 注意事项 +### 注意事项 请勿使用 loader 导入 MySQL 实例中 `mysql` 系统数据库到下游 TiDB。 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -53,7 +53,7 @@ category: advanced -V 打印 loader 版本 -c string - 指定配置文件启动 loader + 指定配置文件启动 loader -checkpoint-schema string checkpoint 数据库名,loader 在运行过程中会不断的更新这个数据库,在中断并恢复后,会通过这个库获取上次运行的进度 (默认为 "tidb_loader") -d string @@ -118,18 +118,22 @@ port = 4000 通过命令行参数: - ./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +```bash +./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +``` 或者使用配置文件 "config.toml": - ./bin/loader -c=config.toml +```bash +./bin/loader -c=config.toml +``` ------ -## FAQ +## FAQ + +### 合库合表场景案例说明 -#### 合库合表场景案例说明 - 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 @@ -137,7 +141,7 @@ port = 4000 Loader 需要配置文件中开启 route-rules 参数以提供合库合表功能 -+ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` ++ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` + 如果 `pattern-table` 与 `target-table` 为空,将不进行表名称合并或转换 ``` diff --git a/v1.0/tools/pd-control.md b/v1.0/tools/pd-control.md index 670fa4526db5..203ce05b8c03 100755 --- a/v1.0/tools/pd-control.md +++ b/v1.0/tools/pd-control.md @@ -16,11 +16,15 @@ PD Control 是 PD 的命令行工具,用于获取集群状态信息和调整 单命令模式: - ./pd-ctl store -d -u http://127.0.0.1:2379 +```bash +./pd-ctl store -d -u http://127.0.0.1:2379 +``` 交互模式: - ./pd-ctl -u http://127.0.0.1:2379 +```bash +./pd-ctl -u http://127.0.0.1:2379 +``` 使用环境变量: @@ -29,7 +33,7 @@ export PD_ADDR=http://127.0.0.1:2379 ./pd-ctl ``` -使用TLS加密: +使用 TLS 加密: ```bash ./pd-ctl -u https://127.0.0.1:2379 --cacert="path/to/ca" --cert="path/to/cert" --key="path/to/key" @@ -40,12 +44,12 @@ export PD_ADDR=http://127.0.0.1:2379 ### \-\-pd,-u + 指定 PD 的地址 -+ 默认地址: http://127.0.0.1:2379 ++ 默认地址: `http://127.0.0.1:2379` + 环境变量: PD_ADDR ### \-\-detach,-d -+ 使用单命令行模式(不进入 readline ) ++ 使用单命令行模式(不进入 readline) + 默认值: false ### --cacert @@ -209,7 +213,7 @@ Replica 调度的开销较大,所以这个值不宜调得太大。 示例: ```bash ->> label // 显示所有 label +>> label // 显示所有 label >> label store zone cn // 显示所有包含 label 为 "zone":"cn" 的 store ``` @@ -381,8 +385,3 @@ Protobuf 格式示例: system: 2017-10-09 05:50:59 +0800 CST logic: 120102 ``` - - - - - diff --git a/v1.0/tools/syncer.md b/v1.0/tools/syncer.md index 229a1f9b8c89..454914fc93b9 100755 --- a/v1.0/tools/syncer.md +++ b/v1.0/tools/syncer.md @@ -49,7 +49,7 @@ binlog-pos = 930143241 binlog-gtid = "2bfabd22-fff7-11e6-97f7-f02fa73bcb01:1-23,61ccbb5d-c82d-11e6-ac2e-487b6bd31bf7:1-4" ``` -> **注:** +> **注:** > > - `syncer.meta` 只需要第一次使用的时候配置,后续 Syncer 同步新的 binlog 之后会自动将其更新到最新的 position。 > - 如果使用 binlog position 同步则只需要配置 binlog-name binlog-pos; 使用 gtid 同步则需要设置 gtid,且启动 Syncer 时带有 `--enable-gtid`。 @@ -62,7 +62,7 @@ Syncer 的命令行参数说明: Usage of syncer: -L string 日志等级: debug, info, warn, error, fatal (默认为 "info") - -V + -V 输出 syncer 版本;默认 false -auto-fix-gtid 当 mysql master/slave 切换时,自动修复 gtid 信息;默认 false @@ -71,7 +71,7 @@ Usage of syncer: -c int syncer 处理 batch 线程数 (默认 16) -config string - 指定相应配置文件启动 sycner 服务;如 `--config config.toml` + 指定相应配置文件启动 sycner 服务;如 `--config config.toml` -enable-gtid 使用 gtid 模式启动 syncer;默认 false,开启前需要上游 MySQL 开启 GTID 功能 -log-file string @@ -107,19 +107,19 @@ status-addr = "127.0.0.1:10086" # skip-ddls 可以跳过与 TiDB 不兼容的 DDL 语句,支持正则语法。 # skip-ddls = ["^CREATE\\s+USER"] -# 注意: skip-events 已经废弃, 请使用 skip-dmls +# 注意: skip-events 已经废弃, 请使用 skip-dmls # skip-dmls 用于跳过 DML 语句. type 字段取值为 'insert', 'update', 'delete'。 # 下面的例子为跳过 foo.bar 表的所有 delete 语句。 # [[skip-dmls]] # db-name = "foo" # tbl-name = "bar" # type = "delete" -# +# # 下面的例子为跳过所有表的 delete 语句。 # [[skip-dmls]] # type = "delete" -# -# 下面的例子为跳过 foo 库中所有表的 delete 语句。 +# +# 下面的例子为跳过 foo 库中所有表的 delete 语句。 # [[skip-dmls]] # db-name = "foo" # type = "delete" @@ -132,7 +132,7 @@ status-addr = "127.0.0.1:10086" #[[replicate-do-table]] #db-name ="dbname" #tbl-name = "table-name" - + #[[replicate-do-table]] #db-name ="dbname1" #tbl-name = "table-name1" @@ -239,7 +239,7 @@ syncer-binlog = (ON.000001, 2504), syncer-binlog-gtid = 53ea0ed1-9bf8-11e6-8bea- 本部分将通过实际案例描述 Syncer 同步数据库参数的优先级关系。 -- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) +- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) - 优先级:replicate-do-db --> replicate-do-table --> replicate-ignore-db --> replicate-ignore-table ```toml @@ -307,7 +307,7 @@ tbl-name = "~^2016_.*" # 场景如下: # 数据库A 下有 order_2016 / history_2016 等多个数据库 # 数据库B 下有 order_2017 / history_2017 等多个数据库 -# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 +# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 # 指定同步数据表B order_2017 数据库,数据表如下 2017_01 2017_02 ... 2017_12 # 表内使用 order_id 作为主键,数据之间主键不冲突 # 忽略同步 history_2016 与 history_2017 数据库 @@ -340,13 +340,13 @@ target-table = "order_2017" 1. 源库 server-id 检查 - - 可通过以下命令查看 server-id + - 可通过以下命令查看 server-id - 结果为空或者为 0,Syncer 无法同步数据 - Syncer server-id 与 MySQL server-id 不能相同,且在 MySQL cluster 中唯一 ``` mysql> show global variables like 'server_id'; - +---------------+------- + +---------------+------- | Variable_name | Value | +---------------+-------+ | server_id | 1 | @@ -413,6 +413,7 @@ target-table = "order_2017" mysql> set global binlog_row_image = FULL; Query OK, 0 rows affected (0.01 sec) ``` + 5. 检查 mydumper 用户权限 - mydumper 导出数据至少拥有以下权限:`select, reload` @@ -421,15 +422,15 @@ target-table = "order_2017" 6. 检查上下游同步用户权限 - 需要上游 MySQL 同步账号至少赋予以下权限: - - ` select , replication slave , replication client` - + + `select, replication slave, replication client` + - 下游 TiDB 可暂时采用 root 同权限账号 7. 检查 GTID 与 POS 相关信息 - 使用以下语句查看 binlog 内容: - + `show binlog events in 'mysql-bin.000023' from 136676560 limit 10;` ## 监控方案 @@ -466,13 +467,13 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 #### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: http://localhost:3000 ,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin,密码: admin) + 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 Dashboard [配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source -### Grafana Syncer metrics 说明 +### Grafana Syncer metrics 说明 #### title: binlog events @@ -494,7 +495,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_gtid` - info: Syncer 同步当前 master binlog 的 binlog-gtid 信息 -#### title: syncer_binlog_file +#### title: syncer_binlog_file (new) - metrics: `syncer_binlog_file{node="master"} - ON(instance, job) syncer_binlog_file{node="syncer"}` - info: 上游与下游同步时,相差的 binlog 文件数量,正常状态为 0,表示数据正在实时同步。数值越大,表示相差的 binlog 文件数量越多。 diff --git a/v1.0/tools/tidb-binlog-kafka.md b/v1.0/tools/tidb-binlog-kafka.md index 438fd448eaed..407e5c6ec2a5 100755 --- a/v1.0/tools/tidb-binlog-kafka.md +++ b/v1.0/tools/tidb-binlog-kafka.md @@ -24,15 +24,15 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为三个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 主机的后台运行。其主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入 Kafka 中。 -#### Drainer +### Drainer Drainer 从 Kafka 中收集 Binlog,并按照 TiDB 中事务的提交顺序转化为指定数据库兼容的 SQL 语句,最后同步到目的数据库或者写到顺序文件。 -#### Kafka & ZooKeeper +### Kafka & ZooKeeper Kafka 集群用来存储由 Pump 写入的 Binlog 数据,并提供给 Drainer 进行读取。 @@ -73,10 +73,10 @@ cd tidb-binlog-latest-linux-amd64 为了保证数据的完整性,在 Pump 运行 10 分钟左右后按顺序进行如下操作: - * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 generate_binlog_position 工具生成 Drainer 启动需要的 savepoint 文件中,make generate_binlog_position 编译该工具。具体使用参考工具的 README 说明,也可以直接下载获取该工具:[generate_binlog_position](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.tar.gz), 并使用sha256sum验证该文件 [sha256](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.sha256)。 - * 全量备份,例如 mydumper 备份 TiDB - * 全量导入备份到目标系统 - * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${commitTS}` + * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 generate_binlog_position 工具生成 Drainer 启动需要的 savepoint 文件中,make generate_binlog_position 编译该工具。具体使用参考工具的 README 说明,也可以直接下载获取该工具:[generate_binlog_position](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.tar.gz), 并使用sha256sum验证该文件 [sha256](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.sha256)。 + * 全量备份,例如 mydumper 备份 TiDB + * 全量导入备份到目标系统 + * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${commitTS}` * Drainer 输出的 pb,要在配置文件中设置如下参数: @@ -188,22 +188,22 @@ ZK3="192.168.0.11" # Pump 对外提供服务的 RPC 地址("192.168.0.10:8250") advertise-addr = "" - + # binlog 最大保留天数 (默认 7),设置为 0 可永久保存 gc = 7 - + # Pump 数据存储位置路径 data-dir = "data.pump" - + # ZooKeeper 地址,设置该选项从 ZooKeeper 中获取 Kafka 地址 # ZooKeeper-addrs = "192.168.0.11:2181,192.168.0.12:2181,192.168.0.13:2181" # Pump 向 PD 发送心跳的间隔 (单位 秒) heartbeat-interval = 3 - + # PD 集群节点的地址 pd-urls = "http://192.168.0.16:2379,http://192.168.0.15:2379,http://192.168.0.14:2379" - + # unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) socket = "unix:///tmp/pump.sock" ``` @@ -378,7 +378,7 @@ PbReader 使用示例 + 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号:admin,密码:admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 - + > **注:**Type 选 Prometheus,URL 为 Prometheus 地址,根据实际情况添加/填写。 + 导入 dashboard 配置文件 diff --git a/v1.0/tools/tidb-binlog.md b/v1.0/tools/tidb-binlog.md index 06e0e4b21309..280eecf5fb3f 100755 --- a/v1.0/tools/tidb-binlog.md +++ b/v1.0/tools/tidb-binlog.md @@ -22,11 +22,11 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为两个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 的主机上后台运行。他的主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入磁盘文件 -#### Drainer +### Drainer Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提交顺序转化为指定数据库兼容的 SQL 语句,最后同步到目的数据库或者写到顺序文件 @@ -34,7 +34,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 ### 下载官方 Binary -- CentOS 7+ +- CentOS 7+ ```bash # 下载压缩包 @@ -53,26 +53,25 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 注意 -* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 -* 手动部署时, 启动优先级为: PUMP > TiDB ; 停止优先级为 TiDB > PUMP - +* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 +* 手动部署时, 启动优先级为: PUMP > TiDB ; 停止优先级为 TiDB > PUMP 我们设置 TiDB 启动参数 binlog-socket 为对应的 pump 的参数 socket 所指定的 unix socket 文件路径,最终部署结构如下图所示: ![TiDB pump 模块部署结构](../media/tidb-pump-deployment.png) -* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 +* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 -* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; +* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; 为了保证数据的完整性,在 pump 运行 10 分钟左右后按顺序进行下面的操作 - * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` - * 全量备份,例如 mydumper 备份 tidb - * 全量导入备份到目标系统 - * 设置 savepoint 文件路径,然后启动 drainer, `bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` + * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` + * 全量备份,例如 mydumper 备份 tidb + * 全量导入备份到目标系统 + * 设置 savepoint 文件路径,然后启动 drainer, `bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` -* drainer 输出的 pb, 需要在配置文件设置下面的参数 +* drainer 输出的 pb, 需要在配置文件设置下面的参数 ```toml [syncer] @@ -83,17 +82,16 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 dir = "/path/pb-dir" ``` - #### 使用 tidb-ansible 部署 PUMP (推荐) -* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer +* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook deploy.yml * 执行 ansible-playbook start.yml * drainer 目前需要手动部署 -* 对已有的 TiDB Cluster 部署 binlog +* 对已有的 TiDB Cluster 部署 binlog * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook rolling_update.yml --tags=tidb @@ -136,7 +134,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) ``` - 2. PUMP 配置文件 ```toml @@ -156,6 +153,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 # unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) socket = "unix:///tmp/pump.sock" ``` + 3. 启动示例 ```bash @@ -164,7 +162,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 使用 Binary 部署 Drainer -1. Drainer 命令行参数说明 +1. Drainer 命令行参数说明 ``` Usage of drainer: @@ -207,7 +205,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 输出到下游数据库一个事务的 sql 数量 (default 1) ``` - 2. Drainer 配置文件 ```toml @@ -275,7 +272,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 # dir = "data.drainer" ``` - 3. 启动示例 ```bash @@ -294,10 +290,10 @@ drainer 启动时可以设置 `--metrics-addr` 和 `--metrics-interval` 两个 ### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 ( 注: Type 选 Prometheus,Url 为 Prometheus 地址,根据实际情况 添加/填写 ) -+ 导入 dashboard 配置文件 ++ 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 [dashboard 配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source diff --git a/v1.0/trouble-shooting.md b/v1.0/trouble-shooting.md index d92ebfa2e3f9..f2e194bf4705 100755 --- a/v1.0/trouble-shooting.md +++ b/v1.0/trouble-shooting.md @@ -8,6 +8,7 @@ category: advanced 当试用 TiDB 遇到问题时,请先参考本篇文档。如果问题未解决,请按文档要求收集必要的信息通过 Github [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new)。 ## 如何给 TiDB 开发者报告错误 + 当使用 TiDB 遇到问题并且通过后面所列信息无法解决时,请收集以下信息并[创建新 Issue](https://github.com/pingcap/tidb/issues/new): + 具体的出错信息以及正在执行的操作 @@ -16,26 +17,27 @@ category: advanced + 机器配置以及部署拓扑 + dmesg 中 TiDB 组件相关的问题 - ## 数据库连接不上 首先请确认集群的各项服务是否已经启动,包括 tidb-server、pd-server、tikv-server。请用 ps 命令查看所有进程是否在。如果某个组件的进程已经不在了,请参考对应的章节排查错误。 如果所有的进程都在,请查看 tidb-server 的日志,看是否有报错?常见的错误包括: -+ InformationSchema is out of date ++ InformationSchema is out of date 无法连接 tikv-server,请检查 pd-server 以及 tikv-server 的状态和日志。 -+ panic + ++ panic 程序有错误,请将具体的 panic log [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new)。 如果是清空数据并重新部署服务,请确认以下信息: -+ pd-server、tikv-server 数据都已清空 ++ pd-server、tikv-server 数据都已清空 tikv-server 存储具体的数据,pd-server 存储 tikv-server 中数据的的元信息。如果只清空 pd-server 或只清空 tikv-server 的数据,会导致两边数据不匹配。 -+ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server + ++ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server 集群 ID 是由 pd-server 在集群初始化时随机分配,所以重新部署集群后,集群 ID 会发生变化。tidb-server 业务需要重启以获取新的集群 ID。 @@ -43,13 +45,15 @@ category: advanced tidb-server 无法启动的常见情况包括: -+ 启动参数错误 ++ 启动参数错误 请参考[TiDB 命令行参数](op-guide/configuration.md#tidb)文档。 -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 tidb-server 启动所需要的端口未被占用。 -+ 无法连接 pd-server + ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志,确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 @@ -62,50 +66,53 @@ tidb-server 无法启动的常见情况包括: ## tikv-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[TiKV 启动参数](op-guide/configuration.md#tikv)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tikv-server 启动所需要的端口未被占用: `lsof -i:port`。 -+ 无法连接 pd-server + ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志。确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 - 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性, - 确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 + 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性,确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 -+ 文件被占用 ++ 文件被占用 不要在一个数据库文件目录上打开两个 tikv。 ## pd-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[PD 命令行参数](op-guide/configuration.md#placement-driver-pd)文档。 -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 pd-server 启动所需要的端口未被占用: `lsof -i:port`。 ## TiDB/TiKV/PD 进程异常退出 -+ 进程是否是启动在前台 ++ 进程是否是启动在前台 当前终端退出给其所有子进程发送 HUP 信号,从而导致进程退出。 -+ 是否是在命令行用过 `nohup+&` 方式直接运行 + ++ 是否是在命令行用过 `nohup+&` 方式直接运行 这样依然可能导致进程因终端连接突然中断,作为终端 SHELL 的子进程被杀掉。 + 推荐将启动命令写在脚本中,通过脚本运行(相当于二次 fork 启动)。 ## TiKV 进程异常重启 -+ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 ++ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 如果有 OOM 信息并且杀掉的进程为 TiKV,请减少 TiKV 的 RocksDB 的各个 CF 的 `block-cache-size` 值。 -+ 检查 TiKV 日志是否有 panic 的 log ++ 检查 TiKV 日志是否有 panic 的 log 提交 Issue 并附上 panic 的 log。 diff --git a/v2.0/README.md b/v2.0/README.md index a6091eb03c03..a7a9b894ae20 100755 --- a/v2.0/README.md +++ b/v2.0/README.md @@ -1,11 +1,14 @@ # TiDB 中文技术文档 + + + ## 目录 + TiDB 简介与整体架构 - [TiDB 简介](overview.md#tidb-简介) - [TiDB 整体架构](overview.md#tidb-整体架构) -- [TiDB 快速入门指南](QUICKSTART.md) ++ [TiDB 快速入门指南](QUICKSTART.md) + TiDB 用户文档 + TiDB 数据库管理 - [TiDB 服务](sql/tidb-server.md) @@ -73,7 +76,7 @@ - [历史数据回溯](op-guide/history-read.md) + TiDB 运维文档 - [软硬件环境需求](op-guide/recommendation.md) - + 部署集群  + + 部署集群 - [Ansible 部署方案(强烈推荐)](op-guide/ansible-deployment.md) - [离线 Ansible 部署方案](op-guide/offline-ansible-deployment.md) - [Docker 部署方案](op-guide/docker-deployment.md) @@ -141,8 +144,6 @@ - [Weekly](https://pingcap.com/weekly/) - [英文文档](https://pingcap.com/docs) - - ## TiDB 简介 TiDB 是 PingCAP 公司受 Google [Spanner](http://research.google.com/archive/spanner.html) / [F1](http://research.google.com/pubs/pub41344.html) 论文启发而设计的开源分布式 NewSQL 数据库。 @@ -199,14 +200,14 @@ TiKV Server 负责存储数据,从外部看 TiKV 是一个分布式的提供 高可用是 TiDB 的另一大特点,TiDB/TiKV/PD 这三个组件都能容忍部分实例失效,不影响整个集群的可用性。下面分别说明这三个组件的可用性、单个实例失效后的后果以及如何恢复。 -+ TiDB ++ TiDB TiDB 是无状态的,推荐至少部署两个实例,前端通过负载均衡组件对外提供服务。当单个实例失效时,会影响正在这个实例上进行的 Session,从应用的角度看,会出现单次请求失败的情况,重新连接后即可继续获得服务。单个实例失效后,可以重启这个实例或者部署一个新的实例。 -+ PD ++ PD PD 是一个集群,通过 Raft 协议保持数据的一致性,单个实例失效时,如果这个实例不是 Raft 的 leader,那么服务完全不受影响;如果这个实例是 Raft 的 leader,会重新选出新的 Raft leader,自动恢复服务。PD 在选举的过程中无法对外提供服务,这个时间大约是3秒钟。推荐至少部署三个 PD 实例,单个实例失效后,重启这个实例或者添加新的实例。 -+ TiKV ++ TiKV TiKV 是一个集群,通过 Raft 协议保持数据的一致性(副本数量可配置,默认保存三副本),并通过 PD 做负载均衡调度。单个节点失效时,会影响这个节点上存储的所有 Region。对于 Region 中的 Leader 节点,会中断服务,等待重新选举;对于 Region 中的 Follower 节点,不会影响服务。当某个 TiKV 节点失效,并且在一段时间内(默认 10 分钟)无法恢复,PD 会将其上的数据迁移到其他的 TiKV 节点上。 diff --git a/v2.0/benchmark/sysbench.md b/v2.0/benchmark/sysbench.md index 482269baf095..b8cfff71cd78 100755 --- a/v2.0/benchmark/sysbench.md +++ b/v2.0/benchmark/sysbench.md @@ -1,45 +1,47 @@ --- title: TiDB Sysbench 性能测试报告 - v1.0.0 -category: benchmark +category: benchmark draft: true ---- +--- # TiDB Sysbench 性能测试报告 - v1.0.0 ## 测试目的 + 测试 TiDB 在 OLTP 场景下的性能以及水平扩展能力。 -> **注意**: 不同的测试环境可能使测试结果发生改变。 +> **注意**: +> +> 不同的测试环境可能使测试结果发生改变。 -## 测试版本、时间、地点 +## 测试版本、时间、地点 -TiDB 版本:v1.0.0 +TiDB 版本:v1.0.0 时间:2017 年 10 月 20 日 -地点:北京 +地点:北京 ## 测试环境 - - IDC机器 - + +IDC 机器 + | 类别 | 名称 | | :--------: | :---------: | | OS | linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5T SSD * 2 + Optane SSD * 1 | - -Sysbench 版本: 1.0.6 +| DISK | 1.5T SSD \* 2 + Optane SSD * 1 | -测试脚本: https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench +Sysbench 版本: 1.0.6 +测试脚本: ## 测试方案 ### 场景一:sysbench 标准性能测试 -测试表结构 +测试表结构 -``` +``` CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned NOT NULL DEFAULT '0', @@ -47,26 +49,27 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB -``` - -部署方案以及配置参数 -``` +) ENGINE=InnoDB +``` + +部署方案以及配置参数 + +``` // TiDB 部署方案 -172.16.20.4 4*tikv 1*tidb 1*sysbench -172.16.20.6 4*tikv 1*tidb 1*sysbench -172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.20.4 4*tikv 1*tidb 1*sysbench +172.16.20.6 4*tikv 1*tidb 1*sysbench +172.16.20.7 4*tikv 1*tidb 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench -// 每个物理节点有三块盘: -data3: 2 tikv (Optane SSD) -data2: 1 tikv -data1: 1 tikv +// 每个物理节点有三块盘: +data3: 2 tikv (Optane SSD) +data2: 1 tikv +data1: 1 tikv -// TiKV 参数配置 +// TiKV 参数配置 sync-log = false grpc-concurrency = 8 -grpc-raft-conn-num = 24 +grpc-raft-conn-num = 24 [defaultcf] block-cache-size = "12GB" [writecf] @@ -76,22 +79,22 @@ block-cache-size = "2GB" // Mysql 部署方案 // 分别使用半同步复制和异步复制,部署两副本 -172.16.20.4 master -172.16.20.6 slave +172.16.20.4 master +172.16.20.6 slave 172.16.20.7 slave -172.16.10.8 1*sysbench +172.16.10.8 1*sysbench Mysql version: 5.6.37 // Mysql 参数配置 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql -max_connections = 2000 -``` +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql +max_connections = 2000 +``` -* 标准 oltp 测试 +* 标准 oltp 测试 | - | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | @@ -106,11 +109,11 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 1902 | 38045 | 134.56 ms / 363.18 ms | | Mysql | 32 | 1000 万 | 256 | 1770 | 35416 | 144.55 ms / 383.33 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) +![threads_oltp](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) +![table_size_oltp](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) -* 标准 select 测试 +* 标准 select 测试 | - | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -125,9 +128,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 386866 | 0.66 ms / 1.64 ms | | Mysql | 32 | 1000 万 | 256 | 388273 | 0.66 ms / 1.64 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) +![threads_select](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) +![table_size_select](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -142,40 +145,39 @@ max_connections = 2000 | Mysql | 32 | 100 万 | 128 | 14884 | 8.58 ms / 21.11 ms | | Mysql | 32 | 100 万 | 256 | 14508 | 17.64 ms / 44.98 ms | | Mysql | 32 | 500 万 | 256 | 10593 | 24.16 ms / 82.96 ms | -| Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | - -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +| Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) +![threads_insert](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +![table_size_insert](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) ### 场景二:TiDB 水平扩展能力测试 -部署方案以及配置参数 +部署方案以及配置参数 ``` -// TiDB 部署方案 -172.16.20.3 4*tikv +// TiDB 部署方案 +172.16.20.3 4*tikv 172.16.10.2 1*tidb 1*pd 1*sysbench -每个物理节点有三块盘: -data3: 2 tikv (Optane SSD) -data2: 1 tikv -data1: 1 tikv +每个物理节点有三块盘: +data3: 2 tikv (Optane SSD) +data2: 1 tikv +data1: 1 tikv -// TiKV 参数配置 +// TiKV 参数配置 sync-log = false grpc-concurrency = 8 -grpc-raft-conn-num = 24 +grpc-raft-conn-num = 24 [defaultcf] block-cache-size = "12GB" [writecf] block-cache-size = "5GB" [raftdb.defaultcf] block-cache-size = "2GB" -``` +``` -* 标准 oltp 测试 +* 标准 oltp 测试 | - | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | @@ -184,11 +186,9 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 8984 | 179692 | 114.96 ms / 176.73 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 12953 | 259072 | 117.80 ms / 200.47 ms | +![scale_tidb_oltp](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) - - -* 标准 select 测试 +* 标准 select 测试 | - | table count | table size | sysbench threads | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -197,10 +197,9 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 289933 | 3.53 ms / 8.74 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 435313 | 3.55 ms / 9.17 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_select](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) - -* 标准 insert 测试 +* 标准 insert 测试 | - | table count | table size | sysbench threads | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -208,4 +207,4 @@ block-cache-size = "2GB" | 5 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 60689 | 37.96 ms / 29.9 ms | | 7 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 80087 | 9.62 ms / 21.37 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) +![scale_tikv_insert](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) diff --git a/v2.0/op-guide/backup-restore.md b/v2.0/op-guide/backup-restore.md index 49f87122b4f5..4f2f2408e01d 100755 --- a/v2.0/op-guide/backup-restore.md +++ b/v2.0/op-guide/backup-restore.md @@ -7,7 +7,6 @@ category: advanced ## 概述 - 该文档详细介绍了如何对 TiDB 进行备份恢复。本文档暂时只考虑全量备份与恢复。 这里我们假定 TiDB 服务信息如下: @@ -16,13 +15,11 @@ category: advanced |----|-------|----|----|--------| |TiDB|127.0.0.1|4000|root|*| - 在这个备份恢复过程中,我们会用到下面的工具: - mydumper 从 TiDB 导出数据 - loader 导入数据到 TiDB - ### 下载 TiDB 工具集 (Linux) ```bash @@ -37,7 +34,6 @@ tar -xzf tidb-enterprise-tools-latest-linux-amd64.tar.gz cd tidb-enterprise-tools-latest-linux-amd64 ``` - ## 使用 `mydumper`/`loader` 全量备份恢复数据 `mydumper` 是一个强大的数据备份工具,具体可以参考 [https://github.com/maxbube/mydumper](https://github.com/maxbube/mydumper)。 @@ -47,19 +43,21 @@ cd tidb-enterprise-tools-latest-linux-amd64 > 注意:虽然 TiDB 也支持使用 MySQL 官方的 `mysqldump` 工具来进行数据的备份恢复工作,但相比于 `mydumper` / `loader`,性能会慢很多,大量数据的备份恢复会花费很多时间,这里我们并不推荐。 ### `mydumper`/`loader` 全量备份恢复最佳实践 + 为了快速的备份恢复数据 (特别是数据量巨大的库), 可以参考下面建议 -* 使用 mydumper 导出来的数据文件尽可能的小, 最好不要超过 64M, 可以设置参数 -F 64 +* 使用 mydumper 导出来的数据文件尽可能的小, 最好不要超过 64M, 可以设置参数 -F 64 * loader的 `-t` 参数可以根据 tikv 的实例个数以及负载进行评估调整,例如 3个 tikv 的场景, 此值可以设为 `3 *(1 ~ n)`;当 tikv 负载过高,loader 以及 tidb 日志中出现大量 `backoffer.maxSleep 15000ms is exceeded` 可以适当调小该值,当 tikv 负载不是太高的时候,可以适当调大该值。 #### 某次数据恢复示例,以及相关的配置 - - mydumper 导出后总数据量 214G,单表 8 列,20 亿行数据 - - 集群拓扑 - - TIKV * 12 - - TIDB * 4 - - PD * 3 - - mydumper -F 设置为 16, loader -t 参数 64 - + +- mydumper 导出后总数据量 214G,单表 8 列,20 亿行数据 +- 集群拓扑 + - TIKV * 12 + - TIDB * 4 + - PD * 3 +- mydumper -F 设置为 16, loader -t 参数 64 + 结果:导入时间 11 小时左右,19.4 G/小时 ### 从 TiDB 备份数据 @@ -76,8 +74,6 @@ cd tidb-enterprise-tools-latest-linux-amd64 `--skip-tz-utc` 添加这个参数忽略掉 TiDB 与导数据的机器之间时区设置不一致的情况,禁止自动转换。 - - ### 向 TiDB 恢复数据 我们使用 `loader` 将之前导出的数据导入到 TiDB,完成恢复操作。Loader 的下载和具体的使用方法见 [Loader 使用文档](../tools/loader.md) diff --git a/v2.0/op-guide/binary-deployment.md b/v2.0/op-guide/binary-deployment.md index 79e7fc69bcb5..e3d0190e7f07 100755 --- a/v2.0/op-guide/binary-deployment.md +++ b/v2.0/op-guide/binary-deployment.md @@ -5,7 +5,6 @@ category: deployment # TiDB Binary 部署指导 - ## 概述 一个完整的 TiDB 集群包括 PD,TiKV 以及 TiDB。启动顺序依次是 PD,TiKV 以及 TiDB。在关闭数据库服务时,请按照启动的相反顺序进行逐一关闭服务。 @@ -33,7 +32,6 @@ category: deployment | PD | 2379 | TCP | 提供 TiDB 和 PD 通信端口 | | PD | 2380 | TCP | PD 集群节点间通信端口 | - ### 2. TiDB 数据库组件(选装) | 组件 | 默认端口 | 协议 | 说明 | @@ -61,7 +59,6 @@ category: deployment | :-- | :---------------------------- | | 防火墙 / 端口 | 请查看 TiDB 所需端口在各个节点之间是否能正常访问 | - ### 操作系统参数 | 配置 | 说明 | @@ -178,6 +175,7 @@ cd tidb-latest-linux-amd64 --path="127.0.0.1:2379" \ --log-file=tidb.log ``` + 步骤四. 使用 MySQL 客户端连接 TiDB: ``` @@ -238,6 +236,7 @@ mysql -h 127.0.0.1 -P 4000 -u root -D test --path="192.168.199.113:2379" \ --log-file=tidb.log ``` + 步骤四. 使用 MySQL 客户端连接 TiDB: ``` @@ -360,7 +359,7 @@ tar -xzf pushgateway-0.3.1.linux-amd64.tar.gz ### 启动监控服务 -### 在 node1,node2,node3,node4 启动 `node_exporter`: +### 在 node1,node2,node3,node4 启动 `node_exporter` ``` $cd node_exporter-0.14.0-rc.1.linux-amd64 @@ -370,7 +369,7 @@ $cd node_exporter-0.14.0-rc.1.linux-amd64 --log.level="info" ``` -### 在 node1 启动 pushgateway: +### 在 node1 启动 pushgateway ``` $cd pushgateway-0.3.1.linux-amd64 @@ -381,7 +380,7 @@ $cd pushgateway-0.3.1.linux-amd64 --web.listen-address=":9091" ``` -### 在 node1 启动 Prometheus: +### 在 node1 启动 Prometheus ``` $cd prometheus-1.5.2.linux-amd64 @@ -426,7 +425,7 @@ scrape_configs: --storage.local.retention="360h0m0s" ``` -### 在 node1 启动 Grafana: +### 在 node1 启动 Grafana ``` cd grafana-4.1.2-1486989747.linux-x64 diff --git a/v2.0/op-guide/docker-deployment.md b/v2.0/op-guide/docker-deployment.md index 8518429f23ff..7127eaf69a9a 100755 --- a/v2.0/op-guide/docker-deployment.md +++ b/v2.0/op-guide/docker-deployment.md @@ -12,6 +12,7 @@ category: deployment ## 环境准备 ### 安装 Docker + Docker 可以方便地在 Linux / Mac OS / Windows 平台安装,安装方法请参考 [Docker 官方文档](https://www.docker.com/products/docker)。 ### 拉取 TiDB 的 Docker 镜像 @@ -43,7 +44,6 @@ docker pull pingcap/pd:latest | host5 | 192.168.1.105 | TiKV2 | /data | | host6 | 192.168.1.106 | TiKV3 | /data | - ### 启动 PD 登录 **host1** 执行: diff --git a/v2.0/op-guide/generate-self-signed-certificates.md b/v2.0/op-guide/generate-self-signed-certificates.md index c993f30c4a30..ac33d1240edc 100755 --- a/v2.0/op-guide/generate-self-signed-certificates.md +++ b/v2.0/op-guide/generate-self-signed-certificates.md @@ -20,8 +20,6 @@ category: deployment | node5 | 172.16.10.5 | TiKV2 | | node6 | 172.16.10.6 | TiKV3 | - - ## 下载 cfssl 假设使用 x86_64 Linux 主机: @@ -34,11 +32,9 @@ chmod +x ~/bin/{cfssl,cfssljson} export PATH=$PATH:~/bin ``` - - ## 初始化证书颁发机构 -生成 cfssl 的默认配置,以便于之后修改: +生成 cfssl 的默认配置,以便于之后修改: ```bash mkdir ~/cfssl @@ -47,20 +43,18 @@ cfssl print-defaults config > ca-config.json cfssl print-defaults csr > ca-csr.json ``` - - ## 生成证书 -#### 证书介绍 +### 证书介绍 - tidb-server certificate 由 TiDB 使用,为其他组件和客户端验证 TiDB 身份。 - tikv-server certificate 由 TiKV 使用,为其他组件和客户端验证 TiKV 身份。 - pd-server certificate 由 PD 使用,为其他组件和客户端验证 PD 身份。 - client certificate 用于通过 PD、TiKV、TiDB 验证客户端。例如 `pd-ctl`,`tikv-ctl`,`pd-recover`。 -#### 配置 CA 选项 +### 配置 CA 选项 -根据实际需求修改 `ca-config.json` : +根据实际需求修改 `ca-config.json` : ```json { @@ -91,7 +85,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { @@ -111,7 +105,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -#### 生成 CA 证书 +### 生成 CA 证书 ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - @@ -125,7 +119,7 @@ ca.csr ca.pem ``` -#### 生成服务器端证书 +### 生成服务器端证书 `hostname` 中为各组件的 IP 地址,以及 `127.0.0.1` @@ -145,7 +139,7 @@ tidb-server.csr tikv-server.csr pd-server.csr tidb-server.pem tikv-server.pem pd-server.pem ``` -#### 生成客户端证书 +### 生成客户端证书 ```bash echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client -hostname="" - | cfssljson -bare client @@ -154,9 +148,7 @@ echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gen 将会生成以下几个文件: ```bash -client-key.pem -client.csr -client.pem +client-key.pem +client.csr +client.pem ``` - -### diff --git a/v2.0/op-guide/migration-overview.md b/v2.0/op-guide/migration-overview.md index eedce7b64aae..4648f703fab1 100755 --- a/v2.0/op-guide/migration-overview.md +++ b/v2.0/op-guide/migration-overview.md @@ -28,19 +28,17 @@ category: advanced - 第一种场景:只全量导入历史数据 (需要 checker + mydumper + loader); - 第二种场景:全量导入历史数据后,通过增量的方式同步新的数据 (需要 checker + mydumper + loader + syncer)。该场景需要提前开启 binlog 且格式必须为 ROW。 - ## MySQL 开启 binlog **注意: 只有上文提到的第二种场景才需要在 dump 数据之前先开启 binlog** -+ MySQL 开启 binlog 功能,参考 [Setting the Replication Master Configuration](http://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html) -+ Binlog 格式必须使用 `ROW` format,这也是 MySQL 5.7 之后推荐的 binlog 格式,可以使用如下语句打开: ++ MySQL 开启 binlog 功能,参考 [Setting the Replication Master Configuration](http://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html) ++ Binlog 格式必须使用 `ROW` format,这也是 MySQL 5.7 之后推荐的 binlog 格式,可以使用如下语句打开: ```sql SET GLOBAL binlog_format = ROW; ``` - ## 使用 checker 进行 Schema 检查 在迁移之前,我们可以使用 TiDB 的 checker 工具,来预先检查 TiDB 是否能支持需要迁移的 table schema。如果 check 某个 table schema 失败,表明 TiDB 当前并不支持,我们不能对该 table 里面的数据进行迁移。checker 包含在 TiDB 工具集里面,我们可以直接下载。 @@ -61,7 +59,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 ### 使用 checker 检查的一个示范 -+ 在 MySQL 的 test database 里面创建几张表,并插入数据: ++ 在 MySQL 的 test database 里面创建几张表,并插入数据: ```sql USE test; @@ -72,7 +70,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 INSERT INTO t2 VALUES (1, "a"), (2, "b"), (3, "c"); ``` -+ 使用 checker 检查 test database 里面所有的 table ++ 使用 checker 检查 test database 里面所有的 table ```bash ./bin/checker -host 127.0.0.1 -port 3306 -user root test @@ -84,7 +82,7 @@ cd tidb-enterprise-tools-latest-linux-amd64 2016/10/27 13:11:49 checker.go:69: [info] Check table t2 succ ``` -+ 使用 checker 检查 test database 里面某一个 table ++ 使用 checker 检查 test database 里面某一个 table 这里,假设我们只需要迁移 table `t1`。 diff --git a/v2.0/op-guide/migration.md b/v2.0/op-guide/migration.md index deeccc48fda8..09c8234a7bd1 100755 --- a/v2.0/op-guide/migration.md +++ b/v2.0/op-guide/migration.md @@ -204,7 +204,6 @@ status-addr = "127.0.0.1:10086" #db-name ="test" #tbl-name = "~^a.*" - # sharding 同步规则,采用 wildcharacter # 1. 星号字符 (*) 可以匹配零个或者多个字符, # 例子, doc* 匹配 doc 和 document, 但是和 dodo 不匹配; @@ -272,7 +271,6 @@ mysql> select * from t1; `syncer` 每隔 30s 会输出当前的同步统计,如下 - ```bash 2017/06/08 01:18:51 syncer.go:934: [info] [syncer]total events = 15, total tps = 130, recent tps = 4, master-binlog = (ON.000001, 11992), master-binlog-gtid=53ea0ed1-9bf8-11e6-8bea-64006a897c73:1-74, diff --git a/v2.0/op-guide/monitor-overview.md b/v2.0/op-guide/monitor-overview.md index 421aa3c8284b..8342c73f06d7 100755 --- a/v2.0/op-guide/monitor-overview.md +++ b/v2.0/op-guide/monitor-overview.md @@ -16,6 +16,3 @@ Prometheus 提供了多个组件供用户使用。目前,我们使用 Promethe Grafana 是一个开源的 metric 分析及可视化系统。我们使用 Grafana 来展示 TiDB 的各项性能指标 。如下图所示: ![Grafana Screeshot](../media/grafana-screenshot.png) - - - diff --git a/v2.0/op-guide/offline-ansible-deployment.md b/v2.0/op-guide/offline-ansible-deployment.md index f4c63f2aa08a..017c50edb653 100755 --- a/v2.0/op-guide/offline-ansible-deployment.md +++ b/v2.0/op-guide/offline-ansible-deployment.md @@ -7,21 +7,21 @@ category: deployment ## 准备机器 -1. 下载机一台 +1. 下载机一台 - 该机器需开放外网访问,用于下载 TiDB-Ansible、TiDB 及相关软件安装包。 - 推荐安装 CentOS 7.3 及以上版本 Linux 操作系统。 -2. 部署目标机器若干及部署中控机一台 +2. 部署目标机器若干及部署中控机一台 - 系统要求及配置参考[准备机器](ansible-deployment.md#准备机器)。 - 可以无法访问外网。 ## 在中控机器上离线安装 Ansible 及其依赖 -1. CentOS 7 系统 Ansible 离线安装方式: +1. CentOS 7 系统 Ansible 离线安装方式: - > 下载 [ Ansible 2.4.2 ](https://download.pingcap.org/ansible-2.4.2-rpms.el7.tar.gz) 离线安装包 ,上传至中控机。 + > 下载 [Ansible 2.4.2](https://download.pingcap.org/ansible-2.4.2-rpms.el7.tar.gz) 离线安装包,上传至中控机。 ```bash # tar -xzvf ansible-2.4.2-rpms.el7.tar.gz @@ -33,7 +33,7 @@ category: deployment # ./install_ansible.sh ``` -2. 安装完成后,可通过 `ansible --version` 查看版本: +2. 安装完成后,可通过 `ansible --version` 查看版本: ```bash # ansible --version @@ -42,7 +42,7 @@ category: deployment ## 在下载机上下载 TiDB-Ansible 及 TiDB 安装包 -1. 在下载机上安装 Ansible +1. 在下载机上安装 Ansible 请按以下方式在 CentOS 7 系统的下载机上在线安装 Ansible。 通过 epel 源安装, 会自动安装 Ansible 相关依赖(如 Jinja2==2.7.2 MarkupSafe==0.11),安装完成后,可通过 `ansible --version` 查看版本,请务必确认是 **Ansible 2.4** 及以上版本,否则会有兼容问题。 @@ -50,15 +50,16 @@ category: deployment # yum install epel-release # yum install ansible curl # ansible --version - + ansible 2.4.2.0 ``` -2. 下载 tidb-ansible +2. 下载 tidb-ansible 使用以下命令从 Github [TiDB-Ansible 项目](https://github.com/pingcap/tidb-ansible) 上下载 TiDB-Ansible 相应版本,默认的文件夹名称为 `tidb-ansible`。 下载 GA 版本: + ``` git clone -b release-1.0 https://github.com/pingcap/tidb-ansible.git ``` @@ -66,21 +67,21 @@ category: deployment 或 下载 master 版本: + ``` git clone https://github.com/pingcap/tidb-ansible.git ``` > **注:** 生产环境请下载 GA 版本部署 TiDB。 - -3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 +3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 ``` cd tidb-ansible ansible-playbook local_prepare.yml ``` -4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 +4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 ## 分配机器资源,编辑 inventory.ini 文件 @@ -88,9 +89,9 @@ category: deployment ## 部署任务 -1. 参考[部署任务](ansible-deployment.md#部署任务)即可。 +1. 参考[部署任务](ansible-deployment.md#部署任务)即可。 -2. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 +2. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 ## 测试集群 diff --git a/v2.0/op-guide/security.md b/v2.0/op-guide/security.md index 235390b52771..2c1b2b2883eb 100755 --- a/v2.0/op-guide/security.md +++ b/v2.0/op-guide/security.md @@ -14,21 +14,19 @@ category: deployment MySQL Client 与 TiDB 之间使用一套证书,TiDB 集群组件之间使用另外一套证书。 - - ## TiDB 集群组件间开启 TLS(双向认证) ### 准备证书 推荐为 TiDB、TiKV、PD 分别准备一个 server 证书,并保证可以相互验证,而它们的各种客户端共用 client 证书。 -有多种工具可以生成自签名证书,如 `openssl`,`easy-rsa `,`cfssl`。 +有多种工具可以生成自签名证书,如 `openssl`,`easy-rsa`,`cfssl`。 这里提供一个使用 `cfssl` 生成证书的示例:[生成自签名证书](generate-self-signed-certificates.md)。 ### 配置证书 -##### TiDB +#### TiDB 在 config 文件或命令行参数中设置: @@ -42,7 +40,7 @@ cluster-ssl-cert = "/path/to/tidb-server.pem" cluster-ssl-key = "/path/to/tidb-server-key.pem" ``` -##### TiKV +#### TiKV 在 config 文件或命令行参数中设置,并设置相应 url 为 https: @@ -54,7 +52,7 @@ cert-path = "/path/to/client.pem" key-path = "/path/to/client-key.pem" ``` -##### PD +#### PD 在 config 文件或命令行参数中设置,并设置相应 url 为 https: @@ -78,8 +76,6 @@ key-path = "/path/to/server-key.pem" ./tikv-ctl --host="127.0.0.1:20160" --ca-path="/path/to/ca.pem" --cert-path="/path/to/client.pem" --key-path="/path/to/clinet-key.pem" ``` - - ## MySQL 与 TiDB 间开启 TLS ### 准备证书 @@ -127,6 +123,3 @@ ssl-key = "/path/to/certs/server-key.pem" ```bash mysql -u root --host 127.0.0.1 --port 4000 --ssl-cert=/path/to/certs/client-cert.pem --ssl-key=/path/to/certs/client-key.pem --ssl-ca=/path/to/certs/ca.pem --ssl-mode=VERIFY_IDENTITY ``` - - - diff --git a/v2.0/op-guide/tune-tikv.md b/v2.0/op-guide/tune-tikv.md index b27f2fe47a4e..98c041f17b3b 100755 --- a/v2.0/op-guide/tune-tikv.md +++ b/v2.0/op-guide/tune-tikv.md @@ -233,14 +233,11 @@ block-cache-size = "256MB" 除了以上列出的 `block-cache` 以及 `write-buffer` 会占用系统内存外: -1. 需预留一些内存作为系统的 page cache -2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 - +1. 需预留一些内存作为系统的 page cache +2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 ## TiKV 机器配置推荐 -1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 -2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 -3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 - - +1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 +2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 +3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 diff --git a/v2.0/releases/rc3.md b/v2.0/releases/rc3.md index 6b57c34fdd89..8e7f92da528f 100755 --- a/v2.0/releases/rc3.md +++ b/v2.0/releases/rc3.md @@ -41,7 +41,7 @@ category: Releases - 通过 Key 获取 Region 信息 - 添加、删除 scheduler 和 operator - 获取集群 label 信息 - + ## TiKV + 支持 Async Apply 提升整体写入性能 diff --git a/v2.0/releases/rc4.md b/v2.0/releases/rc4.md index eaf622df3436..a1d037e0dfa3 100755 --- a/v2.0/releases/rc4.md +++ b/v2.0/releases/rc4.md @@ -8,7 +8,7 @@ category: Releases 8 月 4 日,TiDB 正式发布 RC4 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。性能方面重点优化了写入速度,计算任务调度支持优先级,避免分析型大事务影响在线事务。SQL 优化器全新改版,查询代价估算更加准确,且能够自动选择 Join 物理算子。功能方面进一步 MySQL 兼容性。 同时为了更好的支持 OLAP 业务,开源了 TiSpark 项目,可以通过 Spark 读取和分析 TiKV 中的数据。 -## TiDB: +## TiDB + SQL 查询优化器重构 - 更好的支持 TopN 查询 @@ -22,7 +22,7 @@ category: Releases + 支持 Json 类型及其操作 + 支持查询优先级、隔离级别的设置 -## PD: +## PD + 支持通过 PD 设置 TiKV location labels + 调度优化 @@ -31,7 +31,7 @@ category: Releases - 优化 balance 算法 + 优化数据加载,加快 failover 速度 -## TiKV: +## TiKV + 支持查询优先级设置 + 支持 RC 隔离级别 @@ -40,9 +40,9 @@ category: Releases + Coprocessor 支持更多下推函数 + 提升性能,提升稳定性 -## TiSpark Beta Release: - +## TiSpark Beta Release + + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 -+ 通过 TPC-H 测试 (除去一个需要 View 的 Query) \ No newline at end of file ++ 通过 TPC-H 测试 (除去一个需要 View 的 Query) diff --git a/v2.0/sql/admin.md b/v2.0/sql/admin.md index b563d6f11e7c..6b5245641abb 100755 --- a/v2.0/sql/admin.md +++ b/v2.0/sql/admin.md @@ -56,9 +56,11 @@ password_option: { 设置用户密码,具体信息参考[权限管理](privilege.md)。 ### 设置隔离级别 + ```sql SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ``` + 设置事务隔离级别,具体信息参考[事务语句](transaction.md#事务隔离级别)。 ## `SHOW` 语句 @@ -97,13 +99,13 @@ SHOW STATS_META [like_or_where] SHOW STATS_HISTOGRAMS [like_or_where] SHOW STATS_BUCKETS [like_or_where] - like_or_where: LIKE 'pattern' | WHERE expr ``` 说明: + * 通过 `SHOW` 语句展示统计信息请参考[统计信息说明](https://github.com/pingcap/docs-cn/blob/master/sql/statistics.md#统计信息的查看) * 关于 `SHOW` 语句更多信息请参考 [MySQL 文档](https://dev.mysql.com/doc/refman/5.7/en/show.html) @@ -127,4 +129,4 @@ ADMIN CANCEL DDL JOBS 'job_id' [, 'job_id'] ... * `ADMIN CANCEL DDL JOBS 'job_id' [, 'job_id'] ...` -用于取消正在执行的 DDL 作业,其返回值为对应的作业取消是否成功,如果失败会显示失败的具体原因。这个操作可以同时取消多个 DDL 作业,其中 DDL 作业 ID 可以通过 `ADMIN SHOW DDL JOBS` 语句来获取。其中如果希望取消的作业已经完成,则取消操作将会失败。 \ No newline at end of file +用于取消正在执行的 DDL 作业,其返回值为对应的作业取消是否成功,如果失败会显示失败的具体原因。这个操作可以同时取消多个 DDL 作业,其中 DDL 作业 ID 可以通过 `ADMIN SHOW DDL JOBS` 语句来获取。其中如果希望取消的作业已经完成,则取消操作将会失败。 diff --git a/v2.0/sql/cast-functions-and-operators.md b/v2.0/sql/cast-functions-and-operators.md index d99a4098fb36..33093487d57c 100755 --- a/v2.0/sql/cast-functions-and-operators.md +++ b/v2.0/sql/cast-functions-and-operators.md @@ -3,8 +3,6 @@ title: TiDB 用户文档 category: user guide --- - - # Cast 函数和操作符 Cast 函数和操作符用于将某种数据类型的值转换为另一种数据类型。TiDB 中该函数和操作符的使用方法与 MySQL基本一致,详情参见: [Cast Functions and Operators](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html). @@ -16,4 +14,3 @@ Cast 函数和操作符用于将某种数据类型的值转换为另一种数据 | [`BINARY`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#operator_binary) | 将一个字符串转换成一个二进制字符串 | | [`CAST()`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast) | 将一个值转换成一个确定类型 | | [`CONVERT()`](https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert) | 将一个值转换成一个确定类型 | - diff --git a/v2.0/sql/comment-syntax.md b/v2.0/sql/comment-syntax.md index 4377d2653965..3244be082718 100755 --- a/v2.0/sql/comment-syntax.md +++ b/v2.0/sql/comment-syntax.md @@ -76,7 +76,6 @@ TiDB 也跟 MySQL 保持一致,支持一种 C 风格注释的变体: 如果注释中指定了 Server 版本号,例如 `/*!50110 KEY_BLOCK_SIZE=1024 */`,在 MySQL 中表示只有 MySQL 的版本大于等于 5.1.10 才会处理这个 comment 中的内容。但是在 TiDB 中,这个版本号不会起作用,所有的 comment 都会处理。 - 还有一种注释会被当做是优化器 Hint 特殊对待: ``` diff --git a/v2.0/sql/connection-and-APIs.md b/v2.0/sql/connection-and-APIs.md index 8af17ab3632a..3891075b0881 100755 --- a/v2.0/sql/connection-and-APIs.md +++ b/v2.0/sql/connection-and-APIs.md @@ -19,7 +19,6 @@ TiDB 兼容 MySQL(5.6、5.7) 的所有连接器和 API,包括: + [MySQL Eiffel Wrapper](https://dev.mysql.com/doc/refman/5.7/en/apis-eiffel.html) + [Mysql Go API](https://github.com/go-sql-driver/mysql) - ## 使用 MySQL 连接器连接 TiDB Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 @@ -53,7 +52,7 @@ Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 | Eiffel | Eiffel MySQL | `libmysqlclient` | See [Section 27.14, “MySQL Eiffel Wrapper”](https://dev.mysql.com/doc/refman/5.7/en/apis-eiffel.html). | | Erlang | `erlang-mysql-driver` | `libmysqlclient` | See [`erlang-mysql-driver`.](http://code.google.com/p/erlang-mysql-driver/) | | Haskell | Haskell MySQL Bindings | Native Driver | See [Brian O'Sullivan's pure Haskell MySQL bindings](http://www.serpentine.com/blog/software/mysql/). | -| | `hsql-mysql` | `libmysqlclient` | See [MySQL driver for Haskell ](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsql-mysql-1.7). | +| | `hsql-mysql` | `libmysqlclient` | See [MySQL driver for Haskell](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsql-mysql-1.7). | | Java/JDBC | Connector/J | Native Driver | See [MySQL Connector/J 5.1 Developer Guide](https://dev.mysql.com/doc/connector-j/5.1/en/). | | Kaya | MyDB | `libmysqlclient` | See [MyDB](http://kayalang.org/library/latest/MyDB). | | Lua | LuaSQL | `libmysqlclient` | See [LuaSQL](http://keplerproject.github.io/luasql/doc/us/). | @@ -76,8 +75,6 @@ Oracle 官方提供了以下 API , TiDB 可以兼容所有这些 API。 | SPL | `sql_mysql` | `libmysqlclient` | See [`sql_mysql` for SPL](http://www.clifford.at/spl/spldoc/sql_mysql.html). | | Tcl | MySQLtcl | `libmysqlclient` | See [Section 27.13, “MySQL Tcl API”](https://dev.mysql.com/doc/refman/5.7/en/apis-tcl.html). | - - ## TiDB 支持的连接器版本 | Connector | Connector version | diff --git a/v2.0/sql/datatype.md b/v2.0/sql/datatype.md index e45ebbdebaf2..3a4e5cf7a9f5 100755 --- a/v2.0/sql/datatype.md +++ b/v2.0/sql/datatype.md @@ -31,6 +31,7 @@ TiDB 支持 MySQL 所有的数值类型,按照精度可以分为: TiDB 支持 MySQL 所有的整数类型,包括 INTEGER/INT、TINYINT、SMALLINT、MEDIUMINT 以及 BIGINT,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html)文档。 #### 类型定义 + 语法: ```sql @@ -93,7 +94,7 @@ FLOAT[(M,D)] [UNSIGNED] [ZEROFILL] DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL] > 双精度浮点数。允许的值范围为:-2^1024 ~ +2^1024,也即是 -1.7976931348623157E+308 到 -2.2250738585072014E-308、0 和 2.2250738585072014E-308 到 1.7976931348623157E+308。这些是理论限制,基于 IEEE 标准。实际的范围根据硬件或操作系统的不同可能稍微小些。 - + DOUBLE PRECISION [(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED] [ZEROFILL] > 为 DOUBLE 的同义词。 @@ -120,7 +121,6 @@ FLOAT(p) [UNSIGNED] [ZEROFILL] | `FLOAT(p)` | 如果 0 <= p <= 24 为 4 个字节, 如果 25 <= p <= 53 为 8 个字节| | `DOUBLE` | 8 | - ### 定点类型 TiDB 支持 MySQL 所有的浮点类型,包括 DECIMAL、NUMERIC,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html)文档。 @@ -146,9 +146,6 @@ NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL] | UNSIGNED | 无符号数,如果不加这个标识,则为有符号数 | | ZEROFILL | 补零标识,如果有这个标识,TiDB 会自动给类型增加 UNSIGNED 标识 | - - - ## 日期时间类型 ### 概述 @@ -158,6 +155,7 @@ TiDB 支持 MySQL 所有的日期时间类型,包括 DATE、DATETIME、TIMESTA ### 类型定义 语法: + ```sql DATE > 日期。支持的范围为`1000-01-01`到`9999-12-31`。以`YYYY-MM-DD`格式显示 DATE 值。 @@ -188,6 +186,7 @@ TiDB 支持 MySQL 所有的字符串类型,包括 CHAR、VARCHAR、BINARY、VA ### 类型定义 语法: + ```sql [NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name] > 定长字符串。CHAR 列的长度固定为创建表时声明的长度。长度可以为从 0 到 255 的任何值。当保存 CHAR 值时,在它们的右边填充空格以达到指定的长度。 @@ -240,6 +239,7 @@ Json 类型可以存储 Json 这种半结构化的数据,相比于直接将 Js 2. 多了 Json 合法性验证的步骤,只有合法的 Json 文档才可以放入这个字段中; Json 字段本身上,并不能创建索引。相反,可以对 Json 文档中的某个子字段创建索引。例如: + ```sql CREATE TABLE city ( id INT PRIMARY KEY, @@ -253,6 +253,7 @@ SELECT id FROM city WHERE population >= 100; ## 枚举类型 集合类型是一个字符串,其值必须是从一个固定集合中选取,这个固定集合在创建表的时候定义,语法是: + ```sql ENUM('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name] @@ -284,6 +285,7 @@ SET('1', '2') NOT NULL ``` 上面的例子中,这列的有效值可以是: + ``` '' '1' @@ -304,8 +306,8 @@ SET('1', '2') NOT NULL 更多信息参考 [MySQL 集合文档](https://dev.mysql.com/doc/refman/5.7/en/set.html)。 - ## 数据类型的默认值 + 在一个数据类型描述中的 `DEFAULT value` 段描述了一个列的默认值。这个默认值必须是常量,不可以是一个函数或者是表达式。但是对于时间类型,可以例外的使用 `NOW`、`CURRENT_TIMESTAMP`、`LOCALTIME`、`LOCALTIMESTAMP` 等函数作为 `DATETIME` 或者 `TIMESTAMP` 的默认值。 `BLOB`、`TEXT` 以及 `JSON` 不可以设置默认值。 diff --git a/v2.0/sql/dml.md b/v2.0/sql/dml.md index 701bde99fd5c..d25a72303c7d 100755 --- a/v2.0/sql/dml.md +++ b/v2.0/sql/dml.md @@ -110,7 +110,6 @@ INSERT INTO tbl_name VALUES(1,2,3),(4,5,6),(7,8,9); 上面的例子中,`(1,2,3),(4,5,6),(7,8,9)` 即为 Value List,其中每个括号内部的数据表示一行数据,这个例子中插入了三行数据。Insert 语句也可以只给部分列插入数据,这种情况下,需要在 Value List 之前加上 ColumnName List,如: - ```sql INSERT INTO tbl_name (a,c) VALUES(1,2),(4,5),(7,8); ``` @@ -130,6 +129,7 @@ INSERT INTO tbl_name SET a=1, b=2, c=3; * Select Statement 待插入的数据集是通过一个 Select 语句获取,要插入的列是通过 Select 语句的 Schema 获得。例如: + ```sql CREATE TABLE tbl_name1 ( a int, @@ -150,6 +150,7 @@ Delete 语句用于删除数据库中的数据,TiDB 兼容 MySQL Delete 语句 这种语法用于删除的数据只会涉及一个表的情况。 ### 语法定义 + ```sql DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [WHERE where_condition] @@ -175,7 +176,6 @@ DELETE [LOW_PRIORITY] [QUICK] [IGNORE] 删除多个表的数据的时候,可以用这两种语法。这两种写法都可以指定从多个表查询数据,但只删除其中一些表的数据。在第一种语法中,只会删除 `FROM` 关键字之前的 Table 列表中所列 Table 的表中的数据。对于第二种写法,只会删除 `FROM` 之后 `USING` 之前的 Table 列表中的所列 Table 中的数据。 - ### 语法元素说明 | 语法元素 | 说明 | @@ -197,6 +197,7 @@ Update 语句用于更新表中的数据。 Update 语句一共有两种语法,分别用于更新单表数据和多表数据。 ### 单表 Update + ```sql UPDATE [LOW_PRIORITY] [IGNORE] table_reference SET assignment_list @@ -214,13 +215,14 @@ assignment_list: 单表 Update 语句会更新 Table 中现有行的指定列。`SET assignment_list` 指定了要更新的列名,以及要赋予地新值。 Where/OrderBy/Limit 子句一起用于从 Table 中查询出待更新的数据。 ### 多表 Update + ```sql UPDATE [LOW_PRIORITY] [IGNORE] table_references SET assignment_list [WHERE where_condition] ``` -多表更新语句用于将 `table_references` 中满足 Where 子句的数据地指定列赋予新的值。 +多表更新语句用于将 `table_references` 中满足 Where 子句的数据地指定列赋予新的值。 ### 语法元素说明 @@ -235,7 +237,6 @@ UPDATE [LOW_PRIORITY] [IGNORE] table_references | `ORDER BY` | 对待更新数据集进行排序 | | `LIMIT row_count` | 只对待更新数据集中排序前 row_count 行的内容进行更新 | - ## Replace 语句 Replace 语句是 MySQL 对标准 SQL 语法的扩展,其行为和 Insert 语句一样,但是当现有数据中有和待插入数据在 PRIMARY KEY 或者 UNIQUE KEY 冲突的情况下,会先删除旧数据,再插入新数据。 diff --git a/v2.0/sql/encryption-and-compression-functions.md b/v2.0/sql/encryption-and-compression-functions.md index a5d7171d329d..f1dcaa960b82 100755 --- a/v2.0/sql/encryption-and-compression-functions.md +++ b/v2.0/sql/encryption-and-compression-functions.md @@ -5,7 +5,6 @@ category: user guide # 加密和压缩函数 - | 函数名 | 功能描述 | |:-----------|:----------------------------| | [`MD5()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_md5)                                                             | 计算字符串的 MD5 校验和       | diff --git a/v2.0/sql/error.md b/v2.0/sql/error.md index 6df32d3ecbba..d23f9321bd96 100755 --- a/v2.0/sql/error.md +++ b/v2.0/sql/error.md @@ -21,7 +21,6 @@ TiDB 兼容 MySQL 的错误码,在大多数情况下,返回和 MySQL 一样 | 9006 | GC Life Time 间隔时间过短,长事务本应读到的数据可能被清理了,应增加GC Life Time | | 9500 | 单个事务过大,原因及解决方法请参考[这里](../FAQ.md#出现-transaction-too-large-报错怎么办) | - ## 故障诊断 参见[故障诊断文档](../trouble-shooting.md)以及 [FAQ](../FAQ.md)。 diff --git a/v2.0/sql/literal-value-bit-value.md b/v2.0/sql/literal-value-bit-value.md index 210341fab568..22980153cef2 100755 --- a/v2.0/sql/literal-value-bit-value.md +++ b/v2.0/sql/literal-value-bit-value.md @@ -13,7 +13,6 @@ category: user guide * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v2.0/sql/literal-value-date-and-time-literals.md b/v2.0/sql/literal-value-date-and-time-literals.md index d3078831ba0b..f7c1d3e6d313 100755 --- a/v2.0/sql/literal-value-date-and-time-literals.md +++ b/v2.0/sql/literal-value-date-and-time-literals.md @@ -20,7 +20,7 @@ Dates 如果 year 部分只有两个数字,这是有歧义的(推荐使用 * year 值如果在 `70-99` 范围,那么被转换成 `1970-1999`。 * year 值如果在 `00-69` 范围,那么被转换成 `2000-2069`。 - + 对于小于 10 的 month 或者 day 值,`'2017-8-4'` 跟 `'2017-08-04'` 是一样的。对于 Time 也是一样,比如 `'2017-08-24 1:2:3'` 跟 `'2017-08-24 01:02:03'`是一样的。 在需要 Date 或者 Time 的语境下, 对于数值,TiDB 会根据数值的长度来选定指定的格式: diff --git a/v2.0/sql/literal-value-string-literals.md b/v2.0/sql/literal-value-string-literals.md index 55b2584fe226..e07e5ddbc7f3 100755 --- a/v2.0/sql/literal-value-string-literals.md +++ b/v2.0/sql/literal-value-string-literals.md @@ -50,8 +50,8 @@ SELECT _utf8'some text'; 转义字符: -| 转义序列 | 意义 | -| :-------: | :-------:| +| 转义序列 | 意义 | +| :-------: | :-------:| | \0 | ASCII NUL (X'00') 字符 | | \' | 单引号 | | \" | 双引号 | @@ -72,5 +72,3 @@ SELECT _utf8'some text'; * 在 `'` 中表示 `"` 或者在 `"` 中表示 `'` 都不需要特别的处理。 更多[细节](https://dev.mysql.com/doc/refman/5.7/en/string-literals.html)。 - - diff --git a/v2.0/sql/literal-values.md b/v2.0/sql/literal-values.md index c2494ceba361..9da4c5f32036 100755 --- a/v2.0/sql/literal-values.md +++ b/v2.0/sql/literal-values.md @@ -52,17 +52,17 @@ SELECT _utf8'some text'; 转义字符: -- \\0: ASCII NUL (X'00') 字符 -- \\': 单引号 -- \\": 双引号 -- \\b: 退格符号 -- \\n: 换行符 -- \\r: 回车符 +- \\0: ASCII NUL (X'00') 字符 +- \\': 单引号 +- \\": 双引号 +- \\b: 退格符号 +- \\n: 换行符 +- \\r: 回车符 - \\t: tab 符(制表符) -- \\z: ASCII 26 (Ctrl + Z) -- \\\: 反斜杠 \\ -- \\%: \% -- \\_: \_ +- \\z: ASCII 26 (Ctrl + Z) +- \\\: 反斜杠 \\ +- \\%: \% +- \\_: \_ 如果要在 string literal 中使用 `'` 或者 `"`,有以下几种办法: @@ -211,7 +211,6 @@ mysql> SELECT TRUE, true, tRuE, FALSE, FaLsE, false; * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v2.0/sql/mysql-compatibility.md b/v2.0/sql/mysql-compatibility.md index 23ba7dfcd73c..4fcfd62cee70 100755 --- a/v2.0/sql/mysql-compatibility.md +++ b/v2.0/sql/mysql-compatibility.md @@ -13,7 +13,6 @@ TiDB 支持包括跨行事务,JOIN 及子查询在内的绝大多数 MySQL 的 一些 MySQL 语法在 TiDB 中可以解析通过,但是不会做任何后续的处理,例如 Create Table 语句中 `Engine` 以及 `Partition` 选项,都是解析并忽略。更多兼容性差异请参考具体的文档。 - ## 不支持的特性 * 存储过程 @@ -87,11 +86,12 @@ TiDB 实现了 F1 的异步 Schema 变更算法,DDL 执行过程中不会阻 - 不支持对enum类型的列进行修改 ### 事务 + TiDB 使用乐观事务模型,在执行 Update、Insert、Delete 等语句时,只有在提交过程中才会检查写写冲突,而不是像 MySQL 一样使用行锁来避免写写冲突。所以业务端在执行 SQL 语句后,需要注意检查 commit 的返回值,即使执行时没有出错,commit的时候也可能会出错。 ### Load data -+ 语法: ++ 语法: ```sql LOAD DATA LOCAL INFILE 'file_name' INTO TABLE table_name @@ -102,7 +102,7 @@ TiDB 使用乐观事务模型,在执行 Update、Insert、Delete 等语句时 其中 ESCAPED BY 目前只支持 '/\/\'。 -+ 事务的处理: ++ 事务的处理: TiDB 在执行 load data 时,默认每 2 万行记录作为一个事务进行持久化存储。如果一次 load data 操作插入的数据超过 2 万行,那么会分为多个事务进行提交。如果某个事务出错,这个事务会提交失败,但它前面的事务仍然会提交成功,在这种情况下一次 load data 操作会有部分数据插入成功,部分数据插入失败。而 MySQL 中会将一次 load data 操作视为一个事务,如果其中发生失败情况,将会导致整个 load data 操作失败。 @@ -124,4 +124,4 @@ TiDB 使用乐观事务模型,在执行 Update、Insert、Delete 等语句时 + TiDB 中该值默认为 `ON`,并且目前 TiDB 只支持设置该值为 `ON` + MySQL 中默认设置: + MySQL 5.7:`OFF` - + MySQL 8.0:`ON` \ No newline at end of file + + MySQL 8.0:`ON` diff --git a/v2.0/sql/numeric-functions-and-operators.md b/v2.0/sql/numeric-functions-and-operators.md index 5ce1b8d7fc98..eda02c8d23cc 100755 --- a/v2.0/sql/numeric-functions-and-operators.md +++ b/v2.0/sql/numeric-functions-and-operators.md @@ -19,7 +19,6 @@ category: user guide ## 数学函数 - | 函数名 | 功能描述 | |:----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------| | [`POW()`](https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_pow) | 返回参数的指定乘方的结果值 | diff --git a/v2.0/sql/precision-math.md b/v2.0/sql/precision-math.md index 014e953b92de..84ed0c8bc065 100755 --- a/v2.0/sql/precision-math.md +++ b/v2.0/sql/precision-math.md @@ -105,7 +105,6 @@ INSERT INTO t SET i = 1/0; | `ERROR_FOR_DIVISION_BY_ZERO` | 有 warning,没有 error,i 被设为 NULL | | strict, `ERROR_FOR_DIVISION_BY_ZERO` | 有 error,插入失败 | - ## 数值修约 `round()` 函数的结果取决于他的参数是否是精确值: diff --git a/v2.0/sql/schema-object-names.md b/v2.0/sql/schema-object-names.md index 22d015be4d79..5234869b196d 100755 --- a/v2.0/sql/schema-object-names.md +++ b/v2.0/sql/schema-object-names.md @@ -61,12 +61,12 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: ``` -`table_name`.`col_name` +`table_name`.`col_name` ``` 而不是: @@ -74,5 +74,5 @@ CREATE TABLE test.t (i int); ``` `table_name.col_name` ``` -更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) +更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) diff --git a/v2.0/sql/transaction-isolation.md b/v2.0/sql/transaction-isolation.md index 848b8a7e3b1e..01c2d6440084 100755 --- a/v2.0/sql/transaction-isolation.md +++ b/v2.0/sql/transaction-isolation.md @@ -3,7 +3,6 @@ title: TiDB 事务隔离级别 category: user guide --- - # TiDB 事务隔离级别 事务隔离级别是数据库事务处理的基础,ACID 中 I,即 Isolation,指的就是事务的隔离性。 @@ -25,7 +24,6 @@ TiDB 使用[percolator事务模型](https://research.google.com/pubs/pub36726.ht ```SET SESSION TRANSACTION ISOLATION LEVEL [read committed|repeatable read]``` - ## 可重复读 可重复读是 TiDB 的默认隔离级别,当事务隔离级别为可重复读时,只能读到该事务启动时已经提交的其他事务修改的数据,未提交的数据或在事务启动后其他事务提交的数据是不可见的。对于本事务而言,事务语句可以看到之前的语句做出的修改。 @@ -72,4 +70,3 @@ MySQL 的可重复读隔离级别并非 snapshot 隔离级别,MySQL 可重复 # The maximum number of retries when commit a transaction. retry-limit = 10 ``` - diff --git a/v2.0/sql/transaction.md b/v2.0/sql/transaction.md index 1d0df11a6cac..f68d38ba3ea2 100755 --- a/v2.0/sql/transaction.md +++ b/v2.0/sql/transaction.md @@ -8,23 +8,28 @@ category: user guide TiDB 支持分布式事务。涉及到事务的语句包括 `Autocommit` 变量、 `START TRANSACTION`/`BEGIN`、 `COMMIT` 以及 `ROLLBACK`。 ## 自动提交 + 语法: + ```sql SET autocommit = {0 | 1} ``` + 通过设置 autocommit 的值为 1,可以将当前 Session 设置为自动提交状态,0 则表示当前 Session 为非自动提交状态。默认情况下, autocommit 的值为 1。 在自动提交状态,每条语句运行后,会将其修改自动提交到数据库中。否则,会等到运行 `COMMIT` 语句或者是 `BEGIN` 语句的时候,才会将之前的修改提交到数据库。 另外 autocommit 也是一个 System Variable,所以可以通过变量赋值语句修改当前 Session 或者是 Global 的值。 + ```sql SET @@SESSION.autocommit = {0 | 1}; SET @@GLOBAL.autocommit = {0 | 1}; ``` - ## START TRANSACTION, Begin -语法: + +语法: + ```sql BEGIN; @@ -32,35 +37,41 @@ START TRANSACTION; START TRANSACTION WITH CONSISTENT SNAPSHOT; ``` -上述三条语句都是事务开始语句,效果相同。通过事务开始语句可以显式地开始一个新的事务,如果这个时候当前 Session 正在一个事务中间过程中,会将当前事务提交后,开启一个新的事务。 +上述三条语句都是事务开始语句,效果相同。通过事务开始语句可以显式地开始一个新的事务,如果这个时候当前 Session 正在一个事务中间过程中,会将当前事务提交后,开启一个新的事务。 ## COMMIT + 语法: + ```sql COMMIT; ``` -提交当前事务,包括从 `BEGIN` 到 `COMMIT` 之间的所有修改。 +提交当前事务,包括从 `BEGIN` 到 `COMMIT` 之间的所有修改。 ## ROLLBACK + 语法: + ```sql ROLLBACK; ``` -回滚当前事务,撤销从 `BEGIN` 到 `ROLLBACK` 之间的所有修改。 +回滚当前事务,撤销从 `BEGIN` 到 `ROLLBACK` 之间的所有修改。 ## 显式事务和隐式事务 + TiDB 可以显式地使用事务(`BEGIN/COMMIT`) 或者隐式的使用事务 (`SET autocommit = 1`)。 如果在 autocmmit = 1 的状态下,通过 `BEGIN` 语句开启一个新的事务,那么在 `COMMIT`/`ROLLBACK` 之前,会禁用 autocommit,也就是变成显式事务。 对于 DDL 语句,会自动提交并且不能回滚。如果运行 DDL 的时候,正在一个事务的中间过程中,会先将当前的事务提交,再运行 DDL。 - ## 事务隔离级别 + TiDB 默认使用 `SNAPSHOT ISOLATION`,可以通过下面的语句将当前 Session 的隔离级别设置为 `READ COMMITTED`。 + ```sql SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ``` diff --git a/v2.0/sql/util.md b/v2.0/sql/util.md index f18d3b1d2273..5be110f0bb9d 100755 --- a/v2.0/sql/util.md +++ b/v2.0/sql/util.md @@ -74,6 +74,7 @@ label = "cop" ``` 如果电脑上安装了 `dot` 程序 (包含在 graphviz 软件包中),可以通过如下方式生成 PNG 文件: + ```bash dot xx.dot -T png -O @@ -84,7 +85,6 @@ dot xx.dot -T png -O ![Explain Dot](../media/explain_dot.png) - ## `USE` 语句 ```sql diff --git a/v2.0/tools/loader.md b/v2.0/tools/loader.md index c94d653a6fe3..392b2d815d14 100755 --- a/v2.0/tools/loader.md +++ b/v2.0/tools/loader.md @@ -33,13 +33,13 @@ category: advanced ## 使用方法 -#### 注意事项 +### 注意事项 请勿使用 loader 导入 MySQL 实例中 `mysql` 系统数据库到下游 TiDB。 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -53,7 +53,7 @@ category: advanced -V 打印 loader 版本 -c string - 指定配置文件启动 loader + 指定配置文件启动 loader -checkpoint-schema string checkpoint 数据库名,loader 在运行过程中会不断的更新这个数据库,在中断并恢复后,会通过这个库获取上次运行的进度 (默认为 "tidb_loader") -d string @@ -118,18 +118,22 @@ port = 4000 通过命令行参数: - ./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +```bash +./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +``` 或者使用配置文件 "config.toml": - ./bin/loader -c=config.toml +```bash +./bin/loader -c=config.toml +``` ------ -## FAQ +## FAQ + +### 合库合表场景案例说明 -#### 合库合表场景案例说明 - 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 @@ -137,7 +141,7 @@ port = 4000 Loader 需要配置文件中开启 route-rules 参数以提供合库合表功能 -+ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` ++ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` + 如果 `pattern-table` 与 `target-table` 为空,将不进行表名称合并或转换 ``` diff --git a/v2.0/tools/pd-control.md b/v2.0/tools/pd-control.md index 670fa4526db5..b03364aadf1a 100755 --- a/v2.0/tools/pd-control.md +++ b/v2.0/tools/pd-control.md @@ -16,11 +16,15 @@ PD Control 是 PD 的命令行工具,用于获取集群状态信息和调整 单命令模式: - ./pd-ctl store -d -u http://127.0.0.1:2379 +```bash +./pd-ctl store -d -u http://127.0.0.1:2379 +``` 交互模式: - ./pd-ctl -u http://127.0.0.1:2379 +```bash +./pd-ctl -u http://127.0.0.1:2379 +``` 使用环境变量: @@ -40,7 +44,7 @@ export PD_ADDR=http://127.0.0.1:2379 ### \-\-pd,-u + 指定 PD 的地址 -+ 默认地址: http://127.0.0.1:2379 ++ 默认地址: `http://127.0.0.1:2379` + 环境变量: PD_ADDR ### \-\-detach,-d @@ -209,7 +213,7 @@ Replica 调度的开销较大,所以这个值不宜调得太大。 示例: ```bash ->> label // 显示所有 label +>> label // 显示所有 label >> label store zone cn // 显示所有包含 label 为 "zone":"cn" 的 store ``` @@ -381,8 +385,3 @@ Protobuf 格式示例: system: 2017-10-09 05:50:59 +0800 CST logic: 120102 ``` - - - - - diff --git a/v2.0/tools/syncer.md b/v2.0/tools/syncer.md index 229a1f9b8c89..3fa8d620e1a6 100755 --- a/v2.0/tools/syncer.md +++ b/v2.0/tools/syncer.md @@ -49,7 +49,7 @@ binlog-pos = 930143241 binlog-gtid = "2bfabd22-fff7-11e6-97f7-f02fa73bcb01:1-23,61ccbb5d-c82d-11e6-ac2e-487b6bd31bf7:1-4" ``` -> **注:** +> **注:** > > - `syncer.meta` 只需要第一次使用的时候配置,后续 Syncer 同步新的 binlog 之后会自动将其更新到最新的 position。 > - 如果使用 binlog position 同步则只需要配置 binlog-name binlog-pos; 使用 gtid 同步则需要设置 gtid,且启动 Syncer 时带有 `--enable-gtid`。 @@ -62,7 +62,7 @@ Syncer 的命令行参数说明: Usage of syncer: -L string 日志等级: debug, info, warn, error, fatal (默认为 "info") - -V + -V 输出 syncer 版本;默认 false -auto-fix-gtid 当 mysql master/slave 切换时,自动修复 gtid 信息;默认 false @@ -71,7 +71,7 @@ Usage of syncer: -c int syncer 处理 batch 线程数 (默认 16) -config string - 指定相应配置文件启动 sycner 服务;如 `--config config.toml` + 指定相应配置文件启动 sycner 服务;如 `--config config.toml` -enable-gtid 使用 gtid 模式启动 syncer;默认 false,开启前需要上游 MySQL 开启 GTID 功能 -log-file string @@ -107,19 +107,19 @@ status-addr = "127.0.0.1:10086" # skip-ddls 可以跳过与 TiDB 不兼容的 DDL 语句,支持正则语法。 # skip-ddls = ["^CREATE\\s+USER"] -# 注意: skip-events 已经废弃, 请使用 skip-dmls +# 注意: skip-events 已经废弃, 请使用 skip-dmls # skip-dmls 用于跳过 DML 语句. type 字段取值为 'insert', 'update', 'delete'。 # 下面的例子为跳过 foo.bar 表的所有 delete 语句。 # [[skip-dmls]] # db-name = "foo" # tbl-name = "bar" # type = "delete" -# +# # 下面的例子为跳过所有表的 delete 语句。 # [[skip-dmls]] # type = "delete" -# -# 下面的例子为跳过 foo 库中所有表的 delete 语句。 +# +# 下面的例子为跳过 foo 库中所有表的 delete 语句。 # [[skip-dmls]] # db-name = "foo" # type = "delete" @@ -132,7 +132,7 @@ status-addr = "127.0.0.1:10086" #[[replicate-do-table]] #db-name ="dbname" #tbl-name = "table-name" - + #[[replicate-do-table]] #db-name ="dbname1" #tbl-name = "table-name1" @@ -239,7 +239,7 @@ syncer-binlog = (ON.000001, 2504), syncer-binlog-gtid = 53ea0ed1-9bf8-11e6-8bea- 本部分将通过实际案例描述 Syncer 同步数据库参数的优先级关系。 -- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) +- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) - 优先级:replicate-do-db --> replicate-do-table --> replicate-ignore-db --> replicate-ignore-table ```toml @@ -307,7 +307,7 @@ tbl-name = "~^2016_.*" # 场景如下: # 数据库A 下有 order_2016 / history_2016 等多个数据库 # 数据库B 下有 order_2017 / history_2017 等多个数据库 -# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 +# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 # 指定同步数据表B order_2017 数据库,数据表如下 2017_01 2017_02 ... 2017_12 # 表内使用 order_id 作为主键,数据之间主键不冲突 # 忽略同步 history_2016 与 history_2017 数据库 @@ -340,13 +340,13 @@ target-table = "order_2017" 1. 源库 server-id 检查 - - 可通过以下命令查看 server-id + - 可通过以下命令查看 server-id - 结果为空或者为 0,Syncer 无法同步数据 - Syncer server-id 与 MySQL server-id 不能相同,且在 MySQL cluster 中唯一 ``` mysql> show global variables like 'server_id'; - +---------------+------- + +---------------+------- | Variable_name | Value | +---------------+-------+ | server_id | 1 | @@ -413,6 +413,7 @@ target-table = "order_2017" mysql> set global binlog_row_image = FULL; Query OK, 0 rows affected (0.01 sec) ``` + 5. 检查 mydumper 用户权限 - mydumper 导出数据至少拥有以下权限:`select, reload` @@ -421,15 +422,15 @@ target-table = "order_2017" 6. 检查上下游同步用户权限 - 需要上游 MySQL 同步账号至少赋予以下权限: - - ` select , replication slave , replication client` - + + `select , replication slave , replication client` + - 下游 TiDB 可暂时采用 root 同权限账号 7. 检查 GTID 与 POS 相关信息 - 使用以下语句查看 binlog 内容: - + `show binlog events in 'mysql-bin.000023' from 136676560 limit 10;` ## 监控方案 @@ -466,13 +467,13 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 #### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: http://localhost:3000 ,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin,密码: admin) + 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 Dashboard [配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source -### Grafana Syncer metrics 说明 +### Grafana Syncer metrics 说明 #### title: binlog events @@ -494,7 +495,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_gtid` - info: Syncer 同步当前 master binlog 的 binlog-gtid 信息 -#### title: syncer_binlog_file +#### title: syncer_binlog_file (new) - metrics: `syncer_binlog_file{node="master"} - ON(instance, job) syncer_binlog_file{node="syncer"}` - info: 上游与下游同步时,相差的 binlog 文件数量,正常状态为 0,表示数据正在实时同步。数值越大,表示相差的 binlog 文件数量越多。 diff --git a/v2.0/tools/tidb-binlog-kafka.md b/v2.0/tools/tidb-binlog-kafka.md index a1f017938175..3dcda9e8738d 100755 --- a/v2.0/tools/tidb-binlog-kafka.md +++ b/v2.0/tools/tidb-binlog-kafka.md @@ -24,15 +24,15 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为三个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 主机的后台运行。其主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入 Kafka 中。 -#### Drainer +### Drainer Drainer 从 Kafka 中收集 Binlog,并按照 TiDB 中事务的提交顺序转化为指定数据库兼容的 SQL 语句,最后同步到目的数据库或者写到顺序文件。 -#### Kafka & ZooKeeper +### Kafka & ZooKeeper Kafka 集群用来存储由 Pump 写入的 Binlog 数据,并提供给 Drainer 进行读取。 @@ -73,10 +73,10 @@ cd tidb-binlog-latest-linux-amd64 为了保证数据的完整性,在 Pump 运行 10 分钟左右后按顺序进行如下操作: - * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 generate_binlog_position 工具生成 Drainer 启动需要的 savepoint 文件中,make generate_binlog_position 编译该工具。具体使用参考工具的 README 说明,也可以直接下载获取该工具:[generate_binlog_position](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.tar.gz), 并使用sha256sum验证该文件 [sha256](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.sha256)。 - * 全量备份,例如 mydumper 备份 TiDB - * 全量导入备份到目标系统 - * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${commitTS}` + * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 generate_binlog_position 工具生成 Drainer 启动需要的 savepoint 文件中,make generate_binlog_position 编译该工具。具体使用参考工具的 README 说明,也可以直接下载获取该工具:[generate_binlog_position](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.tar.gz), 并使用sha256sum验证该文件 [sha256](https://download.pingcap.org/generate_binlog_position-latest-linux-amd64.sha256)。 + * 全量备份,例如 mydumper 备份 TiDB + * 全量导入备份到目标系统 + * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${commitTS}` * Drainer 输出的 pb,要在配置文件中设置如下参数: @@ -175,7 +175,7 @@ ZK3="192.168.0.11" -metrics-interval int 监控信息上报频率 (默认 15,单位 秒) -pd-urls string - PD 集群节点的地址 (-pd-urls="http://192.168.0.16:2379,http://192.168.0.15:2379,http://192.168.0.14:2379") + PD 集群节点的地址 (-pd-urls=`"http://192.168.0.16:2379,http://192.168.0.15:2379,http://192.168.0.14:2379"`) -socket string unix socket 模式服务监听地址(默认 unix:///tmp/pump.sock) ``` @@ -190,22 +190,22 @@ ZK3="192.168.0.11" # Pump 对外提供服务的 RPC 地址("192.168.0.10:8250") advertise-addr = "" - + # binlog 最大保留天数 (默认 7),设置为 0 可永久保存 gc = 7 - + # Pump 数据存储位置路径 data-dir = "data.pump" - + # ZooKeeper 地址,设置该选项从 ZooKeeper 中获取 Kafka 地址 # ZooKeeper-addrs = "192.168.0.11:2181,192.168.0.12:2181,192.168.0.13:2181" # Pump 向 PD 发送心跳的间隔 (单位 秒) heartbeat-interval = 3 - + # PD 集群节点的地址 pd-urls = "http://192.168.0.16:2379,http://192.168.0.15:2379,http://192.168.0.14:2379" - + # unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) socket = "unix:///tmp/pump.sock" ``` @@ -380,7 +380,7 @@ PbReader 使用示例 + 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号:admin,密码:admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 - + > **注:**Type 选 Prometheus,URL 为 Prometheus 地址,根据实际情况添加/填写。 + 导入 dashboard 配置文件 diff --git a/v2.0/tools/tidb-binlog.md b/v2.0/tools/tidb-binlog.md index 06e0e4b21309..280eecf5fb3f 100755 --- a/v2.0/tools/tidb-binlog.md +++ b/v2.0/tools/tidb-binlog.md @@ -22,11 +22,11 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为两个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 的主机上后台运行。他的主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入磁盘文件 -#### Drainer +### Drainer Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提交顺序转化为指定数据库兼容的 SQL 语句,最后同步到目的数据库或者写到顺序文件 @@ -34,7 +34,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 ### 下载官方 Binary -- CentOS 7+ +- CentOS 7+ ```bash # 下载压缩包 @@ -53,26 +53,25 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 注意 -* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 -* 手动部署时, 启动优先级为: PUMP > TiDB ; 停止优先级为 TiDB > PUMP - +* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 +* 手动部署时, 启动优先级为: PUMP > TiDB ; 停止优先级为 TiDB > PUMP 我们设置 TiDB 启动参数 binlog-socket 为对应的 pump 的参数 socket 所指定的 unix socket 文件路径,最终部署结构如下图所示: ![TiDB pump 模块部署结构](../media/tidb-pump-deployment.png) -* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 +* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 -* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; +* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; 为了保证数据的完整性,在 pump 运行 10 分钟左右后按顺序进行下面的操作 - * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` - * 全量备份,例如 mydumper 备份 tidb - * 全量导入备份到目标系统 - * 设置 savepoint 文件路径,然后启动 drainer, `bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` + * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` + * 全量备份,例如 mydumper 备份 tidb + * 全量导入备份到目标系统 + * 设置 savepoint 文件路径,然后启动 drainer, `bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` -* drainer 输出的 pb, 需要在配置文件设置下面的参数 +* drainer 输出的 pb, 需要在配置文件设置下面的参数 ```toml [syncer] @@ -83,17 +82,16 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 dir = "/path/pb-dir" ``` - #### 使用 tidb-ansible 部署 PUMP (推荐) -* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer +* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook deploy.yml * 执行 ansible-playbook start.yml * drainer 目前需要手动部署 -* 对已有的 TiDB Cluster 部署 binlog +* 对已有的 TiDB Cluster 部署 binlog * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook rolling_update.yml --tags=tidb @@ -136,7 +134,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) ``` - 2. PUMP 配置文件 ```toml @@ -156,6 +153,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 # unix socket 模式服务监听地址 (默认 unix:///tmp/pump.sock) socket = "unix:///tmp/pump.sock" ``` + 3. 启动示例 ```bash @@ -164,7 +162,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 使用 Binary 部署 Drainer -1. Drainer 命令行参数说明 +1. Drainer 命令行参数说明 ``` Usage of drainer: @@ -207,7 +205,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 输出到下游数据库一个事务的 sql 数量 (default 1) ``` - 2. Drainer 配置文件 ```toml @@ -275,7 +272,6 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 # dir = "data.drainer" ``` - 3. 启动示例 ```bash @@ -294,10 +290,10 @@ drainer 启动时可以设置 `--metrics-addr` 和 `--metrics-interval` 两个 ### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 ( 注: Type 选 Prometheus,Url 为 Prometheus 地址,根据实际情况 添加/填写 ) -+ 导入 dashboard 配置文件 ++ 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 [dashboard 配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source diff --git a/v2.0/trouble-shooting.md b/v2.0/trouble-shooting.md index d92ebfa2e3f9..e324ce98d8ed 100755 --- a/v2.0/trouble-shooting.md +++ b/v2.0/trouble-shooting.md @@ -8,6 +8,7 @@ category: advanced 当试用 TiDB 遇到问题时,请先参考本篇文档。如果问题未解决,请按文档要求收集必要的信息通过 Github [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new)。 ## 如何给 TiDB 开发者报告错误 + 当使用 TiDB 遇到问题并且通过后面所列信息无法解决时,请收集以下信息并[创建新 Issue](https://github.com/pingcap/tidb/issues/new): + 具体的出错信息以及正在执行的操作 @@ -16,26 +17,25 @@ category: advanced + 机器配置以及部署拓扑 + dmesg 中 TiDB 组件相关的问题 - ## 数据库连接不上 首先请确认集群的各项服务是否已经启动,包括 tidb-server、pd-server、tikv-server。请用 ps 命令查看所有进程是否在。如果某个组件的进程已经不在了,请参考对应的章节排查错误。 如果所有的进程都在,请查看 tidb-server 的日志,看是否有报错?常见的错误包括: -+ InformationSchema is out of date ++ InformationSchema is out of date 无法连接 tikv-server,请检查 pd-server 以及 tikv-server 的状态和日志。 -+ panic ++ panic 程序有错误,请将具体的 panic log [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new)。 如果是清空数据并重新部署服务,请确认以下信息: -+ pd-server、tikv-server 数据都已清空 ++ pd-server、tikv-server 数据都已清空 tikv-server 存储具体的数据,pd-server 存储 tikv-server 中数据的的元信息。如果只清空 pd-server 或只清空 tikv-server 的数据,会导致两边数据不匹配。 -+ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server ++ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server 集群 ID 是由 pd-server 在集群初始化时随机分配,所以重新部署集群后,集群 ID 会发生变化。tidb-server 业务需要重启以获取新的集群 ID。 @@ -43,13 +43,15 @@ category: advanced tidb-server 无法启动的常见情况包括: -+ 启动参数错误 ++ 启动参数错误 请参考[TiDB 命令行参数](op-guide/configuration.md#tidb)文档。 -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 tidb-server 启动所需要的端口未被占用。 -+ 无法连接 pd-server + ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志,确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 @@ -62,50 +64,53 @@ tidb-server 无法启动的常见情况包括: ## tikv-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[TiKV 启动参数](op-guide/configuration.md#tikv)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tikv-server 启动所需要的端口未被占用: `lsof -i:port`。 -+ 无法连接 pd-server + ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志。确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性, 确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 -+ 文件被占用 ++ 文件被占用 不要在一个数据库文件目录上打开两个 tikv。 ## pd-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[PD 命令行参数](op-guide/configuration.md#placement-driver-pd)文档。 -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 pd-server 启动所需要的端口未被占用: `lsof -i:port`。 ## TiDB/TiKV/PD 进程异常退出 -+ 进程是否是启动在前台 ++ 进程是否是启动在前台 当前终端退出给其所有子进程发送 HUP 信号,从而导致进程退出。 -+ 是否是在命令行用过 `nohup+&` 方式直接运行 + ++ 是否是在命令行用过 `nohup+&` 方式直接运行 这样依然可能导致进程因终端连接突然中断,作为终端 SHELL 的子进程被杀掉。 推荐将启动命令写在脚本中,通过脚本运行(相当于二次 fork 启动)。 ## TiKV 进程异常重启 -+ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 ++ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 如果有 OOM 信息并且杀掉的进程为 TiKV,请减少 TiKV 的 RocksDB 的各个 CF 的 `block-cache-size` 值。 -+ 检查 TiKV 日志是否有 panic 的 log ++ 检查 TiKV 日志是否有 panic 的 log 提交 Issue 并附上 panic 的 log。 diff --git a/v2.1-legacy/benchmark/sysbench-v2.md b/v2.1-legacy/benchmark/sysbench-v2.md index 329cb41a931f..bce70f8a8400 100755 --- a/v2.1-legacy/benchmark/sysbench-v2.md +++ b/v2.1-legacy/benchmark/sysbench-v2.md @@ -26,7 +26,7 @@ IDC 机器 | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD * 1 | +| DISK | Optane 500GB SSD * 1 | ## 测试方案 @@ -55,15 +55,15 @@ IDC 机器 ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 ``` * v2.0.0-rc6 - ``` + ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 use-delete-range: false ``` @@ -83,7 +83,7 @@ IDC 机器 ## 测试结果 -### 标准 Select 测试 +### 标准 Select 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -98,7 +98,7 @@ IDC 机器 GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 -### 标准 OLTP 测试 +### 标准 OLTP 测试 | 版本 | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---:| @@ -113,7 +113,7 @@ GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 GA2.0 比 GA1.0 在 OLTP 性能上,性能基本一致。 -### 标准 Insert 测试 +### 标准 Insert 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | diff --git a/v2.1-legacy/benchmark/sysbench-v3.md b/v2.1-legacy/benchmark/sysbench-v3.md index 8c439e6eb99e..3a1108eb992f 100755 --- a/v2.1-legacy/benchmark/sysbench-v3.md +++ b/v2.1-legacy/benchmark/sysbench-v3.md @@ -26,7 +26,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD \* 1 | +| DISK | Optane 500GB SSD \* 1 | Sysbench 版本:1.1.0 @@ -139,4 +139,4 @@ v2.1 与 v2.0 在 Update Non-Index 写入性能上基本一致。 ![update index](../media/sysbench_v3_update_index.png) -v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 \ No newline at end of file +v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 diff --git a/v2.1-legacy/benchmark/sysbench.md b/v2.1-legacy/benchmark/sysbench.md index 29cb054450cc..996b73c910cc 100755 --- a/v2.1-legacy/benchmark/sysbench.md +++ b/v2.1-legacy/benchmark/sysbench.md @@ -16,7 +16,7 @@ draft: true ## 测试版本、时间、地点 -TiDB 版本:v1.0.0 +TiDB 版本:v1.0.0 时间:2017 年 10 月 20 日 地点:北京 @@ -29,11 +29,11 @@ IDC 机器 | OS | linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5T SSD * 2 + Optane SSD * 1 | +| DISK | 1.5T SSD \* 2 + Optane SSD * 1 | Sysbench 版本: 1.0.6 -测试脚本: https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench +测试脚本: ## 测试方案 @@ -41,7 +41,7 @@ Sysbench 版本: 1.0.6 测试表结构 -``` +``` CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned NOT NULL DEFAULT '0', @@ -49,17 +49,17 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB +) ENGINE=InnoDB ``` 部署方案以及配置参数 -``` +``` // TiDB 部署方案 172.16.20.4 4*tikv 1*tidb 1*sysbench 172.16.20.6 4*tikv 1*tidb 1*sysbench 172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench // 每个物理节点有三块盘: data3: 2 tikv (Optane SSD) @@ -89,8 +89,8 @@ Mysql version: 5.6.37 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql max_connections = 2000 ``` @@ -109,9 +109,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 1902 | 38045 | 134.56 ms / 363.18 ms | | Mysql | 32 | 1000 万 | 256 | 1770 | 35416 | 144.55 ms / 383.33 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) +![threads_oltp](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) +![table_size_oltp](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -128,9 +128,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 386866 | 0.66 ms / 1.64 ms | | Mysql | 32 | 1000 万 | 256 | 388273 | 0.66 ms / 1.64 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) +![threads_select](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) +![table_size_select](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -145,12 +145,11 @@ max_connections = 2000 | Mysql | 32 | 100 万 | 128 | 14884 | 8.58 ms / 21.11 ms | | Mysql | 32 | 100 万 | 256 | 14508 | 17.64 ms / 44.98 ms | | Mysql | 32 | 500 万 | 256 | 10593 | 24.16 ms / 82.96 ms | -| Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | - -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +| Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) +![threads_insert](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +![table_size_insert](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) ### 场景二:TiDB 水平扩展能力测试 @@ -187,7 +186,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 8984 | 179692 | 114.96 ms / 176.73 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 12953 | 259072 | 117.80 ms / 200.47 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_oltp](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -198,7 +197,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 289933 | 3.53 ms / 8.74 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 435313 | 3.55 ms / 9.17 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_select](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -208,4 +207,4 @@ block-cache-size = "2GB" | 5 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 60689 | 37.96 ms / 29.9 ms | | 7 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 80087 | 9.62 ms / 21.37 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) +![scale_tikv_insert](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) diff --git a/v2.1-legacy/media/tidb-lightning.svg b/v2.1-legacy/media/tidb-lightning.svg index 9669ef158c0a..da68e4f0dadc 100755 --- a/v2.1-legacy/media/tidb-lightning.svg +++ b/v2.1-legacy/media/tidb-lightning.svg @@ -12,7 +12,7 @@ - + diff --git a/v2.1-legacy/op-guide/ansible-deployment-rolling-update.md b/v2.1-legacy/op-guide/ansible-deployment-rolling-update.md index 4a103736590c..fd8165351386 100755 --- a/v2.1-legacy/op-guide/ansible-deployment-rolling-update.md +++ b/v2.1-legacy/op-guide/ansible-deployment-rolling-update.md @@ -5,7 +5,7 @@ category: deployment # 使用 TiDB-Ansible 升级 TiDB 集群 -滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd * 3、tidb * 2、tikv * 3)。 +滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd \* 3、tidb * 2、tikv * 3)。 > **注意:** > @@ -27,14 +27,14 @@ category: deployment > > 如果使用 master 分支的 tidb-ansible,`tidb_version = latest` 保持不变即可,latest 版本的 TiDB 安装包会每日更新。 -2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` +2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` ``` $ cd /home/tidb/tidb-ansible $ rm -rf downloads ``` -3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` +3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` ``` $ ansible-playbook local_prepare.yml @@ -61,7 +61,7 @@ $ wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz ``` $ ansible-playbook rolling_update.yml --tags=pd ``` - + 如果 PD 实例数大于等于 3,滚动升级 PD leader 实例时,Ansible 会先迁移 PD leader 到其他节点再关闭该实例。 - 滚动升级 TiKV 节点(只升级 TiKV 服务) diff --git a/v2.1-legacy/op-guide/ansible-deployment-scale.md b/v2.1-legacy/op-guide/ansible-deployment-scale.md index 18045de3886d..bc1fc6e80218 100755 --- a/v2.1-legacy/op-guide/ansible-deployment-scale.md +++ b/v2.1-legacy/op-guide/ansible-deployment-scale.md @@ -117,7 +117,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 例如,如果要添加一个 PD 节点(node103),IP 地址为 172.16.10.103,可以进行如下操作: -1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: +1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: ```ini [tidb_servers] @@ -195,7 +195,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 4. 使用 `pd-ctl` 检查新节点是否添加成功: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d member ``` @@ -295,7 +295,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 2. 从集群中移除 node9,假如 store id 为 10: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d store delete 10 ``` @@ -383,7 +383,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 2. 从集群中移除 node2,假如 name 为 pd2: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d member delete name pd2 ``` diff --git a/v2.1-legacy/op-guide/cross-dc-deployment.md b/v2.1-legacy/op-guide/cross-dc-deployment.md index 5ec7bfb2bf3e..71a29cfbc240 100755 --- a/v2.1-legacy/op-guide/cross-dc-deployment.md +++ b/v2.1-legacy/op-guide/cross-dc-deployment.md @@ -63,7 +63,6 @@ TiDB, TiKV, PD 分别分布在 3 个不同的中心,这是最常规,可用 > > 在两数据中心 + binlog 同步部署方案中,数据中心之间只有 binlog 异步复制。在数据中心间的延迟较高的情况下,从集群落后主集群的数据量会增大。当主集群故障后(DR),会造成数据丢失,丢失的数据量受网络延迟等因素影响。 - ## 高可用和容灾分析 对于三数据中心方案和两地三中心方案,我们能得到的保障是任意一个数据中心故障时,集群能自动恢复服务,不需要人工介入,并能保证数据一致性。注意各种调度策略都是用于帮助性能优化的,当发生故障时调度机制总是第一优先考虑可用性而不是性能。 diff --git a/v2.1-legacy/op-guide/docker-compose.md b/v2.1-legacy/op-guide/docker-compose.md index 864e4ed3492e..df831046e8c6 100755 --- a/v2.1-legacy/op-guide/docker-compose.md +++ b/v2.1-legacy/op-guide/docker-compose.md @@ -59,7 +59,7 @@ category: deployment ``` 如果是 Mac 系统,也可以通过 Homebrew 安装: - + ``` brew install kubernetes-helm ``` diff --git a/v2.1-legacy/op-guide/generate-self-signed-certificates.md b/v2.1-legacy/op-guide/generate-self-signed-certificates.md index 04ddced0c5ab..d565a799d7fd 100755 --- a/v2.1-legacy/op-guide/generate-self-signed-certificates.md +++ b/v2.1-legacy/op-guide/generate-self-signed-certificates.md @@ -45,16 +45,16 @@ cfssl print-defaults csr > ca-csr.json ## 生成证书 -#### 证书介绍 +### 证书介绍 - tidb-server certificate 由 TiDB 使用,为其他组件和客户端验证 TiDB 身份。 - tikv-server certificate 由 TiKV 使用,为其他组件和客户端验证 TiKV 身份。 - pd-server certificate 由 PD 使用,为其他组件和客户端验证 PD 身份。 - client certificate 用于通过 PD、TiKV、TiDB 验证客户端。例如 `pd-ctl`,`tikv-ctl`,`pd-recover`。 -#### 配置 CA 选项 +### 配置 CA 选项 -根据实际需求修改 `ca-config.json`: +根据实际需求修改 `ca-config.json`: ```json { @@ -85,7 +85,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { @@ -119,7 +119,7 @@ ca.csr ca.pem ``` -#### 生成服务器端证书 +### 生成服务器端证书 `hostname` 中为各组件的 IP 地址,以及 `127.0.0.1` @@ -139,7 +139,7 @@ tidb-server.csr tikv-server.csr pd-server.csr tidb-server.pem tikv-server.pem pd-server.pem ``` -#### 生成客户端证书 +### 生成客户端证书 ```bash echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client -hostname="" - | cfssljson -bare client @@ -151,4 +151,4 @@ echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gen client-key.pem client.csr client.pem -``` \ No newline at end of file +``` diff --git a/v2.1-legacy/op-guide/migration.md b/v2.1-legacy/op-guide/migration.md index 46352bd4b6c6..22e3f0bd04f3 100755 --- a/v2.1-legacy/op-guide/migration.md +++ b/v2.1-legacy/op-guide/migration.md @@ -213,7 +213,6 @@ status-addr = "127.0.0.1:10086" #db-name ="test" #tbl-name = "~^a.*" - # sharding 同步规则,采用 wildcharacter # 1. 星号字符 (*) 可以匹配零个或者多个字符, # 例子, doc* 匹配 doc 和 document, 但是和 dodo 不匹配; @@ -281,7 +280,6 @@ mysql> select * from t1; `syncer` 每隔 30s 会输出当前的同步统计,如下 - ```bash 2017/06/08 01:18:51 syncer.go:934: [info] [syncer]total events = 15, total tps = 130, recent tps = 4, master-binlog = (ON.000001, 11992), master-binlog-gtid=53ea0ed1-9bf8-11e6-8bea-64006a897c73:1-74, diff --git a/v2.1-legacy/op-guide/offline-ansible-deployment.md b/v2.1-legacy/op-guide/offline-ansible-deployment.md index 88945be1362d..a391395c0c21 100755 --- a/v2.1-legacy/op-guide/offline-ansible-deployment.md +++ b/v2.1-legacy/op-guide/offline-ansible-deployment.md @@ -67,18 +67,18 @@ category: deployment ## 在下载机上下载 TiDB-Ansible 及 TiDB 安装包 -1. 在下载机上安装 Ansible +1. 在下载机上安装 Ansible 请按以下方式在 CentOS 7 系统的下载机上在线安装 Ansible。安装完成后,可通过 `ansible --version` 查看版本,请务必确认是 **Ansible 2.5.0** 版本,否则会有兼容问题。 ```bash # yum install epel-release # yum install ansible curl - # ansible --version + # ansible --version ansible 2.5.0 ``` -2. 下载 tidb-ansible +2. 下载 tidb-ansible 使用以下命令从 Github [TiDB-Ansible 项目](https://github.com/pingcap/tidb-ansible)上下载 TiDB-Ansible 相应版本,默认的文件夹名称为 `tidb-ansible`,以下为各版本下载示例,版本选择可以咨询官方。 @@ -96,14 +96,14 @@ category: deployment git clone https://github.com/pingcap/tidb-ansible.git ``` -3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 +3. 执行 `local_prepare.yml` playbook,联网下载 TiDB binary 到下载机 ``` cd tidb-ansible ansible-playbook local_prepare.yml ``` -4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 +4. 将执行完以上命令之后的 `tidb-ansible` 文件夹拷贝到中控机 `/home/tidb` 目录下,文件属主权限需是 `tidb` 用户。 ## 在中控机上配置部署机器 ssh 互信及 sudo 规则 @@ -129,9 +129,9 @@ category: deployment ## 部署任务 -1. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 +1. `ansible-playbook local_prepare.yml` 该 playbook 不需要再执行。 -2. Grafana Dashboard 上的 Report 按钮可用来生成 PDF 文件,此功能依赖 `fontconfig` 包及英文字体,如需使用该功能,请下载 [font 离线安装包](https://download.pingcap.org/grafana-font-rpms.el7.tar.gz)上传至 **grafana_servers** 机器上安装。该离线包仅支持 CentOS 7 系统,包含 `fontconfig` 及 `open-sans-fonts`。 +2. Grafana Dashboard 上的 Report 按钮可用来生成 PDF 文件,此功能依赖 `fontconfig` 包及英文字体,如需使用该功能,请下载 [font 离线安装包](https://download.pingcap.org/grafana-font-rpms.el7.tar.gz)上传至 **grafana_servers** 机器上安装。该离线包仅支持 CentOS 7 系统,包含 `fontconfig` 及 `open-sans-fonts`。 ``` $ tar -xzvf grafana-font-rpms.el7.tar.gz @@ -140,7 +140,7 @@ category: deployment $ ./install_grafana_font_rpms.sh ``` -3. 参考[部署任务](../op-guide/ansible-deployment.md#部署任务)即可。 +3. 参考[部署任务](../op-guide/ansible-deployment.md#部署任务)即可。 ## 测试集群 diff --git a/v2.1-legacy/op-guide/tune-tikv.md b/v2.1-legacy/op-guide/tune-tikv.md index 34907b8dfcad..9a3b0ef03048 100755 --- a/v2.1-legacy/op-guide/tune-tikv.md +++ b/v2.1-legacy/op-guide/tune-tikv.md @@ -18,7 +18,7 @@ TiKV 使用了 RocksDB 的 `Column Families` (CF) 特性。 - `lock` CF 存储的是锁信息,系统使用默认参数。 - Raft RocksDB 实例存储 Raft log。 - + - `default` CF 主要存储的是 Raft log,与其对应的参数位于 `[raftdb.defaultcf]` 项中。 每个 CF 都有单独的 `block-cache`,用于缓存数据块,加速 RocksDB 的读取速度,block-cache 的大小通过参数 `block-cache-size` 控制,block-cache-size 越大,能够缓存的热点数据越多,对读取操作越有利,同时占用的系统内存也会越多。 @@ -232,11 +232,8 @@ block-cache-size = "256MB" 1. 需预留一些内存作为系统的 page cache 2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 - ## TiKV 机器配置推荐 1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 - - diff --git a/v2.1-legacy/overview.md b/v2.1-legacy/overview.md index 7e5e0728692c..5d10bce99d59 100755 --- a/v2.1-legacy/overview.md +++ b/v2.1-legacy/overview.md @@ -10,7 +10,7 @@ TiDB 是 PingCAP 公司设计的开源分布式 HTAP (Hybrid Transactional and A TiDB 具备如下特性: - 高度兼容 MySQL - + [大多数情况下](/v2.1-legacy/reference/mysql-compatibility.md),无需修改代码即可从 MySQL 轻松迁移至 TiDB,分库分表后的 MySQL 集群亦可通过 TiDB 工具进行实时迁移。 - 水平弹性扩展 diff --git a/v2.1-legacy/releases/2.0.10.md b/v2.1-legacy/releases/2.0.10.md index 3cb3859504fa..ccd23298b50d 100755 --- a/v2.1-legacy/releases/2.0.10.md +++ b/v2.1-legacy/releases/2.0.10.md @@ -23,7 +23,7 @@ category: Releases - 修复统计信息某些情况下对点查估算的问题 [#8493](https://github.com/pingcap/tidb/pull/8493) - 修复某些情况下返回 Enum 默认值为字符串导致的 panic [#8476](https://github.com/pingcap/tidb/pull/8476) - 修复在宽表场景下,占用太多内存的问题 [#8467](https://github.com/pingcap/tidb/pull/8467) -- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) +- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) - 修复某些情况下添加外键约束导致的 panic 问题 [#8421](https://github.com/pingcap/tidb/pull/8421),[#8410](https://github.com/pingcap/tidb/pull/8410) - 修复 `YEAR` 类型错误转换零值的问题 [#8396](https://github.com/pingcap/tidb/pull/8396) - 修复 `VALUES` 函数在参数不为列的时候 panic 的问题 [#8404](https://github.com/pingcap/tidb/pull/8404) diff --git a/v2.1-legacy/releases/2.1ga.md b/v2.1-legacy/releases/2.1ga.md index 843c83bf6c4c..d58d54f26795 100755 --- a/v2.1-legacy/releases/2.1ga.md +++ b/v2.1-legacy/releases/2.1ga.md @@ -22,7 +22,7 @@ category: Releases - 优化 `EXPLAIN` 语句输出格式, 使用层级结构表示算子之间的上下游关系 + SQL 执行引擎 - + - 重构所有聚合函数,提升 `Stream` 和 `Hash` 聚合算子的执行效率 - 实现并行 `Hash Aggregate` 算子,部分场景下有 350% 的性能提升 - 实现并行 `Project` 算子,部分场景有 74% 的性能提升 @@ -46,7 +46,7 @@ category: Releases + 支持内建函数: - - `json_contains` + - `json_contains` - `json_contains_path` - `encode/decode` @@ -113,7 +113,7 @@ category: Releases - 新增 `GCSafePoint` 接口,用于支持 TiDB 并发分布式 GC - 新增 `GetAllStores` 接口,用于支持 TiDB 并发分布式 GC + pd-ctl 新增: - + - 使用统计信息进行 Region split - 调用 `jq` 来格式化 JSON 输出 - 查询指定 store 的 Region 信息 diff --git a/v2.1-legacy/releases/21rc4.md b/v2.1-legacy/releases/21rc4.md index dacd70ff1b3f..6a46324f7c82 100755 --- a/v2.1-legacy/releases/21rc4.md +++ b/v2.1-legacy/releases/21rc4.md @@ -10,33 +10,33 @@ category: Releases ## TiDB + SQL 优化器 - - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) - - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) + - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + SQL 执行引擎 - - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) - - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) - - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) - - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) - - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) + - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) + - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) + - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) + - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + 统计信息 - - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) - - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) - - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) - - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) - - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) + - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) + - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) + - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) + - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + Server - - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) - - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) - - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) - - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) + - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) + - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) + - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + 兼容性 - - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + 表达式 - 修复 `SYSDATE` 函数被常量折叠的问题 [#7895](https://github.com/pingcap/tidb/pull/7895) - - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + DDL - - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) - - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) + - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) + - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) ## PD diff --git a/v2.1-legacy/releases/rc3.md b/v2.1-legacy/releases/rc3.md index 6b57c34fdd89..8e7f92da528f 100755 --- a/v2.1-legacy/releases/rc3.md +++ b/v2.1-legacy/releases/rc3.md @@ -41,7 +41,7 @@ category: Releases - 通过 Key 获取 Region 信息 - 添加、删除 scheduler 和 operator - 获取集群 label 信息 - + ## TiKV + 支持 Async Apply 提升整体写入性能 diff --git a/v2.1-legacy/releases/rc4.md b/v2.1-legacy/releases/rc4.md index f2b42b956fa7..744f578a2df7 100755 --- a/v2.1-legacy/releases/rc4.md +++ b/v2.1-legacy/releases/rc4.md @@ -8,7 +8,7 @@ category: Releases 2017 年 8 月 4 日,TiDB 正式发布 RC4 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。性能方面重点优化了写入速度,计算任务调度支持优先级,避免分析型大事务影响在线事务。SQL 优化器全新改版,查询代价估算更加准确,且能够自动选择 Join 物理算子。功能方面进一步 MySQL 兼容性。 同时为了更好的支持 OLAP 业务,开源了 TiSpark 项目,可以通过 Spark 读取和分析 TiKV 中的数据。 -## TiDB: +## TiDB + SQL 查询优化器重构 - 更好的支持 TopN 查询 @@ -22,7 +22,7 @@ category: Releases + 支持 Json 类型及其操作 + 支持查询优先级、隔离级别的设置 -## PD: +## PD + 支持通过 PD 设置 TiKV location labels + 调度优化 @@ -31,7 +31,7 @@ category: Releases - 优化 balance 算法 + 优化数据加载,加快 failover 速度 -## TiKV: +## TiKV + 支持查询优先级设置 + 支持 RC 隔离级别 @@ -40,8 +40,8 @@ category: Releases + Coprocessor 支持更多下推函数 + 提升性能,提升稳定性 -## TiSpark Beta Release: - +## TiSpark Beta Release + + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 diff --git a/v2.1-legacy/sql/admin.md b/v2.1-legacy/sql/admin.md index 197ace1c4969..238ba1f47fd4 100755 --- a/v2.1-legacy/sql/admin.md +++ b/v2.1-legacy/sql/admin.md @@ -161,7 +161,7 @@ ADMIN CANCEL DDL JOBS job_id [, job_id] ... | 33 | test | | create schema | public | 32 | 0 | 0 | 2019-01-10 11:29:22.813 +0800 CST | synced | +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+-----------------------------------+---------------+ ``` - + * `JOB_ID`:每个 DDL 操作对应一个DDL job,`JOB_ID` 全局唯一。 * `DB_NAME`:DDL 操作的 database name。 * `TABLE_NAME`:DDL 操作的 table name。 diff --git a/v2.1-legacy/sql/datatype.md b/v2.1-legacy/sql/datatype.md index cb77dc61b592..452196b71123 100755 --- a/v2.1-legacy/sql/datatype.md +++ b/v2.1-legacy/sql/datatype.md @@ -31,6 +31,7 @@ TiDB 支持 MySQL 所有的数值类型,按照精度可以分为: TiDB 支持 MySQL 所有的整数类型,包括 INTEGER/INT、TINYINT、SMALLINT、MEDIUMINT 以及 BIGINT,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html)文档。 #### 类型定义 + 语法: ```sql @@ -93,7 +94,7 @@ FLOAT[(M,D)] [UNSIGNED] [ZEROFILL] DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL] > 双精度浮点数。允许的值范围为:-2^1024 ~ +2^1024,也即是 -1.7976931348623157E+308 到 -2.2250738585072014E-308、0 和 2.2250738585072014E-308 到 1.7976931348623157E+308。这些是理论限制,基于 IEEE 标准。实际的范围根据硬件或操作系统的不同可能稍微小些。 - + DOUBLE PRECISION [(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED] [ZEROFILL] > 为 DOUBLE 的同义词。 @@ -120,7 +121,6 @@ FLOAT(p) [UNSIGNED] [ZEROFILL] | `FLOAT(p)` | 如果 0 <= p <= 24 为 4 个字节, 如果 25 <= p <= 53 为 8 个字节| | `DOUBLE` | 8 | - ### 定点类型 TiDB 支持 MySQL 所有的定点类型,包括 DECIMAL、NUMERIC,完整信息参考[这篇](https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html)文档。 diff --git a/v2.1-legacy/sql/encryption-and-compression-functions.md b/v2.1-legacy/sql/encryption-and-compression-functions.md index 527a75ce4de1..f9f589fee924 100755 --- a/v2.1-legacy/sql/encryption-and-compression-functions.md +++ b/v2.1-legacy/sql/encryption-and-compression-functions.md @@ -5,7 +5,6 @@ category: user guide # 加密和压缩函数 - | 函数名 | 功能描述 | |:-----------|:----------------------------| | [`MD5()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_md5)                                                             | 计算字符串的 MD5 校验和       | diff --git a/v2.1-legacy/sql/literal-value-bit-value.md b/v2.1-legacy/sql/literal-value-bit-value.md index 210341fab568..22980153cef2 100755 --- a/v2.1-legacy/sql/literal-value-bit-value.md +++ b/v2.1-legacy/sql/literal-value-bit-value.md @@ -13,7 +13,6 @@ category: user guide * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v2.1-legacy/sql/literal-value-date-and-time-literals.md b/v2.1-legacy/sql/literal-value-date-and-time-literals.md index d3078831ba0b..f7c1d3e6d313 100755 --- a/v2.1-legacy/sql/literal-value-date-and-time-literals.md +++ b/v2.1-legacy/sql/literal-value-date-and-time-literals.md @@ -20,7 +20,7 @@ Dates 如果 year 部分只有两个数字,这是有歧义的(推荐使用 * year 值如果在 `70-99` 范围,那么被转换成 `1970-1999`。 * year 值如果在 `00-69` 范围,那么被转换成 `2000-2069`。 - + 对于小于 10 的 month 或者 day 值,`'2017-8-4'` 跟 `'2017-08-04'` 是一样的。对于 Time 也是一样,比如 `'2017-08-24 1:2:3'` 跟 `'2017-08-24 01:02:03'`是一样的。 在需要 Date 或者 Time 的语境下, 对于数值,TiDB 会根据数值的长度来选定指定的格式: diff --git a/v2.1-legacy/sql/literal-values.md b/v2.1-legacy/sql/literal-values.md index 7069f1274185..2e27ef9f28c9 100755 --- a/v2.1-legacy/sql/literal-values.md +++ b/v2.1-legacy/sql/literal-values.md @@ -52,17 +52,17 @@ SELECT _utf8'some text'; 转义字符: -- \\0: ASCII NUL (X'00') 字符 -- \\': 单引号 -- \\": 双引号 -- \\b: 退格符号 -- \\n: 换行符 -- \\r: 回车符 +- \\0: ASCII NUL (X'00') 字符 +- \\': 单引号 +- \\": 双引号 +- \\b: 退格符号 +- \\n: 换行符 +- \\r: 回车符 - \\t: tab 符(制表符) -- \\z: ASCII 26 (Ctrl + Z) -- \\\\: 反斜杠 \\ -- \\%: \% -- \\_: \_ +- \\z: ASCII 26 (Ctrl + Z) +- \\\\: 反斜杠 \\ +- \\%: \% +- \\_: \_ 如果要在 string literal 中使用 `'` 或者 `"`,有以下几种办法: @@ -211,7 +211,6 @@ mysql> SELECT TRUE, true, tRuE, FALSE, FaLsE, false; * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v2.1-legacy/sql/schema-object-names.md b/v2.1-legacy/sql/schema-object-names.md index 62a55aad02c0..a19875db00da 100755 --- a/v2.1-legacy/sql/schema-object-names.md +++ b/v2.1-legacy/sql/schema-object-names.md @@ -60,12 +60,12 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: ``` -`table_name`.`col_name` +`table_name`.`col_name` ``` 而不是: diff --git a/v2.1-legacy/tools/loader.md b/v2.1-legacy/tools/loader.md index 5304cd4747a0..e120cf376156 100755 --- a/v2.1-legacy/tools/loader.md +++ b/v2.1-legacy/tools/loader.md @@ -27,13 +27,13 @@ Loader 是由 PingCAP 开发的数据导入工具,用于向 TiDB 中导入数 ## 使用方法 -#### 注意事项 +### 注意事项 请勿使用 loader 导入 MySQL 实例中 `mysql` 系统数据库到下游 TiDB。 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -47,7 +47,7 @@ Loader 是由 PingCAP 开发的数据导入工具,用于向 TiDB 中导入数 -V 打印 loader 版本 -c string - 指定配置文件启动 loader + 指定配置文件启动 loader -checkpoint-schema string checkpoint 数据库名,loader 在运行过程中会不断的更新这个数据库,在中断并恢复后,会通过这个库获取上次运行的进度 (默认为 "tidb_loader") -d string @@ -121,7 +121,7 @@ port = 4000 ## FAQ #### 合库合表场景案例说明 - + 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 @@ -129,7 +129,7 @@ port = 4000 Loader 需要配置文件中开启 route-rules 参数以提供合库合表功能 -+ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` ++ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` + 如果 `pattern-table` 与 `target-table` 为空,将不进行表名称合并或转换 ```toml diff --git a/v2.1-legacy/tools/mydumper.md b/v2.1-legacy/tools/mydumper.md index a719dec37e95..4fe63c23af82 100755 --- a/v2.1-legacy/tools/mydumper.md +++ b/v2.1-legacy/tools/mydumper.md @@ -15,7 +15,7 @@ category: tools ## 相比于普通的 mydumper,此工具有哪些改进之处? + 使用 `tidb_snapshot` 而非 `FLUSH TABLES WITH READ LOCK` 提供备份一致性 -+ [允许设置](../op-guide/history-read.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ++ [允许设置](../op-guide/history-read.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ### 新添参数 diff --git a/v2.1-legacy/tools/sync-diff-inspector.md b/v2.1-legacy/tools/sync-diff-inspector.md index 19a75140ba1d..d5b7c7ce9c6f 100755 --- a/v2.1-legacy/tools/sync-diff-inspector.md +++ b/v2.1-legacy/tools/sync-diff-inspector.md @@ -151,12 +151,11 @@ password = "" # 库的名称 schema = "test" -# table list which need check in target database. +# table list which need check in target database. # in sharding mode, you must set config for every table in table-config, otherwise will not check the table. # 需要检查的表的名称 tables = ["test"] - # 配置该表对应的分表的相关配置 [[table-config]] # 目标库的名称 @@ -170,19 +169,19 @@ is-sharding = true # 源数据表的配置 [[table-config.source-tables]] -# 源数据库实例的 id +# 源数据库实例的 id instance-id = "source-1" schema = "test" table = "test1" [[table-config.source-tables]] -# 源数据库实例的 id +# 源数据库实例的 id instance-id = "source-1" schema = "test" table = "test2" [[table-config.source-tables]] -# 源数据库实例的 id +# 源数据库实例的 id instance-id = "source-2" schema = "test" table = "test3" @@ -223,4 +222,4 @@ password = "" ### 注意 -TiDB 使用的 collation 为 utf8_bin,如果对 MySQL 和 TiDB 的数据进行对比,需要注意 MySQL 中表的 collation 设置。如果表的主键/唯一键为 varchar 类型,且 MySQL 中 collation 设置与 TiDB 不同,可能会因为排序问题导致最终校验结果不正确,需要在 sync-diff-inspector 的配置文件中增加 collation 设置。 \ No newline at end of file +TiDB 使用的 collation 为 utf8_bin,如果对 MySQL 和 TiDB 的数据进行对比,需要注意 MySQL 中表的 collation 设置。如果表的主键/唯一键为 varchar 类型,且 MySQL 中 collation 设置与 TiDB 不同,可能会因为排序问题导致最终校验结果不正确,需要在 sync-diff-inspector 的配置文件中增加 collation 设置。 diff --git a/v2.1-legacy/tools/syncer.md b/v2.1-legacy/tools/syncer.md index 6040802f6231..aa351cbf9a6b 100755 --- a/v2.1-legacy/tools/syncer.md +++ b/v2.1-legacy/tools/syncer.md @@ -49,7 +49,7 @@ binlog-pos = 930143241 binlog-gtid = "2bfabd22-fff7-11e6-97f7-f02fa73bcb01:1-23,61ccbb5d-c82d-11e6-ac2e-487b6bd31bf7:1-4" ``` -> **注:** +> **注:** > > - `syncer.meta` 只需要第一次使用的时候配置,后续 Syncer 同步新的 binlog 之后会自动将其更新到最新的 position。 > - 如果使用 binlog position 同步则只需要配置 binlog-name binlog-pos; 使用 gtid 同步则需要设置 gtid,且启动 Syncer 时带有 `--enable-gtid`。 @@ -62,7 +62,7 @@ Syncer 的命令行参数说明: Usage of syncer: -L string 日志等级: debug, info, warn, error, fatal (默认为 "info") - -V + -V 输出 syncer 版本;默认 false -auto-fix-gtid 当 mysql master/slave 切换时,自动修复 gtid 信息;默认 false @@ -71,7 +71,7 @@ Usage of syncer: -c int syncer 处理 batch 线程数 (默认 16) -config string - 指定相应配置文件启动 sycner 服务;如 `--config config.toml` + 指定相应配置文件启动 sycner 服务;如 `--config config.toml` -enable-gtid 使用 gtid 模式启动 syncer;默认 false,开启前需要上游 MySQL 开启 GTID 功能 -log-file string @@ -107,19 +107,19 @@ status-addr = "127.0.0.1:10086" # skip-ddls 可以跳过与 TiDB 不兼容的 DDL 语句,支持正则语法。 # skip-ddls = ["^CREATE\\s+USER"] -# 注意: skip-events 已经废弃, 请使用 skip-dmls +# 注意: skip-events 已经废弃, 请使用 skip-dmls # skip-dmls 用于跳过 DML 语句. type 字段取值为 'insert', 'update', 'delete'。 # 下面的例子为跳过 foo.bar 表的所有 delete 语句。 # [[skip-dmls]] # db-name = "foo" # tbl-name = "bar" # type = "delete" -# +# # 下面的例子为跳过所有表的 delete 语句。 # [[skip-dmls]] # type = "delete" -# -# 下面的例子为跳过 foo 库中所有表的 delete 语句。 +# +# 下面的例子为跳过 foo 库中所有表的 delete 语句。 # [[skip-dmls]] # db-name = "foo" # type = "delete" @@ -132,7 +132,7 @@ status-addr = "127.0.0.1:10086" #[[replicate-do-table]] #db-name ="dbname" #tbl-name = "table-name" - + #[[replicate-do-table]] #db-name ="dbname1" #tbl-name = "table-name1" @@ -239,7 +239,7 @@ syncer-binlog = (ON.000001, 2504), syncer-binlog-gtid = 53ea0ed1-9bf8-11e6-8bea- 本部分将通过实际案例描述 Syncer 同步数据库参数的优先级关系。 -- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) +- 如果使用 route-rules 规则,参考 [Sharding 同步支持](#sharding-同步支持) - 优先级:replicate-do-db --> replicate-do-table --> replicate-ignore-db --> replicate-ignore-table ```toml @@ -307,7 +307,7 @@ tbl-name = "~^2016_.*" # 场景如下: # 数据库A 下有 order_2016 / history_2016 等多个数据库 # 数据库B 下有 order_2017 / history_2017 等多个数据库 -# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 +# 指定同步数据库A order_2016 数据库,数据表如下 2016_01 2016_02 ... 2016_12 # 指定同步数据表B order_2017 数据库,数据表如下 2017_01 2017_02 ... 2017_12 # 表内使用 order_id 作为主键,数据之间主键不冲突 # 忽略同步 history_2016 与 history_2017 数据库 @@ -340,13 +340,13 @@ target-table = "order_2017" 1. 源库 server-id 检查 - - 可通过以下命令查看 server-id + - 可通过以下命令查看 server-id - 结果为空或者为 0,Syncer 无法同步数据 - Syncer server-id 与 MySQL server-id 不能相同,且在 MySQL cluster 中唯一 ```sql mysql> show global variables like 'server_id'; - +---------------+------- + +---------------+------- | Variable_name | Value | +---------------+-------+ | server_id | 1 | @@ -421,17 +421,17 @@ target-table = "order_2017" 6. 检查上下游同步用户权限 - 需要上游 MySQL 同步账号至少赋予以下权限: - + ``` select , replication slave , replication client ``` - + - 下游 TiDB 可暂时采用 root 同权限账号 7. 检查 GTID 与 POS 相关信息 - 使用以下语句查看 binlog 内容: - + ```sql show binlog events in 'mysql-bin.000023' from 136676560 limit 10; ``` @@ -476,7 +476,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 Dashboard [配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source -### Grafana Syncer metrics 说明 +### Grafana Syncer metrics 说明 #### title: binlog events diff --git a/v2.1-legacy/tools/tidb-binlog-cluster.md b/v2.1-legacy/tools/tidb-binlog-cluster.md index 9beb5f7c16a7..93a1572e9307 100755 --- a/v2.1-legacy/tools/tidb-binlog-cluster.md +++ b/v2.1-legacy/tools/tidb-binlog-cluster.md @@ -135,35 +135,35 @@ Pump 和 Drainer 都支持部署和运行在 Intel x86-64 架构的 64 位通用 2. 部署并启动含 Pump 组件的 TiDB 集群 参照上文配置完 `inventory.ini` 文件后,从以下两种方式中选择一种进行部署。 - + **方式一**:在已有的 TiDB 集群上增加 Pump 组件,需按以下步骤逐步进行。 - + 1. 部署 pump_servers 和 node_exporters - + ``` ansible-playbook deploy.yml -l ${pump1_ip}, ${pump2_ip}, [${alias1_name}, ${alias2_name}] ``` - + 2. 启动 pump_servers - + ``` ansible-playbook start.yml --tags=pump ``` - + 3. 更新并重启 tidb_servers - + ``` ansible-playbook rolling_update.yml --tags=tidb ``` - + 4. 更新监控信息 - + ``` ansible-playbook rolling_update_monitor.yml --tags=prometheus ``` **方式二**:从零开始部署含 Pump 组件的 TiDB 集群 - + 使用 Ansible 部署 TiDB 集群,方法参考 [TiDB Ansible 部署方案](../op-guide/ansible-deployment.md)。 3. 查看 Pump 服务状态 @@ -266,8 +266,8 @@ Pump 和 Drainer 都支持部署和运行在 Intel x86-64 架构的 64 位通用 db-type = "pb" # Uncomment this if you want to use `pb` or `sql` as `db-type`. - # `Compress` compresses the output file, like the `pb` and `sql` file. Now it supports the `gzip` algorithm only. - # The value can be `gzip`. Leave it empty to disable compression. + # `Compress` compresses the output file, like the `pb` and `sql` file. Now it supports the `gzip` algorithm only. + # The value can be `gzip`. Leave it empty to disable compression. [syncer.to] compression = "" # default data directory: "{{ deploy_dir }}/data.drainer" @@ -394,7 +394,7 @@ Drainer="192.168.0.13" ```bash ./bin/pump -config pump.toml ``` - + 如果命令行参数与配置文件中的参数重合,则使用命令行设置的参数的值。 2. 使用 binary 部署 Drainer @@ -532,7 +532,7 @@ Drainer="192.168.0.13" # topic-name = "" ``` - - 启动示例 + - 启动示例 > **注意:** > @@ -632,7 +632,7 @@ Usage of binlogctl: ``` - 修改 Pump/Drainer 的状态 - + 设置 `cmd` 为 `update-pump` 或者 `update-drainer` 来更新 Pump 或者 Drainer 的状态。Pump 和 Drainer 的状态可以为:online,pausing,paused,closing 以及 offline。例如: ```bash @@ -640,7 +640,7 @@ Usage of binlogctl: ``` 这条命令会修改 Pump/Drainer 保存在 pd 中的状态。 - + - 暂停/下线 Pump/Drainer 分别设置 `cmd` 为 `pause-pump`、`pause-drainer`、`offline-pump`、`offline-drainer` 来暂停 Pump、暂停 Drainer、下线 Pump、下线 Drainer。例如: @@ -673,9 +673,9 @@ Usage of binlogctl: ## 版本升级方法 新版本的 TiDB(v2.0.8-binlog、v2.1.0-rc.5 及以上版本)不兼容 [Kafka 版本](../tools/tidb-binlog-kafka.md)以及 [Local 版本](../tools/tidb-binlog.md)的 TiDB-Binlog,集群升级到新版本后只能使用 Cluster 版本的 TiDB-Binlog。如果在升级前已经使用了 Kafka/Local 版本的 TiDB-Binlog,必须将其升级到 Cluster 版本。 - + TiDB-Binlog 版本与 TiDB 版本的对应关系如下: - + | TiDB-Binlog 版本 | TiDB 版本 | 说明 | |---|---|---| | Local | TiDB 1.0 及更低版本 || diff --git a/v2.1-legacy/tools/tidb-binlog-kafka.md b/v2.1-legacy/tools/tidb-binlog-kafka.md index 1fa3b7b46916..0328677cd7df 100755 --- a/v2.1-legacy/tools/tidb-binlog-kafka.md +++ b/v2.1-legacy/tools/tidb-binlog-kafka.md @@ -128,7 +128,7 @@ cd tidb-binlog-kafka-linux-amd64 - `broker.id`:用来标识 Kafka 集群的必备参数,不能重复;如 `broker.id = 1` - `fs.file-max = 1000000`:Kafka 会使用大量文件和网络 socket,建议修改成 1000000,通过 `vi /etc/sysctl.conf` 进行修改 - 修改以下配置为1G, 否则很容易出现事务修改数据较多导致单个消息过大写 kafka 失败 - + * `message.max.bytes=1073741824` * `replica.fetch.max.bytes=1073741824` * `fetch.message.max.bytes=1073741824` @@ -415,7 +415,7 @@ PbReader 使用示例 + 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号:admin,密码:admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 - + > **注意:** > > Type 选 Prometheus,URL 为 Prometheus 地址,根据实际情况添加/填写。 diff --git a/v2.1-legacy/tools/tidb-binlog-monitor.md b/v2.1-legacy/tools/tidb-binlog-monitor.md index 0c5069490577..4412a8edbb99 100755 --- a/v2.1-legacy/tools/tidb-binlog-monitor.md +++ b/v2.1-legacy/tools/tidb-binlog-monitor.md @@ -104,12 +104,12 @@ category: tools - 判断从 Pump 获取数据是否太慢: 监控 Pump handle tso 可以看每个 Pump 最近一条消息的时间,是不是有延迟特别大的 Pump,确认对应 Pump 正常运行 - + - 根据 Drainer event 和 Drainer execute latency 来判断是否下游同步太慢: - + - 如果 Drainer execute time 过大,则检查到目标库网络带宽和延迟,以及目标库状态 - 如果 Drainer execute time 不大,Drainer event 过小,则增加 work count 和 batch 进行重试 - + - 上面都不满足或者操作后没有改观,则报备开发 support@pingcap.com 进行处理 ### Warning diff --git a/v2.1-legacy/tools/tidb-binlog.md b/v2.1-legacy/tools/tidb-binlog.md index ec3e00773e43..2447bc6fb968 100755 --- a/v2.1-legacy/tools/tidb-binlog.md +++ b/v2.1-legacy/tools/tidb-binlog.md @@ -22,7 +22,7 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为两个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 的主机上后台运行。他的主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入磁盘文件 @@ -34,7 +34,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 ### 下载官方 Binary -- CentOS 7+ +- CentOS 7+ ```bash # 下载压缩包 @@ -53,26 +53,25 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 注意 -* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 -* 手动部署时, 启动优先级为: Pump > TiDB ; 停止优先级为 TiDB > Pump - +* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 +* 手动部署时, 启动优先级为: Pump > TiDB ; 停止优先级为 TiDB > Pump 我们设置 TiDB 启动参数 binlog-socket 为对应的 Pump 的参数 socket 所指定的 unix socket 文件路径,最终部署结构如下图所示: ![TiDB pump 模块部署结构](../media/tidb-pump-deployment.png) -* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 +* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 -* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; +* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步; 为了保证数据的完整性,在 pump 运行 10 分钟左右后按顺序进行下面的操作 - * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` - * 全量备份,例如 mydumper 备份 tidb - * 全量导入备份到目标系统 - * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` + * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` + * 全量备份,例如 mydumper 备份 tidb + * 全量导入备份到目标系统 + * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` -* drainer 输出的 pb, 需要在配置文件设置下面的参数 +* drainer 输出的 pb, 需要在配置文件设置下面的参数 ```toml [syncer] @@ -85,14 +84,14 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 使用 tidb-ansible 部署 PUMP (推荐) -* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer +* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook deploy.yml * 执行 ansible-playbook start.yml * drainer 目前需要手动部署 -* 对已有的 TiDB Cluster 部署 binlog +* 对已有的 TiDB Cluster 部署 binlog * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook rolling_update.yml --tags=tidb @@ -163,7 +162,7 @@ Drainer 从各个 Pump 节点收集 Binlog,并按照在 TiDB 中事务的提 #### 使用 Binary 部署 Drainer -1. Drainer 命令行参数说明 +1. Drainer 命令行参数说明 ``` Usage of drainer: @@ -291,10 +290,10 @@ drainer 启动时可以设置 `--metrics-addr` 和 `--metrics-interval` 两个 ### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 ( 注: Type 选 Prometheus,Url 为 Prometheus 地址,根据实际情况 添加/填写 ) -+ 导入 dashboard 配置文件 ++ 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 [dashboard 配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source diff --git a/v2.1-legacy/trouble-shooting.md b/v2.1-legacy/trouble-shooting.md index eead39fd100a..21967e6a4462 100755 --- a/v2.1-legacy/trouble-shooting.md +++ b/v2.1-legacy/trouble-shooting.md @@ -17,28 +17,27 @@ category: advanced + 机器配置以及部署拓扑 + dmesg 中 TiDB 组件相关的问题 - ## 数据库连接不上 首先请确认集群的各项服务是否已经启动,包括 tidb-server、pd-server、tikv-server。请用 ps 命令查看所有进程是否在。如果某个组件的进程已经不在了,请参考对应的章节排查错误。 如果所有的进程都在,请查看 tidb-server 的日志,看是否有报错?常见的错误包括: -+ InformationSchema is out of date ++ InformationSchema is out of date 无法连接 tikv-server,请检查 pd-server 以及 tikv-server 的状态和日志。 -+ panic ++ panic 程序有错误,请将具体的 panic log [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new)。 如果是清空数据并重新部署服务,请确认以下信息: -+ pd-server、tikv-server 数据都已清空 ++ pd-server、tikv-server 数据都已清空 tikv-server 存储具体的数据,pd-server 存储 tikv-server 中数据的的元信息。如果只清空 pd-server 或只清空 tikv-server 的数据,会导致两边数据不匹配。 -+ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server ++ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server 集群 ID 是由 pd-server 在集群初始化时随机分配,所以重新部署集群后,集群 ID 会发生变化。tidb-server 业务需要重启以获取新的集群 ID。 @@ -46,15 +45,15 @@ category: advanced tidb-server 无法启动的常见情况包括: -+ 启动参数错误 ++ 启动参数错误 请参考[TiDB 命令行参数](op-guide/configuration.md#tidb) - -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 tidb-server 启动所需要的端口未被占用。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志,确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 @@ -67,50 +66,50 @@ tidb-server 无法启动的常见情况包括: ## tikv-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[TiKV 启动参数](op-guide/configuration.md#tikv)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tikv-server 启动所需要的端口未被占用: `lsof -i:port`。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志。确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性, 确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 -+ 文件被占用 ++ 文件被占用 不要在一个数据库文件目录上打开两个 tikv。 ## pd-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[PD 命令行参数](op-guide/configuration.md#placement-driver-pd)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 pd-server 启动所需要的端口未被占用: `lsof -i:port`。 ## TiDB/TiKV/PD 进程异常退出 -+ 进程是否是启动在前台 ++ 进程是否是启动在前台 当前终端退出给其所有子进程发送 HUP 信号,从而导致进程退出。 -+ 是否是在命令行用过 `nohup+&` 方式直接运行 ++ 是否是在命令行用过 `nohup+&` 方式直接运行 这样依然可能导致进程因终端连接突然中断,作为终端 SHELL 的子进程被杀掉。 推荐将启动命令写在脚本中,通过脚本运行(相当于二次 fork 启动)。 ## TiKV 进程异常重启 -+ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 ++ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 如果有 OOM 信息并且杀掉的进程为 TiKV,请减少 TiKV 的 RocksDB 的各个 CF 的 `block-cache-size` 值。 -+ 检查 TiKV 日志是否有 panic 的 log ++ 检查 TiKV 日志是否有 panic 的 log 提交 Issue 并附上 panic 的 log。 @@ -145,4 +144,4 @@ tidb-server 无法启动的常见情况包括: + pd-server 和 tikv-server 是否分开部署 + 目前正在进行什么操作 + 用 `top -H` 命令查看当前占用 CPU 的线程名 -+ 最近一段时间的网络/IO 监控数据是否有异常 \ No newline at end of file ++ 最近一段时间的网络/IO 监控数据是否有异常 diff --git a/v2.1/benchmark/sysbench-v2.md b/v2.1/benchmark/sysbench-v2.md index 4ca39cc70da0..bce70f8a8400 100644 --- a/v2.1/benchmark/sysbench-v2.md +++ b/v2.1/benchmark/sysbench-v2.md @@ -26,7 +26,7 @@ IDC 机器 | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD * 1 | +| DISK | Optane 500GB SSD * 1 | ## 测试方案 @@ -55,15 +55,15 @@ IDC 机器 ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 ``` * v2.0.0-rc6 - ``` + ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 use-delete-range: false ``` @@ -83,7 +83,7 @@ IDC 机器 ## 测试结果 -### 标准 Select 测试 +### 标准 Select 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -98,7 +98,7 @@ IDC 机器 GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 -### 标准 OLTP 测试 +### 标准 OLTP 测试 | 版本 | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---:| @@ -113,7 +113,7 @@ GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 GA2.0 比 GA1.0 在 OLTP 性能上,性能基本一致。 -### 标准 Insert 测试 +### 标准 Insert 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | diff --git a/v2.1/benchmark/sysbench-v3.md b/v2.1/benchmark/sysbench-v3.md index d8bed54b9bee..35270f2451c3 100644 --- a/v2.1/benchmark/sysbench-v3.md +++ b/v2.1/benchmark/sysbench-v3.md @@ -26,7 +26,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD \* 1 | +| DISK | Optane 500GB SSD \* 1 | Sysbench 版本:1.1.0 @@ -139,4 +139,4 @@ v2.1 与 v2.0 在 Update Non-Index 写入性能上基本一致。 ![update index](/media/sysbench_v3_update_index.png) -v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 \ No newline at end of file +v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 diff --git a/v2.1/benchmark/sysbench.md b/v2.1/benchmark/sysbench.md index 44c4fdfd2d9c..5a0cef1ef00e 100644 --- a/v2.1/benchmark/sysbench.md +++ b/v2.1/benchmark/sysbench.md @@ -16,7 +16,7 @@ draft: true ## 测试版本、时间、地点 -TiDB 版本:v1.0.0 +TiDB 版本:v1.0.0 时间:2017 年 10 月 20 日 地点:北京 @@ -29,11 +29,11 @@ IDC 机器 | OS | linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5T SSD * 2 + Optane SSD * 1 | +| DISK | 1.5T SSD \* 2 + Optane SSD \* 1 | Sysbench 版本: 1.0.6 -测试脚本: https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench +测试脚本: ## 测试方案 @@ -41,7 +41,7 @@ Sysbench 版本: 1.0.6 测试表结构 -``` +``` CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned NOT NULL DEFAULT '0', @@ -49,17 +49,17 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB +) ENGINE=InnoDB ``` 部署方案以及配置参数 -``` +``` // TiDB 部署方案 172.16.20.4 4*tikv 1*tidb 1*sysbench 172.16.20.6 4*tikv 1*tidb 1*sysbench 172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench // 每个物理节点有三块盘: data3: 2 tikv (Optane SSD) @@ -89,8 +89,8 @@ Mysql version: 5.6.37 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql max_connections = 2000 ``` @@ -109,9 +109,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 1902 | 38045 | 134.56 ms / 363.18 ms | | Mysql | 32 | 1000 万 | 256 | 1770 | 35416 | 144.55 ms / 383.33 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) +![threads_oltp](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) +![table_size_oltp](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -128,9 +128,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 386866 | 0.66 ms / 1.64 ms | | Mysql | 32 | 1000 万 | 256 | 388273 | 0.66 ms / 1.64 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) +![threads_select](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) +![table_size_select](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -146,11 +146,10 @@ max_connections = 2000 | Mysql | 32 | 100 万 | 256 | 14508 | 17.64 ms / 44.98 ms | | Mysql | 32 | 500 万 | 256 | 10593 | 24.16 ms / 82.96 ms | | Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | - -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) +![threads_insert](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +![table_size_insert](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) ### 场景二:TiDB 水平扩展能力测试 @@ -187,7 +186,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 8984 | 179692 | 114.96 ms / 176.73 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 12953 | 259072 | 117.80 ms / 200.47 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_oltp](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -198,7 +197,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 289933 | 3.53 ms / 8.74 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 435313 | 3.55 ms / 9.17 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_select](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -208,4 +207,4 @@ block-cache-size = "2GB" | 5 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 60689 | 37.96 ms / 29.9 ms | | 7 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 80087 | 9.62 ms / 21.37 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) +![scale_tikv_insert](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) diff --git a/v2.1/how-to/deploy/data-migration-with-ansible.md b/v2.1/how-to/deploy/data-migration-with-ansible.md index cf13608ce3b6..d80077c274fc 100644 --- a/v2.1/how-to/deploy/data-migration-with-ansible.md +++ b/v2.1/how-to/deploy/data-migration-with-ansible.md @@ -165,7 +165,7 @@ DM-Ansible 是 PingCAP 基于 [Ansible](https://docs.ansible.com/ansible/latest/ ``` 2. 运行如下命令,然后输入部署目标机器的 `root` 用户密码。 - + ```bash $ ansible-playbook -i hosts.ini create_users.yml -u root -k ``` @@ -295,10 +295,10 @@ grafana_admin_user = "admin" grafana_admin_password = "admin" ``` -### DM-worker 配置及参数描述 +### DM-worker 配置及参数描述 | 变量名称 | 描述 | -| ------------- | ------- +| ------------- | ------- | source_id | DM-worker 绑定到的一个数据库实例或是具有主从架构的复制组。当发生主从切换的时候,只需要更新 `mysql_host` 或 `mysql_port` 而不用更改该 ID 标识。 | | server_id | DM-worker 伪装成一个 MySQL slave,该变量即为这个 slave 的 server ID,在 MySQL 集群中需保持全局唯一。取值范围 0 ~ 4294967295。| | mysql_host | 上游 MySQL 主机 | @@ -398,6 +398,7 @@ dm-worker2 ansible_host=172.16.10.73 source_id="mysql-replica-02" server_id=102 ```ini ansible_user = tidb ``` + > **注意:** > > 请勿将 `ansible_user` 设为 `root`,因为 `tidb-ansible` 限制服务需以普通用户运行。 @@ -425,6 +426,7 @@ dm-worker2 ansible_host=172.16.10.73 source_id="mysql-replica-02" server_id=102 ```bash ansible-playbook start.yml ``` + 此操作会按顺序启动 DM 集群的所有组件,包括 DM-master,DM-worker,以及监控组件。当一个 DM 集群被关闭后,您可以使用该命令将其开启。 ## 第 10 步:关闭 DM 集群 @@ -441,7 +443,6 @@ $ ansible-playbook stop.yml ### 默认服务端口 - | 组件 | 端口变量 | 默认端口 | 描述 | | :-- | :-- | :-- | :-- | | DM-master | `dm_master_port` | 8261 | DM-master 服务交流端口 | diff --git a/v2.1/how-to/deploy/geographic-redundancy/overview.md b/v2.1/how-to/deploy/geographic-redundancy/overview.md index a657fee923dd..80daae48a75e 100644 --- a/v2.1/how-to/deploy/geographic-redundancy/overview.md +++ b/v2.1/how-to/deploy/geographic-redundancy/overview.md @@ -63,7 +63,6 @@ TiDB, TiKV, PD 分别分布在 3 个不同的中心,这是最常规,可用 > > 在两数据中心 + binlog 同步部署方案中,数据中心之间只有 binlog 异步复制。在数据中心间的延迟较高的情况下,从集群落后主集群的数据量会增大。当主集群故障后(DR),会造成数据丢失,丢失的数据量受网络延迟等因素影响。 - ## 高可用和容灾分析 对于三数据中心方案和两地三中心方案,我们能得到的保障是任意一个数据中心故障时,集群能自动恢复服务,不需要人工介入,并能保证数据一致性。注意各种调度策略都是用于帮助性能优化的,当发生故障时调度机制总是第一优先考虑可用性而不是性能。 diff --git a/v2.1/how-to/deploy/orchestrated/offline-ansible.md b/v2.1/how-to/deploy/orchestrated/offline-ansible.md index 0cb4368208c2..f4be9efc8ba5 100644 --- a/v2.1/how-to/deploy/orchestrated/offline-ansible.md +++ b/v2.1/how-to/deploy/orchestrated/offline-ansible.md @@ -83,7 +83,7 @@ category: how-to ```bash # yum install epel-release # yum install ansible curl - # ansible --version + # ansible --version ansible 2.5.0 ``` diff --git a/v2.1/how-to/deploy/tidb-binlog.md b/v2.1/how-to/deploy/tidb-binlog.md index 8519d1e9d11e..55e8626a5250 100644 --- a/v2.1/how-to/deploy/tidb-binlog.md +++ b/v2.1/how-to/deploy/tidb-binlog.md @@ -336,7 +336,7 @@ Drainer="192.168.0.13" ```bash ./bin/pump -config pump.toml ``` - + 如果命令行参数与配置文件中的参数重合,则使用命令行设置的参数的值。 2. 使用 binary 部署 Drainer @@ -474,7 +474,7 @@ Drainer="192.168.0.13" # topic-name = "" ``` - - 启动示例 + - 启动示例 > **注意:** > diff --git a/v2.1/how-to/get-started/tidb-binlog.md b/v2.1/how-to/get-started/tidb-binlog.md index 13690c7ef7e1..8e2775ccdca1 100644 --- a/v2.1/how-to/get-started/tidb-binlog.md +++ b/v2.1/how-to/get-started/tidb-binlog.md @@ -61,7 +61,7 @@ sudo yum install -y mariadb-server ```bash printf > pd.toml %s\\n 'log-file="pd.log"' 'data-dir="pd.data"' - printf > tikv.toml %s\\n 'log-file="tikv.log"' '[storage]' 'data-dir="tikv.data"' '[pd]' 'endpoints=["127.0.0.1:2379"]' '[rocksdb]' max-open-files=1024 '[raftdb]' max-open-files=1024 + printf > tikv.toml %s\\n 'log-file="tikv.log"' '[storage]' 'data-dir="tikv.data"' '[pd]' 'endpoints=["127.0.0.1:2379"]' '[rocksdb]' max-open-files=1024 '[raftdb]' max-open-files=1024 printf > pump.toml %s\\n 'log-file="pump.log"' 'data-dir="pump.data"' 'addr="127.0.0.1:8250"' 'advertise-addr="127.0.0.1:8250"' 'pd-urls="http://127.0.0.1:2379"' printf > tidb.toml %s\\n 'store="tikv"' 'path="127.0.0.1:2379"' '[log.file]' 'filename="tidb.log"' '[binlog]' 'enable=true' printf > drainer.toml %s\\n 'log-file="drainer.log"' '[syncer]' 'db-type="mysql"' '[syncer.to]' 'host="127.0.0.1"' 'user="root"' 'password=""' 'port=3306' @@ -157,7 +157,6 @@ sudo yum install -y mariadb-server 如果有服务启动失败(例如出现 “`Exit 1`” 而不是 “`Running`”),尝试重启单个组件。 - ## 连接 按以上步骤操作后,TiDB 的 4 个组件开始运行。接下来可以使用以下 MariaDB 或 MySQL 命令行客户端,通过 4000 端口连接到 TiDB 服务: @@ -183,7 +182,6 @@ Check Table Before Drop: false 连接后TiDB 集群已开始运行,`pump` 读取集群中的 binlog 数据,并在其数据目录中将 binlog 数据存储为 relay log。下一步是启动一个可供 `drainer` 写入的 MariaDB Server。 - 1. 启动 `drainer`: ```bash diff --git a/v2.1/how-to/get-started/tispark.md b/v2.1/how-to/get-started/tispark.md index 13722f6ea31b..ede3d0677063 100644 --- a/v2.1/how-to/get-started/tispark.md +++ b/v2.1/how-to/get-started/tispark.md @@ -17,7 +17,7 @@ category: how-to ### 在 TiDB 实例上安装 JDK -在 [Oracle JDK 官方下载页面 ](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html) 下载 JDK 1.8 当前最新版,本示例中下载的版本为 `jdk-8u141-linux-x64.tar.gz`。 +在 [Oracle JDK 官方下载页面](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html) 下载 JDK 1.8 当前最新版,本示例中下载的版本为 `jdk-8u141-linux-x64.tar.gz`。 解压并根据您的 JDK 部署目录设置环境变量, 编辑 `~/.bashrc` 文件,比如: @@ -97,8 +97,6 @@ MySQL [TPCH_001]> show tables; ## 使用范例 - - 进入 spark 部署目录启动 spark-shell: ``` @@ -172,4 +170,4 @@ scala> spark.sql( -----------------+---------+------------+--------+-----------+ ``` -更多样例请参考 https://github.com/ilovesoup/tpch/tree/master/sparksql +更多样例请参考 diff --git a/v2.1/how-to/maintain/tidb-binlog.md b/v2.1/how-to/maintain/tidb-binlog.md index 9387b3efa6a4..abbfe2b40af2 100644 --- a/v2.1/how-to/maintain/tidb-binlog.md +++ b/v2.1/how-to/maintain/tidb-binlog.md @@ -98,7 +98,7 @@ Usage of binlogctl: ``` - 修改 Pump/Drainer 的状态 - + 设置 `cmd` 为 `update-pump` 或者 `update-drainer` 来更新 Pump 或者 Drainer 的状态。Pump 和 Drainer 的状态可以为:online,pausing,paused,closing 以及 offline。例如: ```bash diff --git a/v2.1/how-to/migrate/from-aurora.md b/v2.1/how-to/migrate/from-aurora.md index 9d0a60023ce3..863cafd408c9 100644 --- a/v2.1/how-to/migrate/from-aurora.md +++ b/v2.1/how-to/migrate/from-aurora.md @@ -45,7 +45,7 @@ DM 在增量同步阶段依赖 `ROW` 格式的 binlog,如果未启用 binlog 目前推荐使用 DM-Ansible 部署 DM 集群,具体部署方法参照[使用 DM-Ansible 部署 DM 集群](/reference/tools/data-migration/deployment.md)。 > **注意:** -> +> > - 在 DM 所有的配置文件中,数据库的密码要使用 dmctl 加密后的密文。如果数据库密码为空,则不需要加密。关于如何使用 dmctl 加密明文密码,参考[使用 dmctl 加密上游 MySQL 用户密码](/reference/tools/data-migration/deployment.md#使用-dmctl-加密上游-mysql-用户密码)。 > - 上下游数据库用户必须拥有相应的读写权限。 @@ -145,10 +145,10 @@ mydumpers: # `task.yaml` 是之前编辑的配置文件 start-task ./task.yaml ``` - + - 如果执行命令后的返回结果中不包含错误信息,则表明任务已经成功启动 - 如果包含以下错误信息,则表明上游 Aurora 用户可能拥有 TiDB 不支持的权限类型 - + ```json { "id": 4, @@ -169,10 +169,12 @@ mydumpers: "extra": "address of db instance - pingcap-1.h8emfqdptyc4.us-east-2.rds.amazonaws.com" } ``` - + 此时可以选择以下两种处理方法中的任意一种进行处理后,再使用 `start-task` 尝试重新启动任务: + 1. 为用于进行数据迁移的 Aurora 用户移除不被 TiDB 支持的不必要的权限 2. 如果能确保 Aurora 用户拥有 DM 所需要的权限,可以在 `task.yaml` 配置文件中添加如下顶级配置项以跳过启用任务时的前置权限检查 + ```yaml ignore-checking-items: ["dump_privilege", "replication_privilege"] ``` diff --git a/v2.1/how-to/migrate/incrementally-from-mysql.md b/v2.1/how-to/migrate/incrementally-from-mysql.md index 5613aace8acf..fa5afe8cf1cd 100644 --- a/v2.1/how-to/migrate/incrementally-from-mysql.md +++ b/v2.1/how-to/migrate/incrementally-from-mysql.md @@ -201,7 +201,6 @@ mysql> select * from t1; `syncer` 每隔 30s 会输出当前的同步统计,如下 - ```bash 2017/06/08 01:18:51 syncer.go:934: [info] [syncer]total events = 15, total tps = 130, recent tps = 4, master-binlog = (ON.000001, 11992), master-binlog-gtid=53ea0ed1-9bf8-11e6-8bea-64006a897c73:1-74, diff --git a/v2.1/how-to/scale/with-ansible.md b/v2.1/how-to/scale/with-ansible.md index a457f74a14bb..fb635fff7e20 100644 --- a/v2.1/how-to/scale/with-ansible.md +++ b/v2.1/how-to/scale/with-ansible.md @@ -117,7 +117,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 例如,如果要添加一个 PD 节点(node103),IP 地址为 172.16.10.103,可以进行如下操作: -1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: +1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: ```ini [tidb_servers] @@ -184,7 +184,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 4. 登录新增的 PD 节点,编辑启动脚本:`{deploy_dir}/scripts/run_pd.sh` - 1. 移除 `--initial-cluster="xxxx" \` 配置,注意这里不能在行开头加注释符 #。 + 1. 移除 `--initial-cluster="xxxx" \` 配置,注意这里不能在行开头加注释符 #。 2. 添加 `--join="http://172.16.10.1:2379" \`,IP 地址 (172.16.10.1) 可以是集群内现有 PD IP 地址中的任意一个。 @@ -195,7 +195,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 4. 使用 `pd-ctl` 检查新节点是否添加成功: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d member ``` @@ -211,7 +211,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` ansible-playbook start.yml -l 172.16.10.103 ``` - + 7. 更新 Prometheus 配置并重启: ``` @@ -301,7 +301,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 2. 从集群中移除 node9,假如 store id 为 10: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d store delete 10 ``` diff --git a/v2.1/how-to/secure/generate-self-signed-certificates.md b/v2.1/how-to/secure/generate-self-signed-certificates.md index 5e579594d60e..13a6fca62e5c 100644 --- a/v2.1/how-to/secure/generate-self-signed-certificates.md +++ b/v2.1/how-to/secure/generate-self-signed-certificates.md @@ -45,16 +45,16 @@ cfssl print-defaults csr > ca-csr.json ## 生成证书 -#### 证书介绍 +### 证书介绍 - tidb-server certificate 由 TiDB 使用,为其他组件和客户端验证 TiDB 身份。 - tikv-server certificate 由 TiKV 使用,为其他组件和客户端验证 TiKV 身份。 - pd-server certificate 由 PD 使用,为其他组件和客户端验证 PD 身份。 - client certificate 用于通过 PD、TiKV、TiDB 验证客户端。例如 `pd-ctl`,`tikv-ctl`,`pd-recover`。 -#### 配置 CA 选项 +### 配置 CA 选项 -根据实际需求修改 `ca-config.json`: +根据实际需求修改 `ca-config.json`: ```json { @@ -85,7 +85,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { @@ -105,7 +105,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -#### 生成 CA 证书 +### 生成 CA 证书 ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - @@ -119,7 +119,7 @@ ca.csr ca.pem ``` -#### 生成服务器端证书 +### 生成服务器端证书 `hostname` 中为各组件的 IP 地址,以及 `127.0.0.1` @@ -151,4 +151,4 @@ echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gen client-key.pem client.csr client.pem -``` \ No newline at end of file +``` diff --git a/v2.1/how-to/troubleshoot/cluster-setup.md b/v2.1/how-to/troubleshoot/cluster-setup.md index cd82af535005..70e4bb9daa17 100644 --- a/v2.1/how-to/troubleshoot/cluster-setup.md +++ b/v2.1/how-to/troubleshoot/cluster-setup.md @@ -17,28 +17,27 @@ category: how-to + 机器配置以及部署拓扑 + dmesg 中 TiDB 组件相关的问题 - ## 数据库连接不上 首先请确认集群的各项服务是否已经启动,包括 tidb-server、pd-server、tikv-server。请用 ps 命令查看所有进程是否在。如果某个组件的进程已经不在了,请参考对应的章节排查错误。 如果所有的进程都在,请查看 tidb-server 的日志,看是否有报错?常见的错误包括: -+ InformationSchema is out of date ++ InformationSchema is out of date 无法连接 tikv-server,请检查 pd-server 以及 tikv-server 的状态和日志。 -+ panic ++ panic 程序有错误,请将具体的 panic log [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new/choose)。 如果是清空数据并重新部署服务,请确认以下信息: -+ pd-server、tikv-server 数据都已清空 ++ pd-server、tikv-server 数据都已清空 tikv-server 存储具体的数据,pd-server 存储 tikv-server 中数据的的元信息。如果只清空 pd-server 或只清空 tikv-server 的数据,会导致两边数据不匹配。 -+ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server ++ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server 集群 ID 是由 pd-server 在集群初始化时随机分配,所以重新部署集群后,集群 ID 会发生变化。tidb-server 业务需要重启以获取新的集群 ID。 @@ -46,15 +45,15 @@ category: how-to tidb-server 无法启动的常见情况包括: -+ 启动参数错误 ++ 启动参数错误 请参考[TiDB 命令行参数](/reference/configuration/tidb-server/configuration.md) -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tidb-server 启动所需要的端口未被占用。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志,确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 @@ -67,50 +66,51 @@ tidb-server 无法启动的常见情况包括: ## tikv-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[TiKV 启动参数](/reference/configuration/tikv-server/configuration.md)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tikv-server 启动所需要的端口未被占用: `lsof -i:port`。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志。确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性, 确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 -+ 文件被占用 ++ 文件被占用 不要在一个数据库文件目录上打开两个 tikv。 ## pd-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[PD 命令行参数](/reference/configuration/pd-server/configuration.md)文档。 -+ 端口被占用:`lsof -i:port` + ++ 端口被占用:`lsof -i:port` 请确保 pd-server 启动所需要的端口未被占用: `lsof -i:port`。 ## TiDB/TiKV/PD 进程异常退出 -+ 进程是否是启动在前台 ++ 进程是否是启动在前台 当前终端退出给其所有子进程发送 HUP 信号,从而导致进程退出。 -+ 是否是在命令行用过 `nohup+&` 方式直接运行 ++ 是否是在命令行用过 `nohup+&` 方式直接运行 这样依然可能导致进程因终端连接突然中断,作为终端 SHELL 的子进程被杀掉。 推荐将启动命令写在脚本中,通过脚本运行(相当于二次 fork 启动)。 ## TiKV 进程异常重启 -+ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 ++ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 如果有 OOM 信息并且杀掉的进程为 TiKV,请减少 TiKV 的 RocksDB 的各个 CF 的 `block-cache-size` 值。 -+ 检查 TiKV 日志是否有 panic 的 log ++ 检查 TiKV 日志是否有 panic 的 log 提交 Issue 并附上 panic 的 log。 diff --git a/v2.1/how-to/upgrade/from-previous-version.md b/v2.1/how-to/upgrade/from-previous-version.md index 6c6003f5527f..d960f2864697 100644 --- a/v2.1/how-to/upgrade/from-previous-version.md +++ b/v2.1/how-to/upgrade/from-previous-version.md @@ -115,7 +115,7 @@ $ ansible-playbook local_prepare.yml > > 为优化 TiDB 集群组件的运维管理,TiDB 3.0 版本对 `systemd` 模式下的 `PD service` 名称进行了调整。与之前版本相比,滚动升级 TiDB 3.0 版本集群组件的操作略有不同,注意升级前后 `process_supervision` 参数配置须保持一致。 -如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 +如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 ``` $ ansible-playbook excessive_rolling_update.yml diff --git a/v2.1/how-to/upgrade/rolling-updates-with-ansible.md b/v2.1/how-to/upgrade/rolling-updates-with-ansible.md index 2b1204558063..281eec524437 100644 --- a/v2.1/how-to/upgrade/rolling-updates-with-ansible.md +++ b/v2.1/how-to/upgrade/rolling-updates-with-ansible.md @@ -5,7 +5,7 @@ category: how-to # 使用 TiDB-Ansible 升级 TiDB 集群 -滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd * 3、tidb * 2、tikv * 3)。 +滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd \* 3、tidb \* 2、tikv \* 3)。 > **注意:** > @@ -30,14 +30,14 @@ category: how-to > > 如果使用 master 分支的 tidb-ansible,`tidb_version = latest` 保持不变即可,latest 版本的 TiDB 安装包会每日更新。 -2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` +2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` ``` $ cd /home/tidb/tidb-ansible $ rm -rf downloads ``` -3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` +3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` ``` $ ansible-playbook local_prepare.yml @@ -64,7 +64,7 @@ $ wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz ``` $ ansible-playbook rolling_update.yml --tags=pd ``` - + 如果 PD 实例数大于等于 3,滚动升级 PD leader 实例时,Ansible 会先迁移 PD leader 到其他节点再关闭该实例。 - 滚动升级 TiKV 节点(只升级 TiKV 服务) diff --git a/v2.1/overview.md b/v2.1/overview.md index 73a114f2e95d..607689081539 100644 --- a/v2.1/overview.md +++ b/v2.1/overview.md @@ -10,7 +10,7 @@ TiDB 是 PingCAP 公司设计的开源分布式 HTAP (Hybrid Transactional and A TiDB 具备如下特性: - 高度兼容 MySQL - + [大多数情况下](/reference/mysql-compatibility.md),无需修改代码即可从 MySQL 轻松迁移至 TiDB,分库分表后的 MySQL 集群亦可通过 TiDB 工具进行实时迁移。 - 水平弹性扩展 @@ -60,4 +60,4 @@ TiDB 集群所有组件的源码均可从 GitHub 上直接访问: - [TiKV](https://github.com/tikv/tikv) - [PD](https://github.com/pingcap/pd) - [TiSpark](https://github.com/pingcap/tispark) -- [TiDB Operator](https://github.com/pingcap/tidb-operator) \ No newline at end of file +- [TiDB Operator](https://github.com/pingcap/tidb-operator) diff --git a/v2.1/reference/configuration/tidb-server/mysql-variables.md b/v2.1/reference/configuration/tidb-server/mysql-variables.md index f3fc7f0f41e6..ffa49c1d48aa 100644 --- a/v2.1/reference/configuration/tidb-server/mysql-variables.md +++ b/v2.1/reference/configuration/tidb-server/mysql-variables.md @@ -44,7 +44,7 @@ MySQL 系统变量 (System Variables) 是一些系统参数,用于调整数据 | ON | +---------------------+ 1 row in set (0.00 sec) - + mysql> SELECT @@SESSION.autocommit; +----------------------+ | @@SESSION.autocommit | @@ -52,10 +52,10 @@ MySQL 系统变量 (System Variables) 是一些系统参数,用于调整数据 | ON | +----------------------+ 1 row in set (0.00 sec) - + mysql> SET GLOBAL autocommit = OFF; Query OK, 0 rows affected (0.01 sec) - + mysql> SELECT @@SESSION.autocommit; -- 会话范围的系统变量不会改变,会话中执行的事务依旧是以自动提交的形式来进行。 +----------------------+ | @@SESSION.autocommit | @@ -63,7 +63,7 @@ MySQL 系统变量 (System Variables) 是一些系统参数,用于调整数据 | ON | +----------------------+ 1 row in set (0.00 sec) - + mysql> SELECT @@GLOBAL.autocommit; +---------------------+ | @@GLOBAL.autocommit | @@ -71,22 +71,22 @@ MySQL 系统变量 (System Variables) 是一些系统参数,用于调整数据 | OFF | +---------------------+ 1 row in set (0.00 sec) - + mysql> exit Bye $ mysql -h127.0.0.1 -P4000 -uroot -D test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.25-TiDB-None MySQL Community Server (Apache License 2.0) - + Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. - + Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. - + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - + mysql> SELECT @@SESSION.autocommit; -- 新建的会话会使用新的全局变量。 +----------------------+ | @@SESSION.autocommit | diff --git a/v2.1/reference/performance/tune-tikv.md b/v2.1/reference/performance/tune-tikv.md index 885f19731c45..3d645ec375e1 100644 --- a/v2.1/reference/performance/tune-tikv.md +++ b/v2.1/reference/performance/tune-tikv.md @@ -18,7 +18,7 @@ TiKV 使用了 RocksDB 的 `Column Families` (CF) 特性。 - `lock` CF 存储的是锁信息,系统使用默认参数。 - Raft RocksDB 实例存储 Raft log。 - + - `default` CF 主要存储的是 Raft log,与其对应的参数位于 `[raftdb.defaultcf]` 项中。 在 TiKV 3.0 版本后,所有的 CF 默认共同使用一个 block cache 实例。通过在 `[storage.block-cache]` 下设置 `capacity` 参数,你可以配置该 block cache 的大小。block cache 越大,能够缓存的热点数据越多,读取数据越容易,同时占用的系统内存也越多。如果要为每个 CF 使用单独的 block cache 实例,需要在 `[storage.block-cache]` 下设置 `shared=false`,并为每个 CF 配置单独的 block cache 大小。例如,可以在 `[rocksdb.writecf]` 下设置 `block-cache-size` 参数来配置 `write` CF 的大小。 @@ -75,9 +75,9 @@ log-level = "info" ## 如果未设置该参数,则由以下字段或其默认值的总和决定。 ## ## * rocksdb.defaultcf.block-cache-size 或系统全部内存的 25% -## * rocksdb.writecf.block-cache-size 或系统全部内存的 15% -## * rocksdb.lockcf.block-cache-size 或系统全部内存的 2% -## * raftdb.defaultcf.block-cache-size 或系统全部内存的 2% +## * rocksdb.writecf.block-cache-size 或系统全部内存的 15% +## * rocksdb.lockcf.block-cache-size 或系统全部内存的 2% +## * raftdb.defaultcf.block-cache-size 或系统全部内存的 2% ## ## 要在单个物理机上部署多个 TiKV 节点,需要显式配置该参数。 ## 否则,TiKV 中可能会出现 OOM 错误。 @@ -240,14 +240,11 @@ target-file-size-base = "32MB" 除了以上列出的 `block-cache` 以及 `write-buffer` 会占用系统内存外: -1. 需预留一些内存作为系统的 page cache -2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 - +1. 需预留一些内存作为系统的 page cache +2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 ## TiKV 机器配置推荐 -1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 -2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 -3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 - - +1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 +2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 +3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 diff --git a/v2.1/reference/sql/functions-and-operators/encryption-and-compression-functions.md b/v2.1/reference/sql/functions-and-operators/encryption-and-compression-functions.md index f7fe1c8e447a..0db5cde147b2 100644 --- a/v2.1/reference/sql/functions-and-operators/encryption-and-compression-functions.md +++ b/v2.1/reference/sql/functions-and-operators/encryption-and-compression-functions.md @@ -5,7 +5,6 @@ category: reference # 加密和压缩函数 - | 函数名 | 功能描述 | |:-----------|:----------------------------| | [`MD5()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_md5)                                                             | 计算字符串的 MD5 校验和       | diff --git a/v2.1/reference/sql/language-structure/literal-values.md b/v2.1/reference/sql/language-structure/literal-values.md index 1198d554d3cc..b3815ad9c088 100644 --- a/v2.1/reference/sql/language-structure/literal-values.md +++ b/v2.1/reference/sql/language-structure/literal-values.md @@ -52,17 +52,17 @@ SELECT _utf8'some text'; 转义字符: -- \\0: ASCII NUL (X'00') 字符 -- \\': 单引号 -- \\": 双引号 -- \\b: 退格符号 -- \\n: 换行符 -- \\r: 回车符 +- \\0: ASCII NUL (X'00') 字符 +- \\': 单引号 +- \\": 双引号 +- \\b: 退格符号 +- \\n: 换行符 +- \\r: 回车符 - \\t: tab 符(制表符) -- \\z: ASCII 26 (Ctrl + Z) -- \\\\: 反斜杠 \\ -- \\%: \% -- \\_: \_ +- \\z: ASCII 26 (Ctrl + Z) +- \\\\: 反斜杠 \\ +- \\%: \% +- \\_: \_ 如果要在 string literal 中使用 `'` 或者 `"`,有以下几种办法: @@ -213,7 +213,6 @@ mysql> SELECT TRUE, true, tRuE, FALSE, FaLsE, false; * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v2.1/reference/sql/language-structure/schema-object-names.md b/v2.1/reference/sql/language-structure/schema-object-names.md index 3f821c650aa4..8bbfc292072a 100644 --- a/v2.1/reference/sql/language-structure/schema-object-names.md +++ b/v2.1/reference/sql/language-structure/schema-object-names.md @@ -60,12 +60,12 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: ``` -`table_name`.`col_name` +`table_name`.`col_name` ``` 而不是: @@ -74,4 +74,4 @@ CREATE TABLE test.t (i int); `table_name.col_name` ``` -更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) \ No newline at end of file +更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) diff --git a/v2.1/reference/sql/statements/admin.md b/v2.1/reference/sql/statements/admin.md index d0f0e80e7eee..1a75ba91c815 100644 --- a/v2.1/reference/sql/statements/admin.md +++ b/v2.1/reference/sql/statements/admin.md @@ -79,7 +79,7 @@ admin show ddl jobs; * `JOB_TYPE`:DDL 操作的类型。 * `SCHEMA_STATE`:schema 的当前状态。如果 `JOB_TYPE` 是 `add index`,则为 index 的状态;如果是 `add column`,则为 column 的状态,如果是 `create table`,则为 table 的状态。常见的状态有以下几种: * `none`:表示不存在。一般 `drop` 操作或者 `create` 操作失败回滚后,会变为 `none` 状态。 - * `delete only`、`write only`、`delete reorganization`、`write reorganization`:这四种状态是中间状态,在[ Online, Asynchronous Schema Change in F1](http://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/41376.pdf) 论文中有详细说明,在此不再赘述。由于中间状态转换很快,一般操作中看不到这几种状态,只有执行 `add index` 操作时能看到处于 `write reorganization` 状态,表示正在添加索引数据。 + * `delete only`、`write only`、`delete reorganization`、`write reorganization`:这四种状态是中间状态,在 [Online, Asynchronous Schema Change in F1](http://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/41376.pdf) 论文中有详细说明,在此不再赘述。由于中间状态转换很快,一般操作中看不到这几种状态,只有执行 `add index` 操作时能看到处于 `write reorganization` 状态,表示正在添加索引数据。 * `public`:表示存在且可用。一般 `create table` 和 `add index/column` 等操作完成后,会变为 `public` 状态,表示新建的 table/column/index 可以正常读写了。 * `SCHEMA_ID`:执行 DDL 操作的数据库的 ID。 * `TABLE_ID`:执行 DDL 操作的表的 ID。 @@ -105,4 +105,4 @@ admin show ddl jobs; ## MySQL 兼容性 -ADMIN 语句是 TiDB 对于 MySQL 语法的扩展。 +ADMIN 语句是 TiDB 对于 MySQL 语法的扩展。 diff --git a/v2.1/reference/sql/statements/begin.md b/v2.1/reference/sql/statements/begin.md index 52b229dbeeae..ee9590050ced 100644 --- a/v2.1/reference/sql/statements/begin.md +++ b/v2.1/reference/sql/statements/begin.md @@ -10,7 +10,6 @@ category: reference 在没有 `BEGIN` 语句的情况下,每个语句默认在各自的事务中自动提交,从而确保 MySQL 兼容性。 - ## 语法图 **BeginTransactionStmt:** diff --git a/v2.1/reference/sql/statements/change-column.md b/v2.1/reference/sql/statements/change-column.md index 8756fa5959ad..066bdbbc1527 100644 --- a/v2.1/reference/sql/statements/change-column.md +++ b/v2.1/reference/sql/statements/change-column.md @@ -44,14 +44,14 @@ mysql> INSERT INTO t1 (col1) VALUES (1),(2),(3),(4),(5); Query OK, 5 rows affected (0.02 sec) Records: 5 Duplicates: 0 Warnings: 0 -mysql> +mysql> mysql> ALTER TABLE t1 CHANGE col1 col2 INT; Query OK, 0 rows affected (0.09 sec) mysql> ALTER TABLE t1 CHANGE col2 col3 BIGINT, ALGORITHM=INSTANT; Query OK, 0 rows affected (0.08 sec) -mysql> +mysql> mysql> ALTER TABLE t1 CHANGE col3 col3 INT; ERROR 1105 (HY000): unsupported modify column length 11 is less than origin 20 mysql> ALTER TABLE t1 CHANGE col3 col3 BLOB; @@ -60,7 +60,6 @@ mysql> ALTER TABLE t1 CHANGE col3 col4 BIGINT, CHANGE id id2 INT NOT NULL; ERROR 1105 (HY000): can't run multi schema change ``` - ## MySQL 兼容性 * 目前尚不支持在单个 `ALTER TABLE` 语句中进行多个更改。 @@ -72,4 +71,4 @@ ERROR 1105 (HY000): can't run multi schema change * [SHOW CREATE TABLE](/reference/sql/statements/show-create-table.md) * [ADD COLUMN](/reference/sql/statements/add-column.md) * [DROP COLUMN](/reference/sql/statements/drop-column.md) -* [MODIFY COLUMN](/reference/sql/statements/modify-column.md) \ No newline at end of file +* [MODIFY COLUMN](/reference/sql/statements/modify-column.md) diff --git a/v2.1/reference/sql/statements/create-index.md b/v2.1/reference/sql/statements/create-index.md index a1ff4e2bf6ee..f2986b3b0897 100644 --- a/v2.1/reference/sql/statements/create-index.md +++ b/v2.1/reference/sql/statements/create-index.md @@ -42,7 +42,6 @@ category: reference ![IndexOption](/media/sqlgram/IndexOption.png) - ## 示例 ```sql @@ -63,7 +62,7 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; +---------------------+----------+------+-------------------------------------------------------------+ 3 rows in set (0.00 sec) -mysql> CREATE INDEX c1 ON t1 (c1); +mysql> CREATE INDEX c1 ON t1 (c1); Query OK, 0 rows affected (0.30 sec) mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; diff --git a/v2.1/reference/sql/statements/drop-column.md b/v2.1/reference/sql/statements/drop-column.md index b602b1f3f131..ba4c43b78503 100644 --- a/v2.1/reference/sql/statements/drop-column.md +++ b/v2.1/reference/sql/statements/drop-column.md @@ -26,7 +26,6 @@ category: reference ![ColumnName](/media/sqlgram/ColumnName.png) - ## 示例 ```sql @@ -87,4 +86,4 @@ mysql> SELECT * FROM t1; * [ADD COLUMN](/reference/sql/statements/add-column.md) * [SHOW CREATE TABLE](/reference/sql/statements/show-create-table.md) -* [CREATE TABLE](/reference/sql/statements/create-table.md) \ No newline at end of file +* [CREATE TABLE](/reference/sql/statements/create-table.md) diff --git a/v2.1/reference/sql/statements/drop-user.md b/v2.1/reference/sql/statements/drop-user.md index 73d901f566d7..084dd0dd0572 100644 --- a/v2.1/reference/sql/statements/drop-user.md +++ b/v2.1/reference/sql/statements/drop-user.md @@ -18,7 +18,6 @@ category: reference ![Username](/media/sqlgram/Username.png) - ## 示例 ```sql @@ -70,4 +69,4 @@ ERROR 1141 (42000): There is no such grant defined for user 'newuser' on host '% * [CREATE USER](/reference/sql/statements/create-user.md) * [ALTER USER](/reference/sql/statements/alter-user.md) * [SHOW CREATE USER](/reference/sql/statements/show-create-user.md) -* [Privilege Management](/reference/security/privilege-system.md) \ No newline at end of file +* [Privilege Management](/reference/security/privilege-system.md) diff --git a/v2.1/reference/tidb-binlog-overview.md b/v2.1/reference/tidb-binlog-overview.md index 0ec67e82ae88..f411585018bb 100644 --- a/v2.1/reference/tidb-binlog-overview.md +++ b/v2.1/reference/tidb-binlog-overview.md @@ -60,7 +60,7 @@ Pump 和 Drainer 都支持部署和运行在 Intel x86-64 架构的 64 位通用 * 如果 TiDB Binlog 用于增量恢复,可以设置配置项 `db-type="file"`,Drainer 会将 binlog 转化为指定的 [proto buffer 格式](https://github.com/pingcap/tidb-binlog/blob/master/proto/binlog.proto)的数据,再写入到本地文件中。这样就可以使用 [Reparo](/reference/tools/tidb-binlog/reparo.md) 恢复增量数据。 关于 `db-type` 的取值,应注意: - + - 如果 TiDB 版本 < 2.1.9,则 `db-type="pb"`。 - 如果 TiDB 版本 > = 2.1.9,则 `db-type="file"` 或 `db-type="pb"`。 diff --git a/v2.1/reference/tispark.md b/v2.1/reference/tispark.md index 4484065908da..9c3ea38b29ec 100644 --- a/v2.1/reference/tispark.md +++ b/v2.1/reference/tispark.md @@ -38,7 +38,7 @@ TiSpark 可以在 YARN,Mesos,Standalone 等任意 Spark 模式下运行。 对于 TiKV 与 TiSpark 分开部署的场景,可以参考如下建议配置: -+ 硬件配置建议 ++ 硬件配置建议 普通场景可以参考 [TiDB 和 TiKV 硬件配置建议](/how-to/deploy/hardware-recommendations.md),但是如果是偏重分析的场景,可以将 TiKV 节点增加到至少 64G 内存。 @@ -69,7 +69,6 @@ spark.sql.extensions org.apache.spark.sql.TiExtensions 例如你有一组 PD 在`10.16.20.1`,`10.16.20.2`,`10.16.20.3`,那么 PD 配置格式是`10.16.20.1:2379,10.16.20.2:2379,10.16.20.3:2379`。 - ### TiSpark 与 TiKV 集群混合部署的配置 对于 TiKV 与 TiSpark 混合部署的场景,需在原有 TiKV 预留资源之外累加 Spark 所需部分,并分配 25% 的内存作为系统本身占用。 @@ -113,7 +112,9 @@ cd $SPARKPATH 类似地,可以用如下命令启动 Spark-Slave 节点: - ./sbin/start-slave.sh spark://spark-master-hostname:7077 +```bash +./sbin/start-slave.sh spark://spark-master-hostname:7077 +``` 命令返回以后,即可通过刚才的面板查看这个 Slave 是否已经正确地加入了 Spark 集群。在所有 Slave 节点重复刚才的命令。确认所有的 Slave 都可以正确连接 Master,这样你就拥有了一个 Standalone 模式的 Spark 集群。 @@ -227,7 +228,7 @@ df.write .option("isolationLevel", "NONE") // recommended to set isolationLevel to NONE if you have a large DF to load. .option("user", "root") // TiDB user here .save() -``` +``` 推荐将 `isolationLevel` 设置为 `NONE`,否则单一大事务有可能造成 TiDB 服务器内存溢出。 @@ -244,19 +245,17 @@ TiSpark 可以使用 TiDB 的统计信息: 统计信息将在 Spark Driver 进行缓存,请确定 Driver 内存足够缓存统计信息。 可以在`spark-defaults.conf`中开启或关闭统计信息读取: - + | Property Name | Default | Description | -------- | -----: | :----: | | spark.tispark.statistics.auto_load | true | 是否默认进行统计信息读取 | - - ## TiSpark FAQ -- Q. 是独立部署还是和现有 Spark/Hadoop 集群共用资源? +- Q. 是独立部署还是和现有 Spark/Hadoop 集群共用资源? A. 可以利用现有 Spark 集群无需单独部署,但是如果现有集群繁忙,TiSpark 将无法达到理想速度。 -- Q. 是否可以和 TiKV 混合部署? +- Q. 是否可以和 TiKV 混合部署? A. 如果 TiDB 以及 TiKV 负载较高且运行关键的线上任务,请考虑单独部署 TiSpark;并且考虑使用不同的网卡保证 OLTP 的网络资源不被侵占而影响线上业务。如果线上业务要求不高或者机器负载不大,可以考虑与 TiKV 混合部署。 diff --git a/v2.1/reference/tools/data-migration/cluster-operations.md b/v2.1/reference/tools/data-migration/cluster-operations.md index 174eee5c2fb1..421693ab2831 100644 --- a/v2.1/reference/tools/data-migration/cluster-operations.md +++ b/v2.1/reference/tools/data-migration/cluster-operations.md @@ -54,9 +54,9 @@ $ ansible-playbook stop.yml - DM 同步 sharding DDL 语句时,如果 DM-worker 成功执行(或跳过)sharding DDL 的 binlog event,与 DM-worker 中的 sharding DDL 语句相关的所有表的断点信息都会被更新至 DDL 语句对应的 binlog event 之后的位置。 - 当 DM-worker 重启发生在 sharding DDL 语句同步开始前或完成后,DM-worker 会根据断点信息和本地记录的子任务信息自动恢复数据同步。 - + - 当 DM-worker 重启发生在 sharding DDL 语句同步过程中,可能会出现作为 DDL lock owner 的 DM-worker 实例已执行了 DDL 语句并成功变更了下游数据库表结构,但其他 DM-worker 实例重启而无法跳过 DDL 语句也无法更新断点的情况。 - + 此时 DM 会再次尝试同步这些未跳过执行的 DDL 语句。然而,由于未重启的 DM-worker 实例已经执行到了此 DDL 对应的 binlog event 之后,重启的 DM-worker 实例会被阻滞在重启前 DDL binlog event 对应的位置。 要解决这个问题,请按照[手动处理 Sharding DDL Lock](/reference/tools/data-migration/features/manually-handling-sharding-ddl-locks.md#场景二unlock-过程中部分-dm-worker-重启) 中描述的步骤操作。 @@ -114,7 +114,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 下载 DM 二进制文件。 - 1. 从 `downloads` 目录删除已有文件。 + 1. 从 `downloads` 目录删除已有文件。 ``` $ cd /home/tidb/dm-ansible @@ -253,8 +253,8 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 为中控机设置 SSH 互信以及 sudo 规则。 - 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 - + 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + ``` $ cd /home/tidb/dm-ansible $ vi hosts.ini @@ -315,7 +315,8 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 为中控机设置 SSH 互信以及 sudo 规则。 - 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.75` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.75` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + ``` $ cd /home/tidb/dm-ansible $ vi hosts.ini @@ -333,7 +334,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 ``` 该步在 `172.16.10.75` 上创建了一个 `tidb` 用户,设置了 sudo 规则,并为中控机与该机器配置了 SSH 互信。 - + 2. 下线待替换 DM-worker 实例。 > **注意:** @@ -344,7 +345,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 $ ansible-playbook stop.yml --tags=dm-worker -l dm_worker1 ``` -3. 修改 `inventory.ini` 文件,为新 DM-worker 实例添加相关信息。 +3. 修改 `inventory.ini` 文件,为新 DM-worker 实例添加相关信息。 修改 `inventory.ini` 文件。注释或删除旧 `dm_worker1` 实例所在行;同时为新 `dm_worker1` 实例添加相关信息。 @@ -362,7 +363,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 $ ansible-playbook deploy.yml --tags=dm-worker -l dm_worker1 ``` -5. 启动新 DM-worker 实例。 +5. 启动新 DM-worker 实例。 ``` $ ansible-playbook start.yml --tags=dm-worker -l dm_worker1 diff --git a/v2.1/reference/tools/data-migration/dm-upgrade.md b/v2.1/reference/tools/data-migration/dm-upgrade.md index 14580b8ec21a..e4057a343592 100644 --- a/v2.1/reference/tools/data-migration/dm-upgrade.md +++ b/v2.1/reference/tools/data-migration/dm-upgrade.md @@ -46,31 +46,31 @@ Go Version: go version go1.11.2 linux/amd64 - 移除所有 `dm_worker_status_port` 配置项,根据需要变更 `dm_worker_port` 配置项。 - 移除所有 `dm_master_status_port` 配置项,根据需要变更 `dm_master_port` 配置项。 - + 如将 - + ```ini dm_worker1_1 ansible_host=172.16.10.72 server_id=101 deploy_dir=/data1/dm_worker dm_worker_port=10081 dm_worker_status_port=10082 mysql_host=172.16.10.81 mysql_user=root mysql_password='VjX8cEeTX+qcvZ3bPaO4h0C80pe/1aU=' mysql_port=3306 ``` - + 变更为 - + ```ini dm_worker1_1 ansible_host=172.16.10.72 server_id=101 deploy_dir=/data1/dm_worker dm_worker_port=8262 mysql_host=172.16.10.81 mysql_user=root mysql_password='VjX8cEeTX+qcvZ3bPaO4h0C80pe/1aU=' mysql_port=3306 ``` - + 将 - + ```ini dm_master ansible_host=172.16.10.71 dm_master_port=12080 dm_master_status_port=12081 ``` - + 变更为 - + ```ini dm_master ansible_host=172.16.10.71 dm_master_port=8261 ``` - + 2. 使用 DM-Ansible 滚动升级 DM、Prometheus 与 Grafana。 ## 升级到 v1.0.0-133-g2f9fe82 @@ -106,7 +106,7 @@ Go Version: go version go1.11.2 linux/amd64 1. 变更 `inventory.ini` 的配置信息。 为所有 DM-worker 实例设置对应的 `source_id`。 - + 如将 ```ini @@ -122,11 +122,11 @@ Go Version: go version go1.11.2 linux/amd64 2. 使用 DM-Ansible 滚动升级 DM。 3. 变更任务配置文件 (`task.yaml`)。 - + 移除其中的 `config` 与 `instance-id` 配置项,增加 `source-id` 配置项(与 `inventory.ini` 中的 `source_id` 对应)。 - + 如将 - + ```yaml config: host: "192.168.199.118" @@ -135,9 +135,9 @@ Go Version: go version go1.11.2 linux/amd64 password: "1234" instance-id: "instance118-4306" # 此值具有唯一性,当保存 checkpoint、配置和其他信息时,作为 ID 使用。 ``` - + 变更为 - + ```yaml source-id: "instance118-4306" # 如需要重用之前任务的 checkpoint,需要与原 `instance-id` 取值一致。 ``` diff --git a/v2.1/reference/tools/data-migration/features/overview.md b/v2.1/reference/tools/data-migration/features/overview.md index 1acb1bc5a51d..83a49afed6f9 100644 --- a/v2.1/reference/tools/data-migration/features/overview.md +++ b/v2.1/reference/tools/data-migration/features/overview.md @@ -251,7 +251,6 @@ filters: | drop index | DDL | drop index event | | alter table | DDL | alter table event | - - `sql-pattern`:用于过滤指定的 DDL SQL 语句,支持正则表达式匹配,例如上面示例 `"^DROP\\s+PROCEDURE"`。 - `action`:string(`Do` / `Ignore`);进行下面规则判断,满足其中之一则过滤,否则不过滤。 @@ -388,11 +387,11 @@ column-mappings: - 如果 `table 前缀` 不为空,则表名的组成必须为 `table 前缀` 或者 `table 前缀 + 分隔符 + 数字(即 table ID)` - 如果库名/表名不包含 `… + 分隔符 + 数字` 部分,则对应的 ID 默认为 0 - 对分库分表的规模支持限制如下 - - 支持最多 16 个 MySQL/MariaDB 实例(0 <= instance ID <= 15) - - 每个实例支持最多 128 个 schema(0 <= schema ID <= 127) - - 每个实例的每个 schema 支持最多 256 个 table(0 <= table ID <= 255) - - 进行列值映射的列的范围 (0 <= ID <= 17592186044415) - - `{instance ID, schema ID, table ID}` 组合需要保持唯一 + - 支持最多 16 个 MySQL/MariaDB 实例(0 <= instance ID <= 15) + - 每个实例支持最多 128 个 schema(0 <= schema ID <= 127) + - 每个实例的每个 schema 支持最多 256 个 table(0 <= table ID <= 255) + - 进行列值映射的列的范围 (0 <= ID <= 17592186044415) + - `{instance ID, schema ID, table ID}` 组合需要保持唯一 - 目前该功能是定制功能,如果需要调整请联系相关开发人员进行调整 **`partition id` 参数配置** diff --git a/v2.1/reference/tools/data-migration/from-aurora.md b/v2.1/reference/tools/data-migration/from-aurora.md index aa43279ecb46..dc9faee3d58c 100644 --- a/v2.1/reference/tools/data-migration/from-aurora.md +++ b/v2.1/reference/tools/data-migration/from-aurora.md @@ -45,7 +45,7 @@ DM 在增量同步阶段依赖 `ROW` 格式的 binlog,如果未启用 binlog 目前推荐使用 DM-Ansible 部署 DM 集群,具体部署方法参照[使用 DM-Ansible 部署 DM 集群](/how-to/deploy/data-migration-with-ansible.md)。 > **注意:** -> +> > - 在 DM 所有的配置文件中,数据库的密码要使用 dmctl 加密后的密文。如果数据库密码为空,则不需要加密。关于如何使用 dmctl 加密明文密码,参考[使用 dmctl 加密上游 MySQL 用户密码](/how-to/deploy/data-migration-with-ansible.md#使用-dmctl-加密上游-mysql-用户密码)。 > - 上下游数据库用户必须拥有相应的读写权限。 @@ -145,10 +145,10 @@ mydumpers: # `task.yaml` 是之前编辑的配置文件 start-task ./task.yaml ``` - + - 如果执行命令后的返回结果中不包含错误信息,则表明任务已经成功启动 - 如果包含以下错误信息,则表明上游 Aurora 用户可能拥有 TiDB 不支持的权限类型 - + ```json { "id": 4, @@ -169,10 +169,11 @@ mydumpers: "extra": "address of db instance - pingcap-1.h8emfqdptyc4.us-east-2.rds.amazonaws.com" } ``` - + 此时可以选择以下两种处理方法中的任意一种进行处理后,再使用 `start-task` 尝试重新启动任务: 1. 为用于进行数据迁移的 Aurora 用户移除不被 TiDB 支持的不必要的权限 2. 如果能确保 Aurora 用户拥有 DM 所需要的权限,可以在 `task.yaml` 配置文件中添加如下顶级配置项以跳过启用任务时的前置权限检查 + ```yaml ignore-checking-items: ["dump_privilege", "replication_privilege"] ``` @@ -188,10 +189,13 @@ query-status > **注意:** > > 如果查询命令的返回结果中包含以下错误信息,则表明在全量同步的 dump 阶段不能获得相应的 lock: +> > ```bash > Couldn't acquire global lock, snapshots will not be consistent: Access denied for user 'root'@'%' (using password: YES) > ``` +> > 此时如果能接受不使用 FTWL 来确保 dump 文件与 metadata 的一致或上游能暂时停止写入,可以通过为 `mydumpers` 下的 `extra-args` 添加 `--no-locks` 参数来进行绕过,具体方法为: +> > 1. 使用 `stop-task` 停止当前由于不能正常 dump 而已经转为 paused 的任务 > 2. 将原 task.yaml 中的 `extra-args: "-B test_db -T test_table"` 更新为 `extra-args: "-B test_db -T test_table --no-locks"` > 3. 使用 `start-task` 重新启动任务 diff --git a/v2.1/reference/tools/data-migration/monitor.md b/v2.1/reference/tools/data-migration/monitor.md index e1666b4599c5..a831e6d927c0 100644 --- a/v2.1/reference/tools/data-migration/monitor.md +++ b/v2.1/reference/tools/data-migration/monitor.md @@ -14,7 +14,7 @@ category: reference ## Task -在 Grafana dashboard 中,DM 默认名称为 `DM-task`。 +在 Grafana dashboard 中,DM 默认名称为 `DM-task`。 ### overview @@ -30,7 +30,6 @@ overview 下包含运行当前选定 task 的所有 DM-worker instance 的部分 | binlog file gap between master and syncer | 与上游 master 相比 binlog replication 落后的 binlog file 个数 | N/A | | shard lock resolving | 当前子任务是否正在等待 shard DDL 同步,大于 0 表示正在等待同步 | N/A | - ### task 状态 | metric 名称 | 说明 | 告警说明 | @@ -96,7 +95,6 @@ overview 下包含运行当前选定 task 的所有 DM-worker instance 的部分 | unsynced tables | 当前子任务内还未收到 shard DDL 的分表数量 | N/A | | shard lock resolving | 当前子任务是否正在等待 shard DDL 同步,大于 0 表示正在等待同步 | N/A | - ## Instance 在 Grafana dashboard 中,instance 的默认名称为 `DM-instance`。 diff --git a/v2.1/reference/tools/data-migration/overview.md b/v2.1/reference/tools/data-migration/overview.md index 36af0c993dc5..f00b86e3a4d9 100644 --- a/v2.1/reference/tools/data-migration/overview.md +++ b/v2.1/reference/tools/data-migration/overview.md @@ -75,7 +75,7 @@ DM 支持对原分库分表进行合库合表操作,但需要满足一些[使 - 5.5 < MySQL 版本 < 5.8 - MariaDB 版本 >= 10.1.2 - + > **注意:** > > 如果上游 MySQL/MariaDB server 间构成主从复制结构,则 diff --git a/v2.1/reference/tools/data-migration/skip-replace-sqls.md b/v2.1/reference/tools/data-migration/skip-replace-sqls.md index fa41724942ac..23384e716940 100644 --- a/v2.1/reference/tools/data-migration/skip-replace-sqls.md +++ b/v2.1/reference/tools/data-migration/skip-replace-sqls.md @@ -293,7 +293,7 @@ ALTER TABLE db1.tbl1 CHANGE c2 c2 DECIMAL (10, 3); 则会由于 TiDB 不支持该 DDL 语句而导致 DM 同步任务中断且报如下错误: ```bash -exec sqls[[USE `db1`; ALTER TABLE `db1`.`tbl1` CHANGE COLUMN `c2` `c2` decimal(10,3);]] failed, +exec sqls[[USE `db1`; ALTER TABLE `db1`.`tbl1` CHANGE COLUMN `c2` `c2` decimal(10,3);]] failed, err:Error 1105: unsupported modify column length 10 is less than origin 11 ``` @@ -329,7 +329,7 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 11:17:51 operator.go:121: [info] [sql-operator] set a new operator + 2018/12/28 11:17:51 operator.go:121: [info] [sql-operator] set a new operator uuid: 6bfcf30f-2841-4d70-9a34-28d7082bdbd7, pos: (mysql-bin|000001.000003, 34642), op: SKIP, args: on replication unit ``` @@ -356,7 +356,7 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 11:27:46 operator.go:158: [info] [sql-operator] binlog-pos (mysql-bin|000001.000003, 34642) matched, + 2018/12/28 11:27:46 operator.go:158: [info] [sql-operator] binlog-pos (mysql-bin|000001.000003, 34642) matched, applying operator uuid: 6bfcf30f-2841-4d70-9a34-28d7082bdbd7, pos: (mysql-bin|000001.000003, 34642), op: SKIP, args: ``` @@ -393,7 +393,7 @@ ALTER TABLE db2.tbl2 DROP COLUMN c2; 当同步该 DDL 语句对应的 binlog event 到下游时,会由于 TiDB 不支持该 DDL 语句而导致 DM 同步任务中断且报如下错误: ```bash -exec sqls[[USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;]] failed, +exec sqls[[USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;]] failed, err:Error 1105: can't drop column c2 with index covered now ``` @@ -437,8 +437,8 @@ err:Error 1105: can't drop column c2 with index covered now 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 15:33:13 operator.go:121: [info] [sql-operator] set a new operator - uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 15:33:13 operator.go:121: [info] [sql-operator] set a new operator + uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `db2`.`tbl2` DROP INDEX idx_c2; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` on replication unit ``` @@ -448,11 +448,11 @@ err:Error 1105: can't drop column c2 with index covered now 5. 观察下游表结构是否变更成功,对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 15:33:45 operator.go:158: [info] [sql-operator] - sql-pattern ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` matched SQL - USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;, - applying operator uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, - pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 15:33:45 operator.go:158: [info] [sql-operator] + sql-pattern ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` matched SQL + USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;, + applying operator uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, + pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `db2`.`tbl2` DROP INDEX idx_c2; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` ``` @@ -551,13 +551,13 @@ err:Error 1105: can't drop column c2 with index covered now ``` **DM-master** 节点中也可以看到类似如下日志: - + ```bash - 2018/12/28 16:53:33 operator.go:105: [info] [sql-operator] set a new operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" - op:REPLACE args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + 2018/12/28 16:53:33 operator.go:105: [info] [sql-operator] set a new operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" + op:REPLACE args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" sharding:true ``` @@ -566,41 +566,41 @@ err:Error 1105: can't drop column c2 with index covered now 6. 观察下游表结构是否变更成功,对应的 DDL lock **owner** 节点中也可以看到类似如下日志: ```bash - 2018/12/28 16:54:35 operator.go:121: [info] [sql-operator] set a new operator - uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, - pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 16:54:35 operator.go:121: [info] [sql-operator] set a new operator + uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, + pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2` on replication unit ``` ```bash - 2018/12/28 16:54:35 operator.go:158: [info] [sql-operator] - sql-pattern ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL - USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`;, - applying operator uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, - pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 16:54:35 operator.go:158: [info] [sql-operator] + sql-pattern ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL + USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`;, + applying operator uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, + pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2` ``` 另外,**DM-master** 节点中也可以看到类似如下日志: ```bash - 2018/12/28 16:54:35 operator.go:122: [info] [sql-operator] get an operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE - args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" - sharding:true - with key ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL + 2018/12/28 16:54:35 operator.go:122: [info] [sql-operator] get an operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE + args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + sharding:true + with key ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`; ``` ```bash - 2018/12/28 16:54:36 operator.go:145: [info] [sql-operator] remove an operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE - args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + 2018/12/28 16:54:36 operator.go:145: [info] [sql-operator] remove an operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE + args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" sharding:true ``` diff --git a/v2.1/reference/tools/loader.md b/v2.1/reference/tools/loader.md index e514c12f68e1..aa4499d3d356 100644 --- a/v2.1/reference/tools/loader.md +++ b/v2.1/reference/tools/loader.md @@ -27,13 +27,13 @@ Loader 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/referen ## 使用方法 -#### 注意事项 +### 注意事项 请勿使用 loader 导入 MySQL 实例中 `mysql` 系统数据库到下游 TiDB。 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -47,7 +47,7 @@ Loader 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/referen -V 打印 loader 版本 -c string - 指定配置文件启动 loader + 指定配置文件启动 loader -checkpoint-schema string checkpoint 数据库名,loader 在运行过程中会不断的更新这个数据库,在中断并恢复后,会通过这个库获取上次运行的进度 (默认为 "tidb_loader") -d string @@ -112,16 +112,20 @@ port = 4000 通过命令行参数: - ./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +```bash +./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +``` 或者使用配置文件 "config.toml": - ./bin/loader -c=config.toml +```bash +./bin/loader -c=config.toml +``` + +## FAQ -## FAQ +### 合库合表场景案例说明 -#### 合库合表场景案例说明 - 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 @@ -129,7 +133,7 @@ port = 4000 Loader 需要配置文件中开启 route-rules 参数以提供合库合表功能 -+ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` ++ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` + 如果 `pattern-table` 与 `target-table` 为空,将不进行表名称合并或转换 ```toml diff --git a/v2.1/reference/tools/mydumper.md b/v2.1/reference/tools/mydumper.md index 0ec84ba6852a..5f413a2be20f 100644 --- a/v2.1/reference/tools/mydumper.md +++ b/v2.1/reference/tools/mydumper.md @@ -15,7 +15,7 @@ mydumper 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/refer ## 相比于普通的 mydumper,此工具有哪些改进之处? + 使用 `tidb_snapshot` 而非 `FLUSH TABLES WITH READ LOCK` 提供备份一致性 -+ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ++ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ### 新添参数 diff --git a/v2.1/reference/tools/sync-diff-inspector.md b/v2.1/reference/tools/sync-diff-inspector.md index 1de055404160..67ba558b9f49 100644 --- a/v2.1/reference/tools/sync-diff-inspector.md +++ b/v2.1/reference/tools/sync-diff-inspector.md @@ -162,12 +162,11 @@ password = "" # 库的名称 schema = "test" -# table list which need check in target database. +# table list which need check in target database. # in sharding mode, you must set config for every table in table-config, otherwise will not check the table. # 需要检查的表的名称 tables = ["test"] - # 配置该表对应的分表的相关配置 [[table-config]] # 目标库的名称 diff --git a/v2.1/reference/tools/syncer.md b/v2.1/reference/tools/syncer.md index 7affc35bb504..7f08e860f17a 100644 --- a/v2.1/reference/tools/syncer.md +++ b/v2.1/reference/tools/syncer.md @@ -352,7 +352,7 @@ target-table = "order_2017" - 5.5 < MySQL 版本 < 5.8 - MariaDB 版本 >= 10.1.2(更早版本的 binlog 部分字段类型格式与 MySQL 不一致) - + > **注意:** > > 如果上游 MySQL/MariaDB server 间构成主从复制结构,则 @@ -459,11 +459,11 @@ target-table = "order_2017" +---------------+-----------------------------------------------------------------------------------+ 1 row in set (0.01 sec) ``` + 6. 检查字符集。 TiDB 和 MySQL 的字符集的兼容性不同,详见 [TiDB 支持的字符集](/reference/sql/character-set.md)。 - ## 监控方案 Syncer 使用开源时序数据库 Prometheus 作为监控和性能指标信息存储方案,使用 Grafana 作为可视化组件进行展示,配合 AlertManager 来实现报警。其方案如下图所示: @@ -498,7 +498,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 #### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: http://localhost:3000 ,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin,密码: admin) + 导入 dashboard 配置文件 @@ -546,7 +546,6 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_binlog_file{node="syncer"}` and `syncer_binlog_file{node="master"}` - info: 需要配置 `position of binlog position` 一起看。`syncer_binlog_file{node="master"}` 表示上游 MySQL 当前 binlog position 的文件编号,`syncer_binlog_file{node="syncer"}` 表示上游 Syncer 已经同步到的 binlog 位置的文件编号 - #### title: execution jobs - metrics: `sum(rate(syncer_add_jobs_total[1m])) by (queueNo)` diff --git a/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md b/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md index 9f4c27cbcce7..cabf7a59560c 100644 --- a/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md +++ b/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md @@ -128,7 +128,7 @@ cd tidb-binlog-kafka-linux-amd64 - `broker.id`:用来标识 Kafka 集群的必备参数,不能重复,如 `broker.id = 1` - `fs.file-max = 1000000`:Kafka 会使用大量文件和网络 socket,建议修改成 1000000,通过 `vi /etc/sysctl.conf` 进行修改 - 修改以下配置为1G, 否则很容易出现事务修改数据较多导致单个消息过大写 kafka 失败 - + * `message.max.bytes=1073741824` * `replica.fetch.max.bytes=1073741824` * `fetch.message.max.bytes=1073741824` diff --git a/v2.1/reference/tools/tidb-binlog/tidb-binlog-local.md b/v2.1/reference/tools/tidb-binlog/tidb-binlog-local.md index d3d0b71beb79..b51c4cb77590 100644 --- a/v2.1/reference/tools/tidb-binlog/tidb-binlog-local.md +++ b/v2.1/reference/tools/tidb-binlog/tidb-binlog-local.md @@ -36,26 +36,25 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 注意 -* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 -* 手动部署时, 启动顺序为: Pump > TiDB,停止顺序为 TiDB > Pump - +* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 +* 手动部署时, 启动顺序为: Pump > TiDB,停止顺序为 TiDB > Pump 我们设置 TiDB 启动参数 binlog-socket 为对应的 Pump 的参数 socket 所指定的 unix socket 文件路径,最终部署结构如下图所示: ![TiDB pump 模块部署结构](/media/tidb-pump-deployment.png) -* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 +* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 -* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步。 +* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步。 为了保证数据的完整性,在 pump 运行 10 分钟左右后按顺序进行下面的操作 - * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` - * 全量备份,例如 mydumper 备份 tidb - * 全量导入备份到目标系统 - * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` + * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` + * 全量备份,例如 mydumper 备份 tidb + * 全量导入备份到目标系统 + * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` -* drainer 输出的 pb, 需要在配置文件设置下面的参数 +* drainer 输出的 pb, 需要在配置文件设置下面的参数 ```toml [syncer] @@ -68,14 +67,14 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 使用 TiDB Ansible 部署 Pump (推荐) -* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer +* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook deploy.yml * 执行 ansible-playbook start.yml * drainer 目前需要手动部署 -* 对已有的 TiDB Cluster 部署 binlog +* 对已有的 TiDB Cluster 部署 binlog * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook rolling_update.yml --tags=tidb @@ -146,7 +145,7 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 使用 Binary 部署 Drainer -1. Drainer 命令行参数说明 +1. Drainer 命令行参数说明 ``` Usage of drainer: @@ -274,10 +273,10 @@ drainer 启动时可以设置 `--metrics-addr` 和 `--metrics-interval` 两个 ### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 ( 注: Type 选 Prometheus,Url 为 Prometheus 地址,根据实际情况 添加/填写 ) -+ 导入 dashboard 配置文件 ++ 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 [dashboard 配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source diff --git a/v2.1/reference/tools/tidb-lightning/deployment.md b/v2.1/reference/tools/tidb-lightning/deployment.md index b21e6ce6f569..5d507bb1c2c8 100644 --- a/v2.1/reference/tools/tidb-lightning/deployment.md +++ b/v2.1/reference/tools/tidb-lightning/deployment.md @@ -204,7 +204,7 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche # 第 6 层的算法用于压缩 SST 文件。 # 第 1 至 5 层的算法目前忽略。 compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] - + [rocksdb.writecf] # (同上) compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] diff --git a/v2.1/reference/tools/tidb-lightning/monitor.md b/v2.1/reference/tools/tidb-lightning/monitor.md index ede9aaef8731..4bd2caa2709a 100644 --- a/v2.1/reference/tools/tidb-lightning/monitor.md +++ b/v2.1/reference/tools/tidb-lightning/monitor.md @@ -91,15 +91,15 @@ scrape_configs: - **`tikv_import_sst_delivery_duration`** (直方图) 将 SST 文件从 `dispatch-job` 任务发送到 `ImportSSTJob`任务需时的直方图 - + - **`tikv_import_sst_recv_duration`** (直方图) `ImportSSTJob`任务接收从 `dispatch-job` 任务发送过来的 SST 文件需时的直方图。 - + - **`tikv_import_sst_upload_duration`** (直方图) 从 `ImportSSTJob` 任务上传 SST 文件到 TiKV 节点需时的直方图。 - + - **`tikv_import_sst_chunk_bytes`** (直方图) 上传到 TiKV 节点的 SST 文件(压缩)大小的直方图。 @@ -181,7 +181,7 @@ scrape_configs: - **`lightning_row_kv_deliver_seconds`**(直方图) 发送一组与单行 SQL 数据对应的 KV 对需时的直方图。 - + - **`lightning_block_deliver_seconds`**(直方图) 每个 KV 对中的区块传送到 `tikv-importer` 需时的直方图。 diff --git a/v2.1/reference/tools/tikv-control.md b/v2.1/reference/tools/tikv-control.md index 3783bb090f2b..54a41c0b6efa 100644 --- a/v2.1/reference/tools/tikv-control.md +++ b/v2.1/reference/tools/tikv-control.md @@ -260,7 +260,6 @@ success! > - `-p` 选项指定 PD 的 endpoint,不使用 `http` 前缀,用于查询指定的 `region_id` 是否有效。 > - 对于指定 Region 的 peers 所在的每个 store,均须执行该命令。 - ### Ldb 命令 ldb 命令行工具提供多种数据访问以及数据库管理命令。下方列出了一些示例用法。详细信息请在运行 `tikv-ctl ldb` 命令时查看帮助消息或查阅 RocksDB 文档。 @@ -282,4 +281,3 @@ $ tikv-ctl ldb --hex manifest_dump --path=/tmp/db/MANIFEST-000001 您可以通过 `--column_family=` 指定查询的目标列族。 通过 `--try_load_options` 命令加载数据库选项文件以打开数据库。在数据库运行时,建议您保持该命令为开启的状态。如果您使用默认配置打开数据库,LSM-tree 存储组织可能会出现混乱,且无法自动恢复。 - diff --git a/v2.1/releases/2.0.10.md b/v2.1/releases/2.0.10.md index 3cb3859504fa..ccd23298b50d 100644 --- a/v2.1/releases/2.0.10.md +++ b/v2.1/releases/2.0.10.md @@ -23,7 +23,7 @@ category: Releases - 修复统计信息某些情况下对点查估算的问题 [#8493](https://github.com/pingcap/tidb/pull/8493) - 修复某些情况下返回 Enum 默认值为字符串导致的 panic [#8476](https://github.com/pingcap/tidb/pull/8476) - 修复在宽表场景下,占用太多内存的问题 [#8467](https://github.com/pingcap/tidb/pull/8467) -- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) +- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) - 修复某些情况下添加外键约束导致的 panic 问题 [#8421](https://github.com/pingcap/tidb/pull/8421),[#8410](https://github.com/pingcap/tidb/pull/8410) - 修复 `YEAR` 类型错误转换零值的问题 [#8396](https://github.com/pingcap/tidb/pull/8396) - 修复 `VALUES` 函数在参数不为列的时候 panic 的问题 [#8404](https://github.com/pingcap/tidb/pull/8404) diff --git a/v2.1/releases/2.1.11.md b/v2.1/releases/2.1.11.md index 3b222036fdfd..46abfc3b9d69 100644 --- a/v2.1/releases/2.1.11.md +++ b/v2.1/releases/2.1.11.md @@ -40,7 +40,6 @@ TiDB Ansible 版本:2.1.11 - TiDB Binlog - 新增 GC 删数据限速功能,避免因为删除数据导致 QPS 降低的问题 [#620](https://github.com/pingcap/tidb-binlog/pull/620) - ## TiDB Ansible - 新增 Drainer 参数 [#760](https://github.com/pingcap/tidb-ansible/pull/760) diff --git a/v2.1/releases/2.1.3.md b/v2.1/releases/2.1.3.md index 241281b2c328..2c6baab096f0 100644 --- a/v2.1/releases/2.1.3.md +++ b/v2.1/releases/2.1.3.md @@ -55,4 +55,3 @@ category: Releases - 修复在启动或者重启时 `no available pump` 的问题 [#157](https://github.com/pingcap/tidb-tools/pull/158) - 开启 Pump client log 输出 [#165](https://github.com/pingcap/tidb-tools/pull/165) - 修复表只有 unique key 没有 primary key 的情况下,unique key 包含 NULL 值导致数据更新不一致的问题 - diff --git a/v2.1/releases/2.1.8.md b/v2.1/releases/2.1.8.md index 2689765444ca..40ad9491711c 100644 --- a/v2.1/releases/2.1.8.md +++ b/v2.1/releases/2.1.8.md @@ -28,7 +28,7 @@ TiDB-Ansible 版本:2.1.8 - 统一日志格式规范,利于工具收集分析 [日志规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md) - 修复大量 NULL 值导致统计信息估算不准确的问题 [#9979](https://github.com/pingcap/tidb/pull/9979) - 修复 TIMESTAMP 类型默认值为边界值的时候报错的问题 [#9987](https://github.com/pingcap/tidb/pull/9987) -- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) +- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) - 支持时间格式 `2019.01.01` [#10001](https://github.com/pingcap/tidb/pull/10001) - 修复某些情况下 `EXPLAIN` 结果中行数估计错误显示的问题 [#10044](https://github.com/pingcap/tidb/pull/10044) - 修复 `KILL TIDB [session id]` 某些情况下无法快速停止语句执行的问题 [#9976](https://github.com/pingcap/tidb/pull/9976) @@ -45,7 +45,7 @@ TiDB-Ansible 版本:2.1.8 ## TiKV - 修复读流量统计错误的问题 [#4441](https://github.com/tikv/tikv/pull/4441) -- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) +- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) - 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) ## Tools diff --git a/v2.1/releases/2.1ga.md b/v2.1/releases/2.1ga.md index 843c83bf6c4c..d58d54f26795 100644 --- a/v2.1/releases/2.1ga.md +++ b/v2.1/releases/2.1ga.md @@ -22,7 +22,7 @@ category: Releases - 优化 `EXPLAIN` 语句输出格式, 使用层级结构表示算子之间的上下游关系 + SQL 执行引擎 - + - 重构所有聚合函数,提升 `Stream` 和 `Hash` 聚合算子的执行效率 - 实现并行 `Hash Aggregate` 算子,部分场景下有 350% 的性能提升 - 实现并行 `Project` 算子,部分场景有 74% 的性能提升 @@ -46,7 +46,7 @@ category: Releases + 支持内建函数: - - `json_contains` + - `json_contains` - `json_contains_path` - `encode/decode` @@ -113,7 +113,7 @@ category: Releases - 新增 `GCSafePoint` 接口,用于支持 TiDB 并发分布式 GC - 新增 `GetAllStores` 接口,用于支持 TiDB 并发分布式 GC + pd-ctl 新增: - + - 使用统计信息进行 Region split - 调用 `jq` 来格式化 JSON 输出 - 查询指定 store 的 Region 信息 diff --git a/v2.1/releases/21rc4.md b/v2.1/releases/21rc4.md index dacd70ff1b3f..6a46324f7c82 100644 --- a/v2.1/releases/21rc4.md +++ b/v2.1/releases/21rc4.md @@ -10,33 +10,33 @@ category: Releases ## TiDB + SQL 优化器 - - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) - - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) + - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + SQL 执行引擎 - - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) - - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) - - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) - - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) - - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) + - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) + - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) + - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) + - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + 统计信息 - - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) - - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) - - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) - - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) - - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) + - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) + - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) + - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) + - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + Server - - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) - - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) - - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) - - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) + - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) + - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) + - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + 兼容性 - - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + 表达式 - 修复 `SYSDATE` 函数被常量折叠的问题 [#7895](https://github.com/pingcap/tidb/pull/7895) - - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + DDL - - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) - - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) + - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) + - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) ## PD diff --git a/v2.1/releases/3.0.0-beta.1.md b/v2.1/releases/3.0.0-beta.1.md index 96a971c6b60d..682605c6c954 100644 --- a/v2.1/releases/3.0.0-beta.1.md +++ b/v2.1/releases/3.0.0-beta.1.md @@ -65,31 +65,31 @@ TiDB-Ansible 版本:3.0.0-beta.1 ## PD -- 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 ++ 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 + 模拟器 - - 支持不同 store 可采用不同的心跳间隔时间 [#1418](https://github.com/pingcap/pd/pull/1418) - - 添加导入数据的场景 [#1263](https://github.com/pingcap/pd/pull/1263) -- 热点调度可配置化 [#1412](https://github.com/pingcap/pd/pull/1412) -- 增加 store 地址为维度的监控项,代替原有的 Store ID [#1429](https://github.com/pingcap/pd/pull/1429) -- 优化 `GetStores` 开销,加快 Region 巡检周期 [#1410](https://github.com/pingcap/pd/pull/1410) -- 新增删除 Tombstone Store 的接口 [#1472](https://github.com/pingcap/pd/pull/1472) - + - 支持不同 store 可采用不同的心跳间隔时间 [#1418](https://github.com/pingcap/pd/pull/1418) + - 添加导入数据的场景 [#1263](https://github.com/pingcap/pd/pull/1263) ++ 热点调度可配置化 [#1412](https://github.com/pingcap/pd/pull/1412) ++ 增加 store 地址为维度的监控项,代替原有的 Store ID [#1429](https://github.com/pingcap/pd/pull/1429) ++ 优化 `GetStores` 开销,加快 Region 巡检周期 [#1410](https://github.com/pingcap/pd/pull/1410) ++ 新增删除 Tombstone Store 的接口 [#1472](https://github.com/pingcap/pd/pull/1472) + ## TiKV + 优化 Coprocessor 计算执行框架,完成 TableScan 算子,单 TableScan 即扫表操作性能提升 5% ~ 30% -实现行 `BatchRows` 和列 `BatchColumn` 的定义 [#3660](https://github.com/tikv/tikv/pull/3660) ++ 实现行 `BatchRows` 和列 `BatchColumn` 的定义 [#3660](https://github.com/tikv/tikv/pull/3660) - 实现 `VectorLike` 使得编码和解码的数据能够用统一的方式访问 [#4242](https://github.com/tikv/tikv/pull/4242) - 定义 `BatchExecutor` 接口,实现将请求转化为 `BatchExecutor` 的方法 [#4243](https://github.com/tikv/tikv/pull/4243) - 实现将表达式树转化成 RPN 格式 [#4329](https://github.com/tikv/tikv/pull/4329) - TableScan 算子实现为 Batch 方式,通过向量化计算加速计算 [#4351](https://github.com/tikv/tikv/pull/4351) -- 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 -- 支持 Raw Read 接口使用 Local Reader 进行读 [#4222](https://github.com/tikv/tikv/pull/4222) -- 新增配置信息的 Metrics [#4206](https://github.com/tikv/tikv/pull/4206) -- 新增 Key 越界的 Metrics [#4255](https://github.com/tikv/tikv/pull/4255) -- 新增碰到扫越界错误时 Panic 或者报错选项 [#4254](https://github.com/tikv/tikv/pull/4254) -- 增加 Insert 语义,只有在 Key 不存在的时候 Prewrite 才成功,消除 Batch Get [#4085](https://github.com/tikv/tikv/pull/4085) -- Batch System 使用更加公平的 batch 策略 [#4200](https://github.com/tikv/tikv/pull/4200) -- tikv-ctl 支持 Raw scan [#3825](https://github.com/tikv/tikv/pull/3825) ++ 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 ++ 支持 Raw Read 接口使用 Local Reader 进行读 [#4222](https://github.com/tikv/tikv/pull/4222) ++ 新增配置信息的 Metrics [#4206](https://github.com/tikv/tikv/pull/4206) ++ 新增 Key 越界的 Metrics [#4255](https://github.com/tikv/tikv/pull/4255) ++ 新增碰到扫越界错误时 Panic 或者报错选项 [#4254](https://github.com/tikv/tikv/pull/4254) ++ 增加 Insert 语义,只有在 Key 不存在的时候 Prewrite 才成功,消除 Batch Get [#4085](https://github.com/tikv/tikv/pull/4085) ++ Batch System 使用更加公平的 batch 策略 [#4200](https://github.com/tikv/tikv/pull/4200) ++ tikv-ctl 支持 Raw scan [#3825](https://github.com/tikv/tikv/pull/3825) ## Tools @@ -101,8 +101,8 @@ TiDB-Ansible 版本:3.0.0-beta.1 - 支持禁用 TiKV periodic Level-1 compaction,当 TiKV 集群为 2.1.4 或更高时,在导入模式下会自动执行 Level-1 compaction [#119](https://github.com/pingcap/tidb-lightning/pull/119),[#4199](https://github.com/tikv/tikv/pull/4199) - 根据 `table_concurrency` 配置项限制 import engines 数量,默认值:16,防止过多占用 importer 磁盘空间 [#119](https://github.com/pingcap/tidb-lightning/pull/119) - 支持保存中间状态的 SST 到磁盘,减少内存使用 [#4369](https://github.com/tikv/tikv/pull/4369) - - 优化 TiKV-Importer 导入性能,支持将大表的数据和索引分离导入 [#132](https://github.com/pingcap/tidb-lightning/pull/132) - - 支持 CSV 文件导入 [#111](https://github.com/pingcap/tidb-lightning/pull/111) + - 优化 TiKV-Importer 导入性能,支持将大表的数据和索引分离导入 [#132](https://github.com/pingcap/tidb-lightning/pull/132) + - 支持 CSV 文件导入 [#111](https://github.com/pingcap/tidb-lightning/pull/111) + 数据同步对比工具 (sync-diff-inspector) - 支持使用 TiDB 统计信息来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) - - 支持使用多个 column 来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) \ No newline at end of file + - 支持使用多个 column 来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) diff --git a/v2.1/releases/3.0.0-rc.2.md b/v2.1/releases/3.0.0-rc.2.md index 0f87853a472b..930f646c735c 100644 --- a/v2.1/releases/3.0.0-rc.2.md +++ b/v2.1/releases/3.0.0-rc.2.md @@ -56,17 +56,17 @@ TiDB Ansible 版本:3.0.0-rc.2 - 修复某些情况下对含有 partition 的 table 添加索引时引发 TiDB panic 的问题 [#10475](https://github.com/pingcap/tidb/pull/10475) - 添加对某些极端情况下导致 schema 出错的防护功能 [#10464](https://github.com/pingcap/tidb/pull/10464) - 创建 range partition 若有单列或者创建 hash partition 时默认开启分区功能 [#9936](https://github.com/pingcap/tidb/pull/9936) - + ## PD - 默认开启 Region storage 将 Region 元信息存储到 Region storage 中 [#1524](https://github.com/pingcap/pd/pull/1524) - 修复热点调度受其他调度器抢占的问题 [#1522](https://github.com/pingcap/pd/pull/1522) - 修复 Leader 优先级不生效的问题 [#1533](https://github.com/pingcap/pd/pull/1533) - 新增 `ScanRegions` 的 gRPC 接口 [#1535](https://github.com/pingcap/pd/pull/1535) -- 主动下发 operator 加快调度速度 [#1536](https://github.com/pingcap/pd/pull/1536) +- 主动下发 operator 加快调度速度 [#1536](https://github.com/pingcap/pd/pull/1536) - 添加 store limit 机制,限制单个 store 的调度速度 [#1474](https://github.com/pingcap/pd/pull/1474) - 修复 `config` 状态不一致的问题 [#1476](https://github.com/pingcap/pd/pull/1476) - + ## TiKV + Engine @@ -95,7 +95,7 @@ TiDB Ansible 版本:3.0.0-rc.2 - `IsFalse` [#4720](https://github.com/tikv/tikv/pull/4720) - 支持 `Int` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Decimal` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - - 支持 `String` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) + - 支持 `String` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Time` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Duration` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Json` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) diff --git a/v2.1/releases/rc3.md b/v2.1/releases/rc3.md index 6b57c34fdd89..8e7f92da528f 100644 --- a/v2.1/releases/rc3.md +++ b/v2.1/releases/rc3.md @@ -41,7 +41,7 @@ category: Releases - 通过 Key 获取 Region 信息 - 添加、删除 scheduler 和 operator - 获取集群 label 信息 - + ## TiKV + 支持 Async Apply 提升整体写入性能 diff --git a/v2.1/releases/rc4.md b/v2.1/releases/rc4.md index f2b42b956fa7..49aad74892c0 100644 --- a/v2.1/releases/rc4.md +++ b/v2.1/releases/rc4.md @@ -8,7 +8,7 @@ category: Releases 2017 年 8 月 4 日,TiDB 正式发布 RC4 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。性能方面重点优化了写入速度,计算任务调度支持优先级,避免分析型大事务影响在线事务。SQL 优化器全新改版,查询代价估算更加准确,且能够自动选择 Join 物理算子。功能方面进一步 MySQL 兼容性。 同时为了更好的支持 OLAP 业务,开源了 TiSpark 项目,可以通过 Spark 读取和分析 TiKV 中的数据。 -## TiDB: +## TiDB + SQL 查询优化器重构 - 更好的支持 TopN 查询 @@ -22,7 +22,7 @@ category: Releases + 支持 Json 类型及其操作 + 支持查询优先级、隔离级别的设置 -## PD: +## PD + 支持通过 PD 设置 TiKV location labels + 调度优化 @@ -31,7 +31,7 @@ category: Releases - 优化 balance 算法 + 优化数据加载,加快 failover 速度 -## TiKV: +## TiKV + 支持查询优先级设置 + 支持 RC 隔离级别 @@ -40,9 +40,9 @@ category: Releases + Coprocessor 支持更多下推函数 + 提升性能,提升稳定性 -## TiSpark Beta Release: - +## TiSpark Beta Release + + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 -+ 通过 TPC-H 测试 (除去一个需要 View 的 Query) \ No newline at end of file ++ 通过 TPC-H 测试(除去一个需要 View 的 Query) diff --git a/v3.0/benchmark/sysbench-v2.md b/v3.0/benchmark/sysbench-v2.md index a2a264c7b760..2f61be4f68a6 100644 --- a/v3.0/benchmark/sysbench-v2.md +++ b/v3.0/benchmark/sysbench-v2.md @@ -27,7 +27,7 @@ IDC 机器 | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD * 1 | +| DISK | Optane 500GB SSD * 1 | ## 测试方案 @@ -56,15 +56,15 @@ IDC 机器 ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 ``` * v2.0.0-rc6 - ``` + ``` sync-log = false grpc-concurrency = 8 - grpc-raft-conn-num = 24 + grpc-raft-conn-num = 24 use-delete-range: false ``` @@ -84,7 +84,7 @@ IDC 机器 ## 测试结果 -### 标准 Select 测试 +### 标准 Select 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | @@ -99,7 +99,7 @@ IDC 机器 GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 -### 标准 OLTP 测试 +### 标准 OLTP 测试 | 版本 | table count | table size | sysbench threads | tps | qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | :---:| @@ -114,7 +114,7 @@ GA2.0 比 GA1.0 在 Select 查询性能上,最高提升了 10% 左右。 GA2.0 比 GA1.0 在 OLTP 性能上,性能基本一致。 -### 标准 Insert 测试 +### 标准 Insert 测试 | 版本 | table count | table size | sysbench threads |qps | latency(avg / .95) | | :---: | :---: | :---: | :---: | :---: | :---: | diff --git a/v3.0/benchmark/sysbench-v3.md b/v3.0/benchmark/sysbench-v3.md index 86b9a7075d32..1c8cff61684a 100644 --- a/v3.0/benchmark/sysbench-v3.md +++ b/v3.0/benchmark/sysbench-v3.md @@ -27,7 +27,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | Optane 500GB SSD \* 1 | +| DISK | Optane 500GB SSD \* 1 | Sysbench 版本:1.1.0 @@ -140,4 +140,4 @@ v2.1 与 v2.0 在 Update Non-Index 写入性能上基本一致。 ![update index](/media/sysbench_v3_update_index.png) -v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 \ No newline at end of file +v2.1 与 v2.0 在 Update Index 写入性能上基本一致。 diff --git a/v3.0/benchmark/sysbench.md b/v3.0/benchmark/sysbench.md index 8d934906677a..c50b14c1d63a 100644 --- a/v3.0/benchmark/sysbench.md +++ b/v3.0/benchmark/sysbench.md @@ -17,7 +17,7 @@ aliases: ['/docs-cn/benchmark/sysbench/'] ## 测试版本、时间、地点 -TiDB 版本:v1.0.0 +TiDB 版本:v1.0.0 时间:2017 年 10 月 20 日 地点:北京 @@ -30,11 +30,11 @@ IDC 机器 | OS | linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5T SSD * 2 + Optane SSD * 1 | +| DISK | 1.5T SSD \* 2 + Optane SSD \* 1 | Sysbench 版本: 1.0.6 -测试脚本: https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench +测试脚本: ## 测试方案 @@ -42,7 +42,7 @@ Sysbench 版本: 1.0.6 测试表结构 -``` +``` CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned NOT NULL DEFAULT '0', @@ -50,17 +50,17 @@ CREATE TABLE `sbtest` ( `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) -) ENGINE=InnoDB +) ENGINE=InnoDB ``` 部署方案以及配置参数 -``` +``` // TiDB 部署方案 172.16.20.4 4*tikv 1*tidb 1*sysbench 172.16.20.6 4*tikv 1*tidb 1*sysbench 172.16.20.7 4*tikv 1*tidb 1*sysbench -172.16.10.8 1*tidb 1*pd 1*sysbench +172.16.10.8 1*tidb 1*pd 1*sysbench // 每个物理节点有三块盘: data3: 2 tikv (Optane SSD) @@ -90,8 +90,8 @@ Mysql version: 5.6.37 thread_cache_size = 64 innodb_buffer_pool_size = 64G innodb_file_per_table = 1 -innodb_flush_log_at_trx_commit = 0 -datadir = /data3/mysql +innodb_flush_log_at_trx_commit = 0 +datadir = /data3/mysql max_connections = 2000 ``` @@ -110,9 +110,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 1902 | 38045 | 134.56 ms / 363.18 ms | | Mysql | 32 | 1000 万 | 256 | 1770 | 35416 | 144.55 ms / 383.33 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) +![threads_oltp](http://7xnp02.com1.z0.glb.clouddn.com/threads_oltp.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) +![table_size_oltp](http://7xnp02.com1.z0.glb.clouddn.com/table_size_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -129,9 +129,9 @@ max_connections = 2000 | Mysql | 32 | 500 万 | 256 | 386866 | 0.66 ms / 1.64 ms | | Mysql | 32 | 1000 万 | 256 | 388273 | 0.66 ms / 1.64 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) +![threads_select](http://7xnp02.com1.z0.glb.clouddn.com/threads_select.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) +![table_size_select](http://7xnp02.com1.z0.glb.clouddn.com/table_size_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -147,11 +147,10 @@ max_connections = 2000 | Mysql | 32 | 100 万 | 256 | 14508 | 17.64 ms / 44.98 ms | | Mysql | 32 | 500 万 | 256 | 10593 | 24.16 ms / 82.96 ms | | Mysql | 32 | 1000 万 | 256 | 9813 | 26.08 ms / 94.10 ms | - -![](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) -![](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) +![threads_insert](http://7xnp02.com1.z0.glb.clouddn.com/threads_insert.png?imageView2/2/w/700/q/75|imageslim) +![table_size_insert](http://7xnp02.com1.z0.glb.clouddn.com/table_size_insert.png?imageView2/2/w/700/q/75|imageslim) ### 场景二:TiDB 水平扩展能力测试 @@ -188,7 +187,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 8984 | 179692 | 114.96 ms / 176.73 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 12953 | 259072 | 117.80 ms / 200.47 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_oltp](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_oltp.png?imageView2/2/w/700/q/75|imageslim) * 标准 select 测试 @@ -199,7 +198,7 @@ block-cache-size = "2GB" | 4 物理节点 TiDB | 32 | 100 万 | 256 * 4 | 289933 | 3.53 ms / 8.74 ms | | 6 物理节点 TiDB | 32 | 500 万 | 256 * 6 | 435313 | 3.55 ms / 9.17 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) +![scale_tidb_select](http://7xnp02.com1.z0.glb.clouddn.com/scale_tidb_select.png?imageView2/2/w/700/q/75|imageslim) * 标准 insert 测试 @@ -209,4 +208,4 @@ block-cache-size = "2GB" | 5 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 60689 | 37.96 ms / 29.9 ms | | 7 物理节点 TiKV | 32 | 100 万 | 256 * 3 | 80087 | 9.62 ms / 21.37 ms | -![](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) +![scale_tikv_insert](http://7xnp02.com1.z0.glb.clouddn.com/scale_tikv_insert.png?imageView2/2/w/700/q/75|imageslim) diff --git a/v3.0/benchmark/tpcc.md b/v3.0/benchmark/tpcc.md index e8dc0a3ee658..569144c2b6b3 100644 --- a/v3.0/benchmark/tpcc.md +++ b/v3.0/benchmark/tpcc.md @@ -26,7 +26,7 @@ IDC 机器: | OS | Linux (CentOS 7.3.1611) | | CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz | | RAM | 128GB | -| DISK | 1.5TB SSD \* 2 | +| DISK | 1.5TB SSD \* 2 | 本文使用开源的 BenchmarkSQL 5.0 作为 TPC-C 测试工具并添加对 MySQL 协议支持, 可以通过以下命令下载测试程序: diff --git a/v3.0/faq/tidb-in-kubernetes.md b/v3.0/faq/tidb-in-kubernetes.md index fd37aeeb0088..4b2e8b7a1eed 100644 --- a/v3.0/faq/tidb-in-kubernetes.md +++ b/v3.0/faq/tidb-in-kubernetes.md @@ -14,10 +14,10 @@ category: FAQ * 第一次部署集群 在 TiDB 集群的 `values.yaml` 文件中,修改 `timezone` 配置,例如:`timezone: Asia/Shanghai`,然后部署 TiDB 集群。 - + * 集群已经在运行 如果 TiDB 集群已经在运行,需要做如下修改: - + * 在 TiDB 集群的 `values.yaml` 文件中,修改 `timezone` 配置,例如:`timezone: Asia/Shanghai`,然后升级 TiDB 集群。 * 参考[时区支持](/how-to/configure/time-zone.md),修改 TiDB 服务时区配置。 diff --git a/v3.0/how-to/deploy/data-migration-with-ansible.md b/v3.0/how-to/deploy/data-migration-with-ansible.md index 09445c1e60ef..b912ea6d0e6e 100644 --- a/v3.0/how-to/deploy/data-migration-with-ansible.md +++ b/v3.0/how-to/deploy/data-migration-with-ansible.md @@ -166,7 +166,7 @@ DM-Ansible 是 PingCAP 基于 [Ansible](https://docs.ansible.com/ansible/latest/ ``` 2. 运行如下命令,然后输入部署目标机器的 `root` 用户密码。 - + ```bash $ ansible-playbook -i hosts.ini create_users.yml -u root -k ``` @@ -296,10 +296,10 @@ grafana_admin_user = "admin" grafana_admin_password = "admin" ``` -### DM-worker 配置及参数描述 +### DM-worker 配置及参数描述 | 变量名称 | 描述 | -| ------------- | ------- +| ------------- | ------- | source_id | DM-worker 绑定到的一个数据库实例或是具有主从架构的复制组。当发生主从切换的时候,只需要更新 `mysql_host` 或 `mysql_port` 而不用更改该 ID 标识。 | | server_id | DM-worker 伪装成一个 MySQL slave,该变量即为这个 slave 的 server ID,在 MySQL 集群中需保持全局唯一。取值范围 0 ~ 4294967295。| | mysql_host | 上游 MySQL 主机 | @@ -399,6 +399,7 @@ dm-worker2 ansible_host=172.16.10.73 source_id="mysql-replica-02" server_id=102 ```ini ansible_user = tidb ``` + > **注意:** > > 请勿将 `ansible_user` 设为 `root`,因为 `tidb-ansible` 限制服务需以普通用户运行。 @@ -426,6 +427,7 @@ dm-worker2 ansible_host=172.16.10.73 source_id="mysql-replica-02" server_id=102 ```bash ansible-playbook start.yml ``` + 此操作会按顺序启动 DM 集群的所有组件,包括 DM-master,DM-worker,以及监控组件。当一个 DM 集群被关闭后,您可以使用该命令将其开启。 ## 第 10 步:关闭 DM 集群 @@ -442,7 +444,6 @@ $ ansible-playbook stop.yml ### 默认服务端口 - | 组件 | 端口变量 | 默认端口 | 描述 | | :-- | :-- | :-- | :-- | | DM-master | `dm_master_port` | 8261 | DM-master 服务交流端口 | diff --git a/v3.0/how-to/deploy/geographic-redundancy/overview.md b/v3.0/how-to/deploy/geographic-redundancy/overview.md index 89ee4fda5c62..c830fa2f8b92 100644 --- a/v3.0/how-to/deploy/geographic-redundancy/overview.md +++ b/v3.0/how-to/deploy/geographic-redundancy/overview.md @@ -64,7 +64,6 @@ TiDB, TiKV, PD 分别分布在 3 个不同的中心,这是最常规,可用 > > 在两数据中心 + binlog 同步部署方案中,数据中心之间只有 binlog 异步复制。在数据中心间的延迟较高的情况下,从集群落后主集群的数据量会增大。当主集群故障后(DR),会造成数据丢失,丢失的数据量受网络延迟等因素影响。 - ## 高可用和容灾分析 对于三数据中心方案和两地三中心方案,我们能得到的保障是任意一个数据中心故障时,集群能自动恢复服务,不需要人工介入,并能保证数据一致性。注意各种调度策略都是用于帮助性能优化的,当发生故障时调度机制总是第一优先考虑可用性而不是性能。 diff --git a/v3.0/how-to/deploy/orchestrated/offline-ansible.md b/v3.0/how-to/deploy/orchestrated/offline-ansible.md index 8f1a238761fc..075518ad7eab 100644 --- a/v3.0/how-to/deploy/orchestrated/offline-ansible.md +++ b/v3.0/how-to/deploy/orchestrated/offline-ansible.md @@ -84,7 +84,7 @@ aliases: ['/docs-cn/op-guide/offline-ansible-deployment/'] ```bash # yum install epel-release # yum install ansible curl - # ansible --version + # ansible --version ansible 2.5.0 ``` diff --git a/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/access-tidb.md b/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/access-tidb.md index 662a30ebb2b1..9214460980d8 100644 --- a/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/access-tidb.md +++ b/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/access-tidb.md @@ -59,7 +59,7 @@ kubectl -n ${namespace} get svc ${release}-tidb -ojsonpath="{.spec.ports[?(@.nam ```shell release= ``` - + {{< copyable "shell-regular" >}} ```shell diff --git a/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/aws-eks.md b/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/aws-eks.md index 01b6fa875ac1..3568a5d84767 100644 --- a/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/aws-eks.md +++ b/v3.0/how-to/deploy/orchestrated/tidb-in-kubernetes/aws-eks.md @@ -17,24 +17,24 @@ aliases: ['/docs-cn/v3.0/how-to/deploy/orchestrated/aws-eks/'] 要与 AWS 交互,必须[配置 `awscli`](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)。最快的方式是使用 `aws configure` 命令: {{< copyable "shell-regular" >}} - + ``` shell aws configure ``` - + 替换下面的 AWS Access Key ID 和 AWS Secret Access Key: - + ``` AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default output format [None]: json ``` - + > **注意:** > > Access key 必须至少具有以下权限:创建 VPC、创建 EBS、创建 EC2 和创建 Role。 - + * [terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) * [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) >= 1.11 * [helm](https://github.com/helm/helm/blob/master/docs/install.md#installing-the-helm-client) >= 2.9.0 且 < 3.0.0 @@ -44,25 +44,25 @@ aliases: ['/docs-cn/v3.0/how-to/deploy/orchestrated/aws-eks/'] 最简单的安装方法是下载编译好的二进制文件 `aws-iam-authenticator`,如下所示。 Linux 用户下载二进制文件: - + {{< copyable "shell-regular" >}} - + ``` shell curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.12.7/2019-03-27/bin/linux/amd64/aws-iam-authenticator ``` macOS 用户下载二进制文件: - + {{< copyable "shell-regular" >}} - + ``` shell curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.12.7/2019-03-27/bin/darwin/amd64/aws-iam-authenticator ``` - + 二进制文件下载完成后,执行以下操作: - + {{< copyable "shell-regular" >}} - + ``` shell chmod +x ./aws-iam-authenticator && \ sudo mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator diff --git a/v3.0/how-to/deploy/tidb-binlog.md b/v3.0/how-to/deploy/tidb-binlog.md index d0f44388134d..9b8e2531c4a1 100644 --- a/v3.0/how-to/deploy/tidb-binlog.md +++ b/v3.0/how-to/deploy/tidb-binlog.md @@ -337,7 +337,7 @@ Drainer="192.168.0.13" ```bash ./bin/pump -config pump.toml ``` - + 如果命令行参数与配置文件中的参数重合,则使用命令行设置的参数的值。 2. 使用 binary 部署 Drainer @@ -475,7 +475,7 @@ Drainer="192.168.0.13" # topic-name = "" ``` - - 启动示例 + - 启动示例 > **注意:** > diff --git a/v3.0/how-to/get-started/deploy-tidb-from-docker-compose.md b/v3.0/how-to/get-started/deploy-tidb-from-docker-compose.md index a6b21b3aee28..667e991be1bc 100644 --- a/v3.0/how-to/get-started/deploy-tidb-from-docker-compose.md +++ b/v3.0/how-to/get-started/deploy-tidb-from-docker-compose.md @@ -60,7 +60,7 @@ aliases: ['/docs-cn/v3.0/how-to/get-started/local-cluster/install-from-docker-co ``` 如果是 Mac 系统,也可以通过 Homebrew 安装: - + ``` brew install kubernetes-helm ``` diff --git a/v3.0/how-to/get-started/deploy-tidb-from-kubernetes-dind.md b/v3.0/how-to/get-started/deploy-tidb-from-kubernetes-dind.md index 33e13dc7902e..969bf2662b6d 100644 --- a/v3.0/how-to/get-started/deploy-tidb-from-kubernetes-dind.md +++ b/v3.0/how-to/get-started/deploy-tidb-from-kubernetes-dind.md @@ -428,7 +428,7 @@ demo-tikv-2 1/1 Running 0 1m mkdir -p /home/tidb/demo && \ helm inspect values pingcap/tidb-cluster --version=${chartVersion} > /home/tidb/demo/values-demo.yaml ``` - + 2. 编辑 `/home/tidb/demo/values-demo.yaml`。 例如,要扩容集群,可以将 TiKV `replicas` 从 3 修改为 5,或者将 TiDB `replicas` 从 2 修改为 3。 diff --git a/v3.0/how-to/get-started/tidb-binlog.md b/v3.0/how-to/get-started/tidb-binlog.md index 528326fb5f14..49a3a1d5abed 100644 --- a/v3.0/how-to/get-started/tidb-binlog.md +++ b/v3.0/how-to/get-started/tidb-binlog.md @@ -61,7 +61,7 @@ sudo yum install -y mariadb-server ```bash printf > pd.toml %s\\n 'log-file="pd.log"' 'data-dir="pd.data"' - printf > tikv.toml %s\\n 'log-file="tikv.log"' '[storage]' 'data-dir="tikv.data"' '[pd]' 'endpoints=["127.0.0.1:2379"]' '[rocksdb]' max-open-files=1024 '[raftdb]' max-open-files=1024 + printf > tikv.toml %s\\n 'log-file="tikv.log"' '[storage]' 'data-dir="tikv.data"' '[pd]' 'endpoints=["127.0.0.1:2379"]' '[rocksdb]' max-open-files=1024 '[raftdb]' max-open-files=1024 printf > pump.toml %s\\n 'log-file="pump.log"' 'data-dir="pump.data"' 'addr="127.0.0.1:8250"' 'advertise-addr="127.0.0.1:8250"' 'pd-urls="http://127.0.0.1:2379"' printf > tidb.toml %s\\n 'store="tikv"' 'path="127.0.0.1:2379"' '[log.file]' 'filename="tidb.log"' '[binlog]' 'enable=true' printf > drainer.toml %s\\n 'log-file="drainer.log"' '[syncer]' 'db-type="mysql"' '[syncer.to]' 'host="127.0.0.1"' 'user="root"' 'password=""' 'port=3306' @@ -157,7 +157,6 @@ sudo yum install -y mariadb-server 如果有服务启动失败(例如出现 “`Exit 1`” 而不是 “`Running`”),尝试重启单个组件。 - ## 连接 按以上步骤操作后,TiDB 的 4 个组件开始运行。接下来可以使用以下 MariaDB 或 MySQL 命令行客户端,通过 4000 端口连接到 TiDB 服务: @@ -183,7 +182,6 @@ Check Table Before Drop: false 连接后TiDB 集群已开始运行,`pump` 读取集群中的 binlog 数据,并在其数据目录中将 binlog 数据存储为 relay log。下一步是启动一个可供 `drainer` 写入的 MariaDB Server。 - 1. 启动 `drainer`: ```bash diff --git a/v3.0/how-to/get-started/tispark.md b/v3.0/how-to/get-started/tispark.md index ebaf18bf6e35..4f951f51be32 100644 --- a/v3.0/how-to/get-started/tispark.md +++ b/v3.0/how-to/get-started/tispark.md @@ -18,7 +18,7 @@ aliases: ['/docs-cn/tispark/tispark-quick-start-guide/'] ### 在 TiDB 实例上安装 JDK -在 [Oracle JDK 官方下载页面 ](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html) 下载 JDK 1.8 当前最新版,本示例中下载的版本为 `jdk-8u141-linux-x64.tar.gz`。 +在 [Oracle JDK 官方下载页面](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html) 下载 JDK 1.8 当前最新版,本示例中下载的版本为 `jdk-8u141-linux-x64.tar.gz`。 解压并根据您的 JDK 部署目录设置环境变量, 编辑 `~/.bashrc` 文件,比如: @@ -98,8 +98,6 @@ MySQL [TPCH_001]> show tables; ## 使用范例 - - 进入 spark 部署目录启动 spark-shell: ``` @@ -173,4 +171,4 @@ scala> spark.sql( -----------------+---------+------------+--------+-----------+ ``` -更多样例请参考 https://github.com/ilovesoup/tpch/tree/master/sparksql +更多样例请参考 diff --git a/v3.0/how-to/maintain/identify-slow-queries.md b/v3.0/how-to/maintain/identify-slow-queries.md index 0c23282d98fe..17180e71a437 100644 --- a/v3.0/how-to/maintain/identify-slow-queries.md +++ b/v3.0/how-to/maintain/identify-slow-queries.md @@ -256,7 +256,7 @@ admin show slow top all 5 由于内存限制,保留的慢查询记录的条数是有限的。当命令查询的 `N` 大于记录条数时,返回的结果记录条数会小于 `N`。 输出内容详细说明,如下: - + | 列名 | 描述 | |:------|:---- | | start | SQL 语句执行开始时间 | @@ -271,4 +271,4 @@ admin show slow top all 5 | index_ids | 执行该 SQL 涉及到索引 ID | | internal | 表示为 TiDB 内部的 SQL 语句 | | digest | 表示 SQL 语句的指纹 | -| sql | 执行的 SQL 语句 | \ No newline at end of file +| sql | 执行的 SQL 语句 | diff --git a/v3.0/how-to/maintain/tidb-binlog.md b/v3.0/how-to/maintain/tidb-binlog.md index 412df57618e1..208448f266d9 100644 --- a/v3.0/how-to/maintain/tidb-binlog.md +++ b/v3.0/how-to/maintain/tidb-binlog.md @@ -99,7 +99,7 @@ Usage of binlogctl: ``` - 修改 Pump/Drainer 的状态 - + 设置 `cmd` 为 `update-pump` 或者 `update-drainer` 来更新 Pump 或者 Drainer 的状态。Pump 和 Drainer 的状态可以为:online,pausing,paused,closing 以及 offline。例如: ```bash diff --git a/v3.0/how-to/maintain/tidb-in-kubernetes/tidb-node.md b/v3.0/how-to/maintain/tidb-in-kubernetes/tidb-node.md index 2a96950d59a3..73a3048fbc2d 100644 --- a/v3.0/how-to/maintain/tidb-in-kubernetes/tidb-node.md +++ b/v3.0/how-to/maintain/tidb-in-kubernetes/tidb-node.md @@ -24,19 +24,19 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 PD 和 TiDB 实例的迁移较快,可以采取主动驱逐实例到其它节点上的策略进行节点维护: 1. 检查待维护节点上是否有 TiKV 实例: - + {{< copyable "shell-regular" >}} - + ```shell kubectl get pod --all-namespaces -o wide | grep ``` 假如存在 TiKV 实例,请参考[维护 TiKV 实例所在节点](#维护-tikv-实例所在节点)。 - + 2. 使用 `kubectl cordon` 命令防止新的 Pod 调度到待维护节点上: {{< copyable "shell-regular" >}} - + ```shell kubectl cordon ``` @@ -44,7 +44,7 @@ PD 和 TiDB 实例的迁移较快,可以采取主动驱逐实例到其它节 3. 使用 `kubectl drain` 命令将待维护节点上的数据库实例迁移到其它节点上: {{< copyable "shell-regular" >}} - + ```shell kubectl drain --ignore-daemonsets --delete-local-data ``` @@ -54,7 +54,7 @@ PD 和 TiDB 实例的迁移较快,可以采取主动驱逐实例到其它节 4. 此时,假如希望下线该 Kubernetes 节点,则可以将该节点删除: {{< copyable "shell-regular" >}} - + ```shell kubectl delete node ``` @@ -62,17 +62,17 @@ PD 和 TiDB 实例的迁移较快,可以采取主动驱逐实例到其它节 假如希望恢复 Kubernetes 节点,则需要在恢复节点后确认其健康状态: {{< copyable "shell-regular" >}} - + ```shell watch kubectl get node ``` - + 观察到节点进入 `Ready` 状态后,继续操作。 5. 使用 `kubectl uncordon` 命令解除节点的调度限制: {{< copyable "shell-regular" >}} - + ```shell kubectl uncordon ``` @@ -84,11 +84,11 @@ PD 和 TiDB 实例的迁移较快,可以采取主动驱逐实例到其它节 ```shell watch kubectl get -n $namespace pod -o wide ``` - + 或者: - + {{< copyable "shell-regular" >}} - + ```sql watch tkctl get all ``` @@ -179,17 +179,17 @@ pd-ctl -d config set max-store-down-time 10m 5. 解除 TiKV 实例与节点本地盘的绑定。 查询 Pod 使用的 `PesistentVolumeClaim`: - + {{< copyable "shell-regular" >}} - + ```shell kubectl get -n ${namespace} pod ${pod_name} -ojson | jq '.spec.volumes | .[] | select (.name == "tikv") | .persistentVolumeClaim.claimName' ``` - + 删除该 `PesistentVolumeClaim`: - + {{< copyable "shell-regular" >}} - + ```shell kubectl delete -n ${namespace} pvc ${pvc_name} ``` @@ -197,7 +197,7 @@ pd-ctl -d config set max-store-down-time 10m 6. 删除 TiKV 实例: {{< copyable "shell-regular" >}} - + ```shell kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -205,7 +205,7 @@ pd-ctl -d config set max-store-down-time 10m 7. 观察该 TiKV 实例是否正常调度到其它节点上: {{< copyable "shell-regular" >}} - + ```shell watch kubectl -n ${namespace} get pod -o wide ``` @@ -215,7 +215,7 @@ pd-ctl -d config set max-store-down-time 10m 8. 确认节点不再有 TiKV 实例后,再逐出节点上的其它实例: {{< copyable "shell-regular" >}} - + ```shell kubectl drain --ignore-daemonsets --delete-local-data ``` @@ -223,7 +223,7 @@ pd-ctl -d config set max-store-down-time 10m 9. 再次确认节点不再有任何 TiKV、TiDB 和 PD 实例运行: {{< copyable "shell-regular" >}} - + ```shell kubectl get pod --all-namespaces | grep ``` @@ -231,7 +231,7 @@ pd-ctl -d config set max-store-down-time 10m 10. 最后(可选),假如是长期下线节点,建议将节点从 Kubernetes 集群中删除: {{< copyable "shell-regular" >}} - + ```shell kuebctl delete node ``` diff --git a/v3.0/how-to/migrate/from-aurora.md b/v3.0/how-to/migrate/from-aurora.md index 9d0a60023ce3..e787f70a0f99 100644 --- a/v3.0/how-to/migrate/from-aurora.md +++ b/v3.0/how-to/migrate/from-aurora.md @@ -45,7 +45,7 @@ DM 在增量同步阶段依赖 `ROW` 格式的 binlog,如果未启用 binlog 目前推荐使用 DM-Ansible 部署 DM 集群,具体部署方法参照[使用 DM-Ansible 部署 DM 集群](/reference/tools/data-migration/deployment.md)。 > **注意:** -> +> > - 在 DM 所有的配置文件中,数据库的密码要使用 dmctl 加密后的密文。如果数据库密码为空,则不需要加密。关于如何使用 dmctl 加密明文密码,参考[使用 dmctl 加密上游 MySQL 用户密码](/reference/tools/data-migration/deployment.md#使用-dmctl-加密上游-mysql-用户密码)。 > - 上下游数据库用户必须拥有相应的读写权限。 @@ -145,10 +145,10 @@ mydumpers: # `task.yaml` 是之前编辑的配置文件 start-task ./task.yaml ``` - + - 如果执行命令后的返回结果中不包含错误信息,则表明任务已经成功启动 - 如果包含以下错误信息,则表明上游 Aurora 用户可能拥有 TiDB 不支持的权限类型 - + ```json { "id": 4, @@ -169,10 +169,11 @@ mydumpers: "extra": "address of db instance - pingcap-1.h8emfqdptyc4.us-east-2.rds.amazonaws.com" } ``` - + 此时可以选择以下两种处理方法中的任意一种进行处理后,再使用 `start-task` 尝试重新启动任务: 1. 为用于进行数据迁移的 Aurora 用户移除不被 TiDB 支持的不必要的权限 2. 如果能确保 Aurora 用户拥有 DM 所需要的权限,可以在 `task.yaml` 配置文件中添加如下顶级配置项以跳过启用任务时的前置权限检查 + ```yaml ignore-checking-items: ["dump_privilege", "replication_privilege"] ``` diff --git a/v3.0/how-to/migrate/incrementally-from-mysql.md b/v3.0/how-to/migrate/incrementally-from-mysql.md index cea320e41479..336ba5e84cd4 100644 --- a/v3.0/how-to/migrate/incrementally-from-mysql.md +++ b/v3.0/how-to/migrate/incrementally-from-mysql.md @@ -202,7 +202,6 @@ mysql> select * from t1; `syncer` 每隔 30s 会输出当前的同步统计,如下 - ```bash 2017/06/08 01:18:51 syncer.go:934: [info] [syncer]total events = 15, total tps = 130, recent tps = 4, master-binlog = (ON.000001, 11992), master-binlog-gtid=53ea0ed1-9bf8-11e6-8bea-64006a897c73:1-74, diff --git a/v3.0/how-to/scale/tidb-in-kubernetes.md b/v3.0/how-to/scale/tidb-in-kubernetes.md index 91cb4c9e86d3..7192984cdbb4 100644 --- a/v3.0/how-to/scale/tidb-in-kubernetes.md +++ b/v3.0/how-to/scale/tidb-in-kubernetes.md @@ -30,11 +30,11 @@ TiDB 水平扩缩容操作指的是通过增加或减少节点的数量,来达 ```shell watch kubectl -n ${namespace} get pod -o wide ``` - + 当所有组件的 Pod 数量都达到了预设值,并且都进入 `Running` 状态后,水平扩缩容完成。 > **注意:** -> +> > - PD、TiKV 组件在滚动升级的过程中不会触发扩缩容操作。 > - PD、TiKV 组件在缩容过程中都会调用接口下线正在删除的 PD、TiKV 组件在下线时会涉及到数据迁移的操作,所以会消耗比较长的时间。 > - PD、TiKV 组件在缩容过程中被删除的节点的 PVC 会保留,并且由于 PV 的 `Reclaim Policy` 设置为 `Retain`,即使 PVC 被删除,数据依然可以找回。 diff --git a/v3.0/how-to/scale/with-ansible.md b/v3.0/how-to/scale/with-ansible.md index db9107c04c2a..9144a7d5c124 100644 --- a/v3.0/how-to/scale/with-ansible.md +++ b/v3.0/how-to/scale/with-ansible.md @@ -118,7 +118,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 例如,如果要添加一个 PD 节点(node103),IP 地址为 172.16.10.103,可以进行如下操作: -1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: +1. 编辑 `inventory.ini` 文件,添加节点信息置于 `[pd_servers]` 主机组最后一行: ```ini [tidb_servers] @@ -185,7 +185,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 4. 登录新增的 PD 节点,编辑启动脚本:`{deploy_dir}/scripts/run_pd.sh` - 1. 移除 `--initial-cluster="xxxx" \` 配置,注意这里不能在行开头加注释符 #。 + 1. 移除 `--initial-cluster="xxxx" \` 配置,注意这里不能在行开头加注释符 #。 2. 添加 `--join="http://172.16.10.1:2379" \`,IP 地址 (172.16.10.1) 可以是集群内现有 PD IP 地址中的任意一个。 @@ -196,7 +196,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 4. 使用 `pd-ctl` 检查新节点是否添加成功: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d member ``` @@ -212,7 +212,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` ansible-playbook start.yml -l 172.16.10.103 ``` - + 7. 更新 Prometheus 配置并重启: ``` @@ -302,7 +302,7 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。以 ``` 2. 从集群中移除 node9,假如 store id 为 10: - + ``` /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://172.16.10.1:2379" -d store delete 10 ``` diff --git a/v3.0/how-to/secure/generate-self-signed-certificates.md b/v3.0/how-to/secure/generate-self-signed-certificates.md index 323e54f33370..bd253cea8592 100644 --- a/v3.0/how-to/secure/generate-self-signed-certificates.md +++ b/v3.0/how-to/secure/generate-self-signed-certificates.md @@ -46,16 +46,16 @@ cfssl print-defaults csr > ca-csr.json ## 生成证书 -#### 证书介绍 +### 证书介绍 - tidb-server certificate 由 TiDB 使用,为其他组件和客户端验证 TiDB 身份。 - tikv-server certificate 由 TiKV 使用,为其他组件和客户端验证 TiKV 身份。 - pd-server certificate 由 PD 使用,为其他组件和客户端验证 PD 身份。 - client certificate 用于通过 PD、TiKV、TiDB 验证客户端。例如 `pd-ctl`,`tikv-ctl`,`pd-recover`。 -#### 配置 CA 选项 +### 配置 CA 选项 -根据实际需求修改 `ca-config.json`: +根据实际需求修改 `ca-config.json`: ```json { @@ -86,7 +86,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -根据实际需求修改 `ca-csr.json` : +根据实际需求修改 `ca-csr.json` : ```json { @@ -106,7 +106,7 @@ cfssl print-defaults csr > ca-csr.json } ``` -#### 生成 CA 证书 +### 生成 CA 证书 ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - @@ -120,7 +120,7 @@ ca.csr ca.pem ``` -#### 生成服务器端证书 +### 生成服务器端证书 `hostname` 中为各组件的 IP 地址,以及 `127.0.0.1` @@ -140,7 +140,7 @@ tidb-server.csr tikv-server.csr pd-server.csr tidb-server.pem tikv-server.pem pd-server.pem ``` -#### 生成客户端证书 +### 生成客户端证书 ```bash echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client -hostname="" - | cfssljson -bare client @@ -152,4 +152,4 @@ echo '{"CN":"client","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gen client-key.pem client.csr client.pem -``` \ No newline at end of file +``` diff --git a/v3.0/how-to/troubleshoot/cluster-setup.md b/v3.0/how-to/troubleshoot/cluster-setup.md index 10c0830b0cd2..d311145219e3 100644 --- a/v3.0/how-to/troubleshoot/cluster-setup.md +++ b/v3.0/how-to/troubleshoot/cluster-setup.md @@ -18,28 +18,27 @@ aliases: ['/docs-cn/trouble-shooting/'] + 机器配置以及部署拓扑 + dmesg 中 TiDB 组件相关的问题 - ## 数据库连接不上 首先请确认集群的各项服务是否已经启动,包括 tidb-server、pd-server、tikv-server。请用 ps 命令查看所有进程是否在。如果某个组件的进程已经不在了,请参考对应的章节排查错误。 如果所有的进程都在,请查看 tidb-server 的日志,看是否有报错?常见的错误包括: -+ InformationSchema is out of date ++ InformationSchema is out of date 无法连接 tikv-server,请检查 pd-server 以及 tikv-server 的状态和日志。 -+ panic ++ panic 程序有错误,请将具体的 panic log [提供给 TiDB 开发者](https://github.com/pingcap/tidb/issues/new/choose)。 如果是清空数据并重新部署服务,请确认以下信息: -+ pd-server、tikv-server 数据都已清空 ++ pd-server、tikv-server 数据都已清空 tikv-server 存储具体的数据,pd-server 存储 tikv-server 中数据的的元信息。如果只清空 pd-server 或只清空 tikv-server 的数据,会导致两边数据不匹配。 -+ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server ++ 清空 pd-server 和 tikv-server 的数据并重启后,也需要重启 tidb-server 集群 ID 是由 pd-server 在集群初始化时随机分配,所以重新部署集群后,集群 ID 会发生变化。tidb-server 业务需要重启以获取新的集群 ID。 @@ -47,15 +46,15 @@ aliases: ['/docs-cn/trouble-shooting/'] tidb-server 无法启动的常见情况包括: -+ 启动参数错误 ++ 启动参数错误 请参考[TiDB 命令行参数](/reference/configuration/tidb-server/configuration.md) -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tidb-server 启动所需要的端口未被占用。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志,确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 @@ -68,50 +67,50 @@ tidb-server 无法启动的常见情况包括: ## tikv-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[TiKV 启动参数](/reference/configuration/tikv-server/configuration.md)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 tikv-server 启动所需要的端口未被占用: `lsof -i:port`。 -+ 无法连接 pd-server ++ 无法连接 pd-server 首先检查 pd-server 的进程状态和日志。确保 pd-server 成功启动,对应端口已打开:`lsof -i:port`。 若 pd-server 正常,则需要检查 tikv-server 机器和 pd-server 对应端口之间的连通性, 确保网段连通且对应服务端口已添加到防火墙白名单中,可通过 nc 或 curl 工具检查。具体命令参考上一节。 -+ 文件被占用 ++ 文件被占用 不要在一个数据库文件目录上打开两个 tikv。 ## pd-server 启动报错 -+ 启动参数错误 ++ 启动参数错误 请参考[PD 命令行参数](/reference/configuration/pd-server/configuration.md)文档。 -+ 端口被占用:`lsof -i:port` ++ 端口被占用:`lsof -i:port` 请确保 pd-server 启动所需要的端口未被占用: `lsof -i:port`。 ## TiDB/TiKV/PD 进程异常退出 -+ 进程是否是启动在前台 ++ 进程是否是启动在前台 当前终端退出给其所有子进程发送 HUP 信号,从而导致进程退出。 -+ 是否是在命令行用过 `nohup+&` 方式直接运行 ++ 是否是在命令行用过 `nohup+&` 方式直接运行 这样依然可能导致进程因终端连接突然中断,作为终端 SHELL 的子进程被杀掉。 推荐将启动命令写在脚本中,通过脚本运行(相当于二次 fork 启动)。 ## TiKV 进程异常重启 -+ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 ++ 检查 dmesg 或者 syslog 里面是否有 OOM 信息 如果有 OOM 信息并且杀掉的进程为 TiKV,请减少 TiKV 的 RocksDB 的各个 CF 的 `block-cache-size` 值。 -+ 检查 TiKV 日志是否有 panic 的 log ++ 检查 TiKV 日志是否有 panic 的 log 提交 Issue 并附上 panic 的 log。 diff --git a/v3.0/how-to/upgrade/from-previous-version.md b/v3.0/how-to/upgrade/from-previous-version.md index add033e004ef..09111a01a59c 100644 --- a/v3.0/how-to/upgrade/from-previous-version.md +++ b/v3.0/how-to/upgrade/from-previous-version.md @@ -116,7 +116,7 @@ $ ansible-playbook local_prepare.yml > > 为优化 TiDB 集群组件的运维管理,TiDB 3.0 版本对 `systemd` 模式下的 `PD service` 名称进行了调整。与之前版本相比,滚动升级 TiDB 3.0 版本集群组件的操作略有不同,注意升级前后 `process_supervision` 参数配置须保持一致。 -如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 +如果 `process_supervision` 变量使用默认的 `systemd` 参数,则通过 `excessive_rolling_update.yml` 滚动升级 TiDB 集群。 ``` $ ansible-playbook excessive_rolling_update.yml diff --git a/v3.0/how-to/upgrade/rolling-updates-with-ansible.md b/v3.0/how-to/upgrade/rolling-updates-with-ansible.md index 4f61b5d78dfc..e38ff85a094e 100644 --- a/v3.0/how-to/upgrade/rolling-updates-with-ansible.md +++ b/v3.0/how-to/upgrade/rolling-updates-with-ansible.md @@ -7,7 +7,7 @@ aliases: ['/docs-cn/op-guide/ansible-deployment-rolling-update/'] # 使用 TiDB-Ansible 升级 TiDB 集群 -滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd * 3、tidb * 2、tikv * 3)。 +滚动升级 TiDB 集群时,会串行关闭服务,更新服务 binary 和配置文件,再启动服务。在前端配置负载均衡的情况下,滚动升级期间不影响业务运行(最小环境 :pd \* 3、tidb \* 2、tikv \* 3)。 > **注意:** > @@ -32,14 +32,14 @@ aliases: ['/docs-cn/op-guide/ansible-deployment-rolling-update/'] > > 如果使用 master 分支的 tidb-ansible,`tidb_version = latest` 保持不变即可,latest 版本的 TiDB 安装包会每日更新。 -2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` +2. 删除原有的 downloads 目录 `/home/tidb/tidb-ansible/downloads/` ``` $ cd /home/tidb/tidb-ansible $ rm -rf downloads ``` -3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` +3. 使用 playbook 下载 TiDB binary,自动替换 binary 到 `/home/tidb/tidb-ansible/resource/bin/` ``` $ ansible-playbook local_prepare.yml @@ -66,7 +66,7 @@ $ wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz ``` $ ansible-playbook rolling_update.yml --tags=pd ``` - + 如果 PD 实例数大于等于 3,滚动升级 PD leader 实例时,Ansible 会先迁移 PD leader 到其他节点再关闭该实例。 - 滚动升级 TiKV 节点(只升级 TiKV 服务) diff --git a/v3.0/how-to/upgrade/tidb-in-kubernetes.md b/v3.0/how-to/upgrade/tidb-in-kubernetes.md index 5d81465f3a1d..4d250d67597f 100644 --- a/v3.0/how-to/upgrade/tidb-in-kubernetes.md +++ b/v3.0/how-to/upgrade/tidb-in-kubernetes.md @@ -7,7 +7,7 @@ category: how-to 滚动更新 TiDB 集群时,会按 PD、TiKV、TiDB 的顺序,串行删除 Pod,并创建新版本的 Pod,当新版本的 Pod 正常运行后,再处理下一个 Pod。 -滚动升级过程会自动处理 PD、TiKV 的 Leader 迁移与 TiDB 的 DDL Owner 迁移。因此,在多节点的部署拓扑下(最小环境:PD * 3、TiKV * 3、TiDB * 2),滚动更新 TiKV、PD 不会影响业务正常运行。 +滚动升级过程会自动处理 PD、TiKV 的 Leader 迁移与 TiDB 的 DDL Owner 迁移。因此,在多节点的部署拓扑下(最小环境:PD \* 3、TiKV \* 3、TiDB \* 2),滚动更新 TiKV、PD 不会影响业务正常运行。 对于有连接重试功能的客户端,滚动更新 TiDB 同样不会影响业务。对于无法进行重试的客户端,滚动更新 TiDB 则会导致连接到被关闭节点的数据库连接失效,造成部分业务请求失败。对于这类业务,推荐在客户端添加重试功能或在低峰期进行 TiDB 的滚动升级操作。 @@ -31,7 +31,7 @@ category: how-to ```shell watch kubectl -n ${namespace} get pod -o wide ``` - + 当所有 Pod 都重建完毕进入 `Running` 状态后,升级完成。 ## 更新 TiDB 集群配置 diff --git a/v3.0/overview.md b/v3.0/overview.md index 4cc0dd0da00b..b37945804a6b 100644 --- a/v3.0/overview.md +++ b/v3.0/overview.md @@ -11,7 +11,7 @@ TiDB 是 PingCAP 公司设计的开源分布式 HTAP (Hybrid Transactional and A TiDB 具备如下特性: - 高度兼容 MySQL - + [大多数情况下](/reference/mysql-compatibility.md),无需修改代码即可从 MySQL 轻松迁移至 TiDB,分库分表后的 MySQL 集群亦可通过 TiDB 工具进行实时迁移。 - 水平弹性扩展 @@ -61,4 +61,4 @@ TiDB 集群所有组件的源码均可从 GitHub 上直接访问: - [TiKV](https://github.com/tikv/tikv) - [PD](https://github.com/pingcap/pd) - [TiSpark](https://github.com/pingcap/tispark) -- [TiDB Operator](https://github.com/pingcap/tidb-operator) \ No newline at end of file +- [TiDB Operator](https://github.com/pingcap/tidb-operator) diff --git a/v3.0/reference/configuration/tidb-in-kubernetes/backup-configuration.md b/v3.0/reference/configuration/tidb-in-kubernetes/backup-configuration.md index 9a6539de96ba..e490f830a353 100644 --- a/v3.0/reference/configuration/tidb-in-kubernetes/backup-configuration.md +++ b/v3.0/reference/configuration/tidb-in-kubernetes/backup-configuration.md @@ -32,7 +32,7 @@ category: reference + 该 Kubernetes Secret 中需要存储目标集群的登录用户名和密码,你可以通过以下命令来创建这个 Secret: {{< copyable "shell-regular" >}} - + ```shell kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=root --from-literal=password= ``` @@ -41,7 +41,7 @@ category: reference + Kubernetes StorageClass + 默认:"local-storage" -+ 备份任务需要绑定一个持久卷 (Persistent Volume, PV) 来永久或临时存储备份数据,`StorageClass` 用于声明持久卷使用的存储类型,需要确保该 `StorageClass` 在 Kubernetes 集群中存在。 ++ 备份任务需要绑定一个持久卷 (Persistent Volume, PV) 来永久或临时存储备份数据,`StorageClass` 用于声明持久卷使用的存储类型,需要确保该 `StorageClass` 在 Kubernetes 集群中存在。 ## `storage.size` @@ -58,7 +58,7 @@ category: reference + 恢复参数 + 默认:"-t 16" -+ 为恢复数据时使用的 [Loader](/dev/reference/tools/loader.md) 指定额外的运行参数 ++ 为恢复数据时使用的 [Loader](/dev/reference/tools/loader.md) 指定额外的运行参数 ## `gcp.bucket` @@ -105,7 +105,7 @@ category: reference + 该 Kubernetes Secret 中需要存储访问 Ceph 时使用的 `access_key` 和 `secret_key`。可使用如下命令来创建这个 Secret: {{< copyable "shell-regular" >}} - + ```shell kubectl create secret generic ceph-backup-secret -n ${namespace} --from-literal=access_key= --from-literal=secret_key= ``` diff --git a/v3.0/reference/configuration/tikv-server/configuration-file.md b/v3.0/reference/configuration/tikv-server/configuration-file.md index c92fc92a274f..fab181c25fc3 100644 --- a/v3.0/reference/configuration/tikv-server/configuration-file.md +++ b/v3.0/reference/configuration/tikv-server/configuration-file.md @@ -3,6 +3,8 @@ title: TiKV 配置文件描述 category: reference --- + + # TiKV 配置文件描述 TiKV 配置文件比命令行参数支持更多的选项。你可以在 [etc/config-template.toml](https://github.com/tikv/tikv/blob/master/etc/config-template.toml) 找到默认值的配置文件,重命名为 config.toml 即可。 @@ -532,7 +534,6 @@ raftstore 相关的配置项。 + 开启按 table 分裂 Region的开关,建议仅在 TiDB 模式下使用。 + 默认值:true - ### `batch-split-limit` + 批量分裂 Region 的阈值,调大该值可加速分裂 Region。 @@ -762,31 +763,32 @@ rocksdb defaultcf 相关的配置项。 ### `cache-index-and-filter-blocks` + 开启或关闭缓存 index 和 filter。 -+ 默认值:true ++ 默认值:true ### `pin-l0-filter-and-index-blocks` + 是否 pin 住 L0 的 index 和 filter。 -+ 默认值:true ++ 默认值:true ### `use-bloom-filter` + 开启 bloom filter 的开关。 -+ 默认值:true ++ 默认值:true ### `optimize-filters-for-hits` + 开启优化 filter 的命中率的开关。 -+ 默认值:true ++ 默认值:true ### `whole_key_filtering` + 开启将整个 key 放到 bloom filter 中的开关。 -+ 默认值:true ++ 默认值:true ### `bloom-filter-bits-per-key` bloom filter 为每个 key 预留的长度。 + + 默认值:10 + 单位:字节 @@ -825,7 +827,6 @@ bloom filter 为每个 key 预留的长度。 + 默认值:1 + 最小值:0 - ### `max-bytes-for-level-base` + base level (L1) 最大字节数,一般设置为 memtable 大小 4 倍。 @@ -869,6 +870,7 @@ bloom filter 为每个 key 预留的长度。 Compaction 优先类型,默认:3(MinOverlappingRatio),0(ByCompensatedSize), 1(OldestLargestSeqFirst),2(OldestSmallestSeqFirst)。 + + 默认值:3 ### `dynamic-level-bytes` @@ -1042,4 +1044,3 @@ import 相关的配置项。 + 并发导入工作任务数。 + 默认值:8 + 最小值:1 - diff --git a/v3.0/reference/performance/tune-tikv.md b/v3.0/reference/performance/tune-tikv.md index a52bfd402011..e36dbbefcf2d 100644 --- a/v3.0/reference/performance/tune-tikv.md +++ b/v3.0/reference/performance/tune-tikv.md @@ -19,7 +19,7 @@ TiKV 使用了 RocksDB 的 `Column Families` (CF) 特性。 - `lock` CF 存储的是锁信息,系统使用默认参数。 - Raft RocksDB 实例存储 Raft log。 - + - `default` CF 主要存储的是 Raft log,与其对应的参数位于 `[raftdb.defaultcf]` 项中。 在 TiKV 3.0 版本后,所有的 CF 默认共同使用一个 block cache 实例。通过在 `[storage.block-cache]` 下设置 `capacity` 参数,你可以配置该 block cache 的大小。block cache 越大,能够缓存的热点数据越多,读取数据越容易,同时占用的系统内存也越多。如果要为每个 CF 使用单独的 block cache 实例,需要在 `[storage.block-cache]` 下设置 `shared=false`,并为每个 CF 配置单独的 block cache 大小。例如,可以在 `[rocksdb.writecf]` 下设置 `block-cache-size` 参数来配置 `write` CF 的大小。 @@ -76,9 +76,9 @@ log-level = "info" ## 如果未设置该参数,则由以下字段或其默认值的总和决定。 ## ## * rocksdb.defaultcf.block-cache-size 或系统全部内存的 25% -## * rocksdb.writecf.block-cache-size 或系统全部内存的 15% -## * rocksdb.lockcf.block-cache-size 或系统全部内存的 2% -## * raftdb.defaultcf.block-cache-size 或系统全部内存的 2% +## * rocksdb.writecf.block-cache-size 或系统全部内存的 15% +## * rocksdb.lockcf.block-cache-size 或系统全部内存的 2% +## * raftdb.defaultcf.block-cache-size 或系统全部内存的 2% ## ## 要在单个物理机上部署多个 TiKV 节点,需要显式配置该参数。 ## 否则,TiKV 中可能会出现 OOM 错误。 @@ -241,14 +241,11 @@ target-file-size-base = "32MB" 除了以上列出的 `block-cache` 以及 `write-buffer` 会占用系统内存外: -1. 需预留一些内存作为系统的 page cache -2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 - +1. 需预留一些内存作为系统的 page cache +2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 ## TiKV 机器配置推荐 -1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 -2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 -3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 - - +1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 +2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 +3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 diff --git a/v3.0/reference/sql/functions-and-operators/encryption-and-compression-functions.md b/v3.0/reference/sql/functions-and-operators/encryption-and-compression-functions.md index 466a8b0b38a3..8122bc55697f 100644 --- a/v3.0/reference/sql/functions-and-operators/encryption-and-compression-functions.md +++ b/v3.0/reference/sql/functions-and-operators/encryption-and-compression-functions.md @@ -6,7 +6,6 @@ aliases: ['/docs-cn/sql/encryption-and-compression-functions/'] # 加密和压缩函数 - | 函数名 | 功能描述 | |:-----------|:----------------------------| | [`MD5()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_md5)                                                             | 计算字符串的 MD5 校验和       | diff --git a/v3.0/reference/sql/language-structure/literal-values.md b/v3.0/reference/sql/language-structure/literal-values.md index 5174501f64f7..a0f0b91d685e 100644 --- a/v3.0/reference/sql/language-structure/literal-values.md +++ b/v3.0/reference/sql/language-structure/literal-values.md @@ -53,17 +53,17 @@ SELECT _utf8'some text'; 转义字符: -- \\0: ASCII NUL (X'00') 字符 -- \\': 单引号 -- \\": 双引号 -- \\b: 退格符号 -- \\n: 换行符 -- \\r: 回车符 +- \\0: ASCII NUL (X'00') 字符 +- \\': 单引号 +- \\": 双引号 +- \\b: 退格符号 +- \\n: 换行符 +- \\r: 回车符 - \\t: tab 符(制表符) -- \\z: ASCII 26 (Ctrl + Z) -- \\\\: 反斜杠 \\ -- \\%: \% -- \\_: \_ +- \\z: ASCII 26 (Ctrl + Z) +- \\\\: 反斜杠 \\ +- \\%: \% +- \\_: \_ 如果要在 string literal 中使用 `'` 或者 `"`,有以下几种办法: @@ -214,7 +214,6 @@ mysql> SELECT TRUE, true, tRuE, FALSE, FaLsE, false; * B'01' * 0b01 - 非法的 Bit-value: * b'2' (2 不是二进制数值, 必须为 0 或 1) diff --git a/v3.0/reference/sql/language-structure/schema-object-names.md b/v3.0/reference/sql/language-structure/schema-object-names.md index 46df7eff555c..fcf9bc0a690e 100644 --- a/v3.0/reference/sql/language-structure/schema-object-names.md +++ b/v3.0/reference/sql/language-structure/schema-object-names.md @@ -61,12 +61,12 @@ CREATE TABLE t (i int); CREATE TABLE test.t (i int); ``` -对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 +对于 `.` 左右两端可以出现空格,`table_name.col_name` 等于 `table_name . col_name`。 如果你要引用这个 identifier,那么请使用: ``` -`table_name`.`col_name` +`table_name`.`col_name` ``` 而不是: @@ -75,4 +75,4 @@ CREATE TABLE test.t (i int); `table_name.col_name` ``` -更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) \ No newline at end of file +更多[细节](https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html) diff --git a/v3.0/reference/sql/statements/admin.md b/v3.0/reference/sql/statements/admin.md index 1ea549de8123..4e266521fd52 100644 --- a/v3.0/reference/sql/statements/admin.md +++ b/v3.0/reference/sql/statements/admin.md @@ -80,7 +80,7 @@ admin show ddl jobs; * `JOB_TYPE`:DDL 操作的类型。 * `SCHEMA_STATE`:schema 的当前状态。如果 `JOB_TYPE` 是 `add index`,则为 index 的状态;如果是 `add column`,则为 column 的状态,如果是 `create table`,则为 table 的状态。常见的状态有以下几种: * `none`:表示不存在。一般 `drop` 操作或者 `create` 操作失败回滚后,会变为 `none` 状态。 - * `delete only`、`write only`、`delete reorganization`、`write reorganization`:这四种状态是中间状态,在[ Online, Asynchronous Schema Change in F1](http://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/41376.pdf) 论文中有详细说明,在此不再赘述。由于中间状态转换很快,一般操作中看不到这几种状态,只有执行 `add index` 操作时能看到处于 `write reorganization` 状态,表示正在添加索引数据。 + * `delete only`、`write only`、`delete reorganization`、`write reorganization`:这四种状态是中间状态,在 [Online, Asynchronous Schema Change in F1](http://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/41376.pdf) 论文中有详细说明,在此不再赘述。由于中间状态转换很快,一般操作中看不到这几种状态,只有执行 `add index` 操作时能看到处于 `write reorganization` 状态,表示正在添加索引数据。 * `public`:表示存在且可用。一般 `create table` 和 `add index/column` 等操作完成后,会变为 `public` 状态,表示新建的 table/column/index 可以正常读写了。 * `SCHEMA_ID`:执行 DDL 操作的数据库的 ID。 * `TABLE_ID`:执行 DDL 操作的表的 ID。 @@ -106,4 +106,4 @@ admin show ddl jobs; ## MySQL 兼容性 -ADMIN 语句是 TiDB 对于 MySQL 语法的扩展。 +ADMIN 语句是 TiDB 对于 MySQL 语法的扩展。 diff --git a/v3.0/reference/sql/statements/begin.md b/v3.0/reference/sql/statements/begin.md index 52b229dbeeae..ee9590050ced 100644 --- a/v3.0/reference/sql/statements/begin.md +++ b/v3.0/reference/sql/statements/begin.md @@ -10,7 +10,6 @@ category: reference 在没有 `BEGIN` 语句的情况下,每个语句默认在各自的事务中自动提交,从而确保 MySQL 兼容性。 - ## 语法图 **BeginTransactionStmt:** diff --git a/v3.0/reference/sql/statements/change-column.md b/v3.0/reference/sql/statements/change-column.md index 8756fa5959ad..066bdbbc1527 100644 --- a/v3.0/reference/sql/statements/change-column.md +++ b/v3.0/reference/sql/statements/change-column.md @@ -44,14 +44,14 @@ mysql> INSERT INTO t1 (col1) VALUES (1),(2),(3),(4),(5); Query OK, 5 rows affected (0.02 sec) Records: 5 Duplicates: 0 Warnings: 0 -mysql> +mysql> mysql> ALTER TABLE t1 CHANGE col1 col2 INT; Query OK, 0 rows affected (0.09 sec) mysql> ALTER TABLE t1 CHANGE col2 col3 BIGINT, ALGORITHM=INSTANT; Query OK, 0 rows affected (0.08 sec) -mysql> +mysql> mysql> ALTER TABLE t1 CHANGE col3 col3 INT; ERROR 1105 (HY000): unsupported modify column length 11 is less than origin 20 mysql> ALTER TABLE t1 CHANGE col3 col3 BLOB; @@ -60,7 +60,6 @@ mysql> ALTER TABLE t1 CHANGE col3 col4 BIGINT, CHANGE id id2 INT NOT NULL; ERROR 1105 (HY000): can't run multi schema change ``` - ## MySQL 兼容性 * 目前尚不支持在单个 `ALTER TABLE` 语句中进行多个更改。 @@ -72,4 +71,4 @@ ERROR 1105 (HY000): can't run multi schema change * [SHOW CREATE TABLE](/reference/sql/statements/show-create-table.md) * [ADD COLUMN](/reference/sql/statements/add-column.md) * [DROP COLUMN](/reference/sql/statements/drop-column.md) -* [MODIFY COLUMN](/reference/sql/statements/modify-column.md) \ No newline at end of file +* [MODIFY COLUMN](/reference/sql/statements/modify-column.md) diff --git a/v3.0/reference/sql/statements/create-index.md b/v3.0/reference/sql/statements/create-index.md index a1ff4e2bf6ee..f2986b3b0897 100644 --- a/v3.0/reference/sql/statements/create-index.md +++ b/v3.0/reference/sql/statements/create-index.md @@ -42,7 +42,6 @@ category: reference ![IndexOption](/media/sqlgram/IndexOption.png) - ## 示例 ```sql @@ -63,7 +62,7 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; +---------------------+----------+------+-------------------------------------------------------------+ 3 rows in set (0.00 sec) -mysql> CREATE INDEX c1 ON t1 (c1); +mysql> CREATE INDEX c1 ON t1 (c1); Query OK, 0 rows affected (0.30 sec) mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; diff --git a/v3.0/reference/sql/statements/drop-column.md b/v3.0/reference/sql/statements/drop-column.md index b602b1f3f131..ba4c43b78503 100644 --- a/v3.0/reference/sql/statements/drop-column.md +++ b/v3.0/reference/sql/statements/drop-column.md @@ -26,7 +26,6 @@ category: reference ![ColumnName](/media/sqlgram/ColumnName.png) - ## 示例 ```sql @@ -87,4 +86,4 @@ mysql> SELECT * FROM t1; * [ADD COLUMN](/reference/sql/statements/add-column.md) * [SHOW CREATE TABLE](/reference/sql/statements/show-create-table.md) -* [CREATE TABLE](/reference/sql/statements/create-table.md) \ No newline at end of file +* [CREATE TABLE](/reference/sql/statements/create-table.md) diff --git a/v3.0/reference/sql/statements/drop-user.md b/v3.0/reference/sql/statements/drop-user.md index 73d901f566d7..084dd0dd0572 100644 --- a/v3.0/reference/sql/statements/drop-user.md +++ b/v3.0/reference/sql/statements/drop-user.md @@ -18,7 +18,6 @@ category: reference ![Username](/media/sqlgram/Username.png) - ## 示例 ```sql @@ -70,4 +69,4 @@ ERROR 1141 (42000): There is no such grant defined for user 'newuser' on host '% * [CREATE USER](/reference/sql/statements/create-user.md) * [ALTER USER](/reference/sql/statements/alter-user.md) * [SHOW CREATE USER](/reference/sql/statements/show-create-user.md) -* [Privilege Management](/reference/security/privilege-system.md) \ No newline at end of file +* [Privilege Management](/reference/security/privilege-system.md) diff --git a/v3.0/reference/sql/statements/split-region.md b/v3.0/reference/sql/statements/split-region.md index 8635d2544c2e..24181192ce10 100644 --- a/v3.0/reference/sql/statements/split-region.md +++ b/v3.0/reference/sql/statements/split-region.md @@ -160,7 +160,7 @@ SPLIT TABLE t INDEX idx3 BETWEEN ("2010-01-01 00:00:00", "a") AND ("2010-01-01 0 {{< copyable "sql" >}} ```sql -SPLIT TABLE t1 INDEX idx4 ("a", "2000-01-01 00:00:01"), ("b", "2019-04-17 14:26:19"), ("c", ""); +SPLIT TABLE t1 INDEX idx4 ("a", "2000-01-01 00:00:01"), ("b", "2019-04-17 14:26:19"), ("c", ""); ``` 该语句指定了 3 个值,会切分出 4 个 Region,每个 Region 的范围如下。 @@ -193,7 +193,7 @@ create table t (a int, b int,index idx1(a)) shard_row_id_bits = 4 pre_split_regi 4 个 table Region 的范围区间如下: ``` -region1: [ -inf , 1<<61 ) +region1: [ -inf , 1<<61 ) region2: [ 1<<61 , 2<<61 ) region3: [ 2<<61 , 3<<61 ) region4: [ 3<<61 , +inf ) diff --git a/v3.0/reference/tidb-binlog-overview.md b/v3.0/reference/tidb-binlog-overview.md index 4982cfdf6d19..3e709181a371 100644 --- a/v3.0/reference/tidb-binlog-overview.md +++ b/v3.0/reference/tidb-binlog-overview.md @@ -61,7 +61,7 @@ Pump 和 Drainer 都支持部署和运行在 Intel x86-64 架构的 64 位通用 * 如果 TiDB Binlog 用于增量恢复,可以设置配置项 `db-type="file"`,Drainer 会将 binlog 转化为指定的 [proto buffer 格式](https://github.com/pingcap/tidb-binlog/blob/master/proto/binlog.proto)的数据,再写入到本地文件中。这样就可以使用 [Reparo](/reference/tools/tidb-binlog/reparo.md) 恢复增量数据。 关于 `db-type` 的取值,应注意: - + - 如果 TiDB 版本 < 2.1.9,则 `db-type="pb"`。 - 如果 TiDB 版本 > = 2.1.9,则 `db-type="file"` 或 `db-type="pb"`。 diff --git a/v3.0/reference/tispark.md b/v3.0/reference/tispark.md index 6947655b4195..3261b0e1b30b 100644 --- a/v3.0/reference/tispark.md +++ b/v3.0/reference/tispark.md @@ -39,11 +39,10 @@ TiSpark 可以在 YARN,Mesos,Standalone 等任意 Spark 模式下运行。 对于 TiKV 与 TiSpark 分开部署的场景,可以参考如下建议配置: -+ 硬件配置建议 ++ 硬件配置建议 普通场景可以参考 [TiDB 和 TiKV 硬件配置建议](/how-to/deploy/hardware-recommendations.md),但是如果是偏重分析的场景,可以将 TiKV 节点增加到至少 64G 内存。 - ### Spark 与 TiSpark 集群独立部署的配置 关于 Spark 的详细硬件推荐配置请参考[官网](https://spark.apache.org/docs/latest/hardware-provisioning.html),如下是 TiSpark 所需环境的简单描述: @@ -71,7 +70,6 @@ spark.sql.extensions org.apache.spark.sql.TiExtensions 例如你有一组 PD 在`10.16.20.1`,`10.16.20.2`,`10.16.20.3`,那么 PD 配置格式是`10.16.20.1:2379,10.16.20.2:2379,10.16.20.3:2379`。 - ### TiSpark 与 TiKV 集群混合部署的配置 对于 TiKV 与 TiSpark 混合部署的场景,需在原有 TiKV 预留资源之外累加 Spark 所需部分,并分配 25% 的内存作为系统本身占用。 @@ -115,7 +113,9 @@ cd $SPARKPATH 类似地,可以用如下命令启动 Spark-Slave 节点: - ./sbin/start-slave.sh spark://spark-master-hostname:7077 +```bash +./sbin/start-slave.sh spark://spark-master-hostname:7077 +``` 命令返回以后,即可通过刚才的面板查看这个 Slave 是否已经正确地加入了 Spark 集群。在所有 Slave 节点重复刚才的命令。确认所有的 Slave 都可以正确连接 Master,这样你就拥有了一个 Standalone 模式的 Spark 集群。 @@ -229,7 +229,7 @@ df.write .option("isolationLevel", "NONE") // recommended to set isolationLevel to NONE if you have a large DF to load. .option("user", "root") // TiDB user here .save() -``` +``` 推荐将 `isolationLevel` 设置为 `NONE`,否则单一大事务有可能造成 TiDB 服务器内存溢出。 @@ -246,19 +246,17 @@ TiSpark 可以使用 TiDB 的统计信息: 统计信息将在 Spark Driver 进行缓存,请确定 Driver 内存足够缓存统计信息。 可以在`spark-defaults.conf`中开启或关闭统计信息读取: - + | Property Name | Default | Description | -------- | -----: | :----: | | spark.tispark.statistics.auto_load | true | 是否默认进行统计信息读取 | - - ## TiSpark FAQ -- Q. 是独立部署还是和现有 Spark/Hadoop 集群共用资源? +- Q. 是独立部署还是和现有 Spark/Hadoop 集群共用资源? A. 可以利用现有 Spark 集群无需单独部署,但是如果现有集群繁忙,TiSpark 将无法达到理想速度。 -- Q. 是否可以和 TiKV 混合部署? +- Q. 是否可以和 TiKV 混合部署? A. 如果 TiDB 以及 TiKV 负载较高且运行关键的线上任务,请考虑单独部署 TiSpark;并且考虑使用不同的网卡保证 OLTP 的网络资源不被侵占而影响线上业务。如果线上业务要求不高或者机器负载不大,可以考虑与 TiKV 混合部署。 diff --git a/v3.0/reference/tools/data-migration/cluster-operations.md b/v3.0/reference/tools/data-migration/cluster-operations.md index 756a6f4f9082..459f69675ef8 100644 --- a/v3.0/reference/tools/data-migration/cluster-operations.md +++ b/v3.0/reference/tools/data-migration/cluster-operations.md @@ -55,9 +55,9 @@ $ ansible-playbook stop.yml - DM 同步 sharding DDL 语句时,如果 DM-worker 成功执行(或跳过)sharding DDL 的 binlog event,与 DM-worker 中的 sharding DDL 语句相关的所有表的断点信息都会被更新至 DDL 语句对应的 binlog event 之后的位置。 - 当 DM-worker 重启发生在 sharding DDL 语句同步开始前或完成后,DM-worker 会根据断点信息和本地记录的子任务信息自动恢复数据同步。 - + - 当 DM-worker 重启发生在 sharding DDL 语句同步过程中,可能会出现作为 DDL lock owner 的 DM-worker 实例已执行了 DDL 语句并成功变更了下游数据库表结构,但其他 DM-worker 实例重启而无法跳过 DDL 语句也无法更新断点的情况。 - + 此时 DM 会再次尝试同步这些未跳过执行的 DDL 语句。然而,由于未重启的 DM-worker 实例已经执行到了此 DDL 对应的 binlog event 之后,重启的 DM-worker 实例会被阻滞在重启前 DDL binlog event 对应的位置。 要解决这个问题,请按照[手动处理 Sharding DDL Lock](/reference/tools/data-migration/features/manually-handling-sharding-ddl-locks.md#场景二unlock-过程中部分-dm-worker-重启) 中描述的步骤操作。 @@ -115,7 +115,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 下载 DM 二进制文件。 - 1. 从 `downloads` 目录删除已有文件。 + 1. 从 `downloads` 目录删除已有文件。 ``` $ cd /home/tidb/dm-ansible @@ -254,8 +254,8 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 为中控机设置 SSH 互信以及 sudo 规则。 - 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 - + 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.80` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + ``` $ cd /home/tidb/dm-ansible $ vi hosts.ini @@ -316,7 +316,8 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 1. 为中控机设置 SSH 互信以及 sudo 规则。 - 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.75` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + 1. 参考[在中控机上配置 SSH 互信和 sudo 规则](/how-to/deploy/data-migration-with-ansible.md#第-5-步-在中控机上配置-ssh-互信和-sudo-规则),使用 `tidb` 账户登录至中控机,并将 `172.16.10.75` 添加至 `hosts.ini` 文件中的 `[servers]` 部分。 + ``` $ cd /home/tidb/dm-ansible $ vi hosts.ini @@ -334,7 +335,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 ``` 该步在 `172.16.10.75` 上创建了一个 `tidb` 用户,设置了 sudo 规则,并为中控机与该机器配置了 SSH 互信。 - + 2. 下线待替换 DM-worker 实例。 > **注意:** @@ -345,7 +346,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 $ ansible-playbook stop.yml --tags=dm-worker -l dm_worker1 ``` -3. 修改 `inventory.ini` 文件,为新 DM-worker 实例添加相关信息。 +3. 修改 `inventory.ini` 文件,为新 DM-worker 实例添加相关信息。 修改 `inventory.ini` 文件。注释或删除旧 `dm_worker1` 实例所在行;同时为新 `dm_worker1` 实例添加相关信息。 @@ -363,7 +364,7 @@ DM-master 重启时会自动向每个 DM-worker 实例请求任务信息,重 $ ansible-playbook deploy.yml --tags=dm-worker -l dm_worker1 ``` -5. 启动新 DM-worker 实例。 +5. 启动新 DM-worker 实例。 ``` $ ansible-playbook start.yml --tags=dm-worker -l dm_worker1 diff --git a/v3.0/reference/tools/data-migration/dm-upgrade.md b/v3.0/reference/tools/data-migration/dm-upgrade.md index 956300f5ab37..221f7c9893b8 100644 --- a/v3.0/reference/tools/data-migration/dm-upgrade.md +++ b/v3.0/reference/tools/data-migration/dm-upgrade.md @@ -47,31 +47,31 @@ Go Version: go version go1.11.2 linux/amd64 - 移除所有 `dm_worker_status_port` 配置项,根据需要变更 `dm_worker_port` 配置项。 - 移除所有 `dm_master_status_port` 配置项,根据需要变更 `dm_master_port` 配置项。 - + 如将 - + ```ini dm_worker1_1 ansible_host=172.16.10.72 server_id=101 deploy_dir=/data1/dm_worker dm_worker_port=10081 dm_worker_status_port=10082 mysql_host=172.16.10.81 mysql_user=root mysql_password='VjX8cEeTX+qcvZ3bPaO4h0C80pe/1aU=' mysql_port=3306 ``` - + 变更为 - + ```ini dm_worker1_1 ansible_host=172.16.10.72 server_id=101 deploy_dir=/data1/dm_worker dm_worker_port=8262 mysql_host=172.16.10.81 mysql_user=root mysql_password='VjX8cEeTX+qcvZ3bPaO4h0C80pe/1aU=' mysql_port=3306 ``` - + 将 - + ```ini dm_master ansible_host=172.16.10.71 dm_master_port=12080 dm_master_status_port=12081 ``` - + 变更为 - + ```ini dm_master ansible_host=172.16.10.71 dm_master_port=8261 ``` - + 2. 使用 DM-Ansible 滚动升级 DM、Prometheus 与 Grafana。 ## 升级到 v1.0.0-133-g2f9fe82 @@ -107,7 +107,7 @@ Go Version: go version go1.11.2 linux/amd64 1. 变更 `inventory.ini` 的配置信息。 为所有 DM-worker 实例设置对应的 `source_id`。 - + 如将 ```ini @@ -123,11 +123,11 @@ Go Version: go version go1.11.2 linux/amd64 2. 使用 DM-Ansible 滚动升级 DM。 3. 变更任务配置文件 (`task.yaml`)。 - + 移除其中的 `config` 与 `instance-id` 配置项,增加 `source-id` 配置项(与 `inventory.ini` 中的 `source_id` 对应)。 - + 如将 - + ```yaml config: host: "192.168.199.118" @@ -136,9 +136,9 @@ Go Version: go version go1.11.2 linux/amd64 password: "1234" instance-id: "instance118-4306" # 此值具有唯一性,当保存 checkpoint、配置和其他信息时,作为 ID 使用。 ``` - + 变更为 - + ```yaml source-id: "instance118-4306" # 如需要重用之前任务的 checkpoint,需要与原 `instance-id` 取值一致。 ``` diff --git a/v3.0/reference/tools/data-migration/features/overview.md b/v3.0/reference/tools/data-migration/features/overview.md index 9b366cb42052..4fb499d703de 100644 --- a/v3.0/reference/tools/data-migration/features/overview.md +++ b/v3.0/reference/tools/data-migration/features/overview.md @@ -252,7 +252,6 @@ filters: | drop index | DDL | drop index event | | alter table | DDL | alter table event | - - `sql-pattern`:用于过滤指定的 DDL SQL 语句,支持正则表达式匹配,例如上面示例 `"^DROP\\s+PROCEDURE"`。 - `action`:string(`Do` / `Ignore`);进行下面规则判断,满足其中之一则过滤,否则不过滤。 @@ -389,11 +388,11 @@ column-mappings: - 如果 `table 前缀` 不为空,则表名的组成必须为 `table 前缀` 或者 `table 前缀 + 分隔符 + 数字(即 table ID)` - 如果库名/表名不包含 `… + 分隔符 + 数字` 部分,则对应的 ID 默认为 0 - 对分库分表的规模支持限制如下 - - 支持最多 16 个 MySQL/MariaDB 实例(0 <= instance ID <= 15) - - 每个实例支持最多 128 个 schema(0 <= schema ID <= 127) - - 每个实例的每个 schema 支持最多 256 个 table(0 <= table ID <= 255) - - 进行列值映射的列的范围 (0 <= ID <= 17592186044415) - - `{instance ID, schema ID, table ID}` 组合需要保持唯一 + - 支持最多 16 个 MySQL/MariaDB 实例(0 <= instance ID <= 15) + - 每个实例支持最多 128 个 schema(0 <= schema ID <= 127) + - 每个实例的每个 schema 支持最多 256 个 table(0 <= table ID <= 255) + - 进行列值映射的列的范围 (0 <= ID <= 17592186044415) + - `{instance ID, schema ID, table ID}` 组合需要保持唯一 - 目前该功能是定制功能,如果需要调整请联系相关开发人员进行调整 **`partition id` 参数配置** diff --git a/v3.0/reference/tools/data-migration/from-aurora.md b/v3.0/reference/tools/data-migration/from-aurora.md index aa4010d9bd10..caab983e0d5c 100644 --- a/v3.0/reference/tools/data-migration/from-aurora.md +++ b/v3.0/reference/tools/data-migration/from-aurora.md @@ -46,7 +46,7 @@ DM 在增量同步阶段依赖 `ROW` 格式的 binlog,如果未启用 binlog 目前推荐使用 DM-Ansible 部署 DM 集群,具体部署方法参照[使用 DM-Ansible 部署 DM 集群](/how-to/deploy/data-migration-with-ansible.md)。 > **注意:** -> +> > - 在 DM 所有的配置文件中,数据库的密码要使用 dmctl 加密后的密文。如果数据库密码为空,则不需要加密。关于如何使用 dmctl 加密明文密码,参考[使用 dmctl 加密上游 MySQL 用户密码](/how-to/deploy/data-migration-with-ansible.md#使用-dmctl-加密上游-mysql-用户密码)。 > - 上下游数据库用户必须拥有相应的读写权限。 @@ -146,10 +146,10 @@ mydumpers: # `task.yaml` 是之前编辑的配置文件 start-task ./task.yaml ``` - + - 如果执行命令后的返回结果中不包含错误信息,则表明任务已经成功启动 - 如果包含以下错误信息,则表明上游 Aurora 用户可能拥有 TiDB 不支持的权限类型 - + ```json { "id": 4, @@ -170,10 +170,11 @@ mydumpers: "extra": "address of db instance - pingcap-1.h8emfqdptyc4.us-east-2.rds.amazonaws.com" } ``` - + 此时可以选择以下两种处理方法中的任意一种进行处理后,再使用 `start-task` 尝试重新启动任务: 1. 为用于进行数据迁移的 Aurora 用户移除不被 TiDB 支持的不必要的权限 2. 如果能确保 Aurora 用户拥有 DM 所需要的权限,可以在 `task.yaml` 配置文件中添加如下顶级配置项以跳过启用任务时的前置权限检查 + ```yaml ignore-checking-items: ["dump_privilege", "replication_privilege"] ``` @@ -189,10 +190,13 @@ query-status > **注意:** > > 如果查询命令的返回结果中包含以下错误信息,则表明在全量同步的 dump 阶段不能获得相应的 lock: +> > ```bash > Couldn't acquire global lock, snapshots will not be consistent: Access denied for user 'root'@'%' (using password: YES) > ``` +> > 此时如果能接受不使用 FTWL 来确保 dump 文件与 metadata 的一致或上游能暂时停止写入,可以通过为 `mydumpers` 下的 `extra-args` 添加 `--no-locks` 参数来进行绕过,具体方法为: +> > 1. 使用 `stop-task` 停止当前由于不能正常 dump 而已经转为 paused 的任务 > 2. 将原 task.yaml 中的 `extra-args: "-B test_db -T test_table"` 更新为 `extra-args: "-B test_db -T test_table --no-locks"` > 3. 使用 `start-task` 重新启动任务 diff --git a/v3.0/reference/tools/data-migration/monitor.md b/v3.0/reference/tools/data-migration/monitor.md index 57dd439c5498..90be88858cc8 100644 --- a/v3.0/reference/tools/data-migration/monitor.md +++ b/v3.0/reference/tools/data-migration/monitor.md @@ -15,7 +15,7 @@ aliases: ['/docs-cn/tools/dm/monitor/'] ## Task -在 Grafana dashboard 中,DM 默认名称为 `DM-task`。 +在 Grafana dashboard 中,DM 默认名称为 `DM-task`。 ### overview @@ -31,7 +31,6 @@ overview 下包含运行当前选定 task 的所有 DM-worker instance 的部分 | binlog file gap between master and syncer | 与上游 master 相比 binlog replication 落后的 binlog file 个数 | N/A | | shard lock resolving | 当前子任务是否正在等待 shard DDL 同步,大于 0 表示正在等待同步 | N/A | - ### task 状态 | metric 名称 | 说明 | 告警说明 | @@ -97,7 +96,6 @@ overview 下包含运行当前选定 task 的所有 DM-worker instance 的部分 | unsynced tables | 当前子任务内还未收到 shard DDL 的分表数量 | N/A | | shard lock resolving | 当前子任务是否正在等待 shard DDL 同步,大于 0 表示正在等待同步 | N/A | - ## Instance 在 Grafana dashboard 中,instance 的默认名称为 `DM-instance`。 diff --git a/v3.0/reference/tools/data-migration/overview.md b/v3.0/reference/tools/data-migration/overview.md index 5a7a9c568f5a..562f19f11811 100644 --- a/v3.0/reference/tools/data-migration/overview.md +++ b/v3.0/reference/tools/data-migration/overview.md @@ -76,11 +76,11 @@ DM 支持对原分库分表进行合库合表操作,但需要满足一些[使 - 5.5 < MySQL 版本 < 5.8 - MariaDB 版本 >= 10.1.2 - + > **注意:** > > 如果上游 MySQL/MariaDB server 间构成主从复制结构,则 - > + > > - 5.7.1 < MySQL 版本 < 5.8 > - MariaDB 版本 >= 10.1.3 diff --git a/v3.0/reference/tools/data-migration/skip-replace-sqls.md b/v3.0/reference/tools/data-migration/skip-replace-sqls.md index 960807807240..456f447c783a 100644 --- a/v3.0/reference/tools/data-migration/skip-replace-sqls.md +++ b/v3.0/reference/tools/data-migration/skip-replace-sqls.md @@ -16,7 +16,7 @@ aliases: ['/docs-cn/tools/dm/skip-replace-sqls/'] 如果提前预知将要同步 TiDB 不支持的 SQL 语句,也可以使用 dmctl 来手动预设跳过/替代执行操作。当 DM 尝试将该 SQL 语句对应的 binlog event 同步到下游时,该预设的操作将自动执行,从而避免同步过程被中断。 -#### 使用限制 +## 使用限制 - 跳过/替代执行操作只适合用于一次性跳过/替代执行**下游 TiDB 不支持执行的 SQL 语句**,其它同步错误请不要使用此方式进行处理。 @@ -34,7 +34,7 @@ aliases: ['/docs-cn/tools/dm/skip-replace-sqls/'] - `--sharding` 模式下只支持预设,并只能使用 `--sql-pattern` 来匹配 binlog event。 - 有关使用 DM 处理 sharding DDL 同步的原理,请参阅[分库分表合并同步原理](/reference/tools/data-migration/features/shard-merge.md#实现原理)。 -#### 匹配 binlog event +## 匹配 binlog event 当同步任务由于执行 SQL 语句出错而中断时,可以使用 `query-error` 命令获取对应 binlog event 的 position 信息。在执行 `sql-skip` / `sql-replace` 时,通过指定该 position 信息,即可与对应的 binlog event 进行匹配。 @@ -50,7 +50,7 @@ aliases: ['/docs-cn/tools/dm/skip-replace-sqls/'] 2. DDL pattern:(仅限于 DDL 语句的)正则表达式匹配模式 - - DDL pattern 在命令中使用 `--sql-pattern` 参数传入,如要匹配 ``` ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` ```,则对应的正则表达式为 ``` ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` ```。 + - DDL pattern 在命令中使用 `--sql-pattern` 参数传入,如要匹配 ```ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` ```,则对应的正则表达式为 ```~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` ```。 - 正则表达式必须以 `~` 为前缀,且不包含任何原始空格(正则表达式字符串中的空格均以 `\s` 或 `\s+` 表示)。 对于合库合表场景,如果需要由 DM 自动选择 DDL lock owner 来执行跳过/替代执行操作,则由于不同 DM-worker 上 DDL 语句对应的 binlog position 无逻辑关联且难以确定,因此只能使用 DDL pattern 匹配模式。 @@ -61,7 +61,7 @@ aliases: ['/docs-cn/tools/dm/skip-replace-sqls/'] > - 不要尝试为一个 binlog event 同时使用 `--binlog-pos` 和 `--sql-pattern` 指定 operator。 > - operator 在与 binlog event 匹配成功后(而非执行成功后)即会被删除,后续如果需要再进行(`--sql-pattern`)匹配则必须重新注册。 -### 支持场景 +## 支持场景 - 场景一:同步过程中,上游执行了 TiDB 不支持的 DDL 语句并同步到了 DM,造成同步任务中断。 @@ -73,7 +73,7 @@ aliases: ['/docs-cn/tools/dm/skip-replace-sqls/'] - 如果业务能接受下游 TiDB 不执行该 DDL 语句,则使用 `sql-skip` 预设一个跳过该 DDL 语句的操作,当执行到该 DDL 语句时即自动跳过。 - 如果业务能接受下游 TiDB 执行其他 DDL 语句来作为替代,则使用 `sql-replace` 预设一个替代该 DDL 语句的操作,当执行到该 DDL 语句时即自动替代。 -### 实现原理 +## 实现原理 DM 在进行增量数据同步时,简化后的流程大致为: @@ -125,25 +125,25 @@ DM 在进行增量数据同步时,简化后的流程大致为: 7. 执行 operator 对应的操作(跳过/替代执行)后,继续执行同步任务。 -### 命令介绍 +## 命令介绍 使用 dmctl 手动处理 TiDB 不支持的 SQL 语句时,主要使用的命令包括 `query-status`、`query-error`、`sql-skip` 和 `sql-replace`。 -#### query-status +### query-status `query-status` 命令用于查询当前 DM-worker 内子任务及 relay 单元等的状态,详见[查询状态](/reference/tools/data-migration/query-status.md)。 -#### query-error +### query-error `query-error` 命令用于查询 DM-worker 内子任务及 relay 单元当前在运行中存在的错误。 -##### 命令用法 +#### 命令用法 ```bash query-error [--worker=127.0.0.1:8262] [task-name] ``` -##### 参数解释 +#### 参数解释 + `worker`: - flag 参数,string,`--worker`,可选; @@ -153,7 +153,7 @@ query-error [--worker=127.0.0.1:8262] [task-name] - 非 flag 参数,string,可选; - 不指定时查询所有任务内的错误,指定时仅查询特定任务内的错误。 -##### 结果示例 +#### 结果示例 ```bash » query-error test @@ -192,17 +192,17 @@ query-error [--worker=127.0.0.1:8262] [task-name] } ``` -#### sql-skip +### sql-skip `sql-skip` 命令用于预设一个跳过操作,当 binlog event 的 position 或 SQL 语句与指定的 `binlog-pos` 或 `sql-pattern` 匹配时,执行该跳过操作。 -##### 命令用法 +#### 命令用法 ```bash sql-skip <--worker=127.0.0.1:8262> [--binlog-pos=mysql-bin|000001.000003:3270] [--sql-pattern=~(?i)ALTER\s+TABLE\s+`db1`.`tbl1`\s+ADD\s+COLUMN\s+col1\s+INT] [--sharding] ``` -##### 参数解释 +#### 参数解释 + `worker`: - flag 参数,string,`--worker`; @@ -218,7 +218,7 @@ sql-skip <--worker=127.0.0.1:8262> [--binlog-pos=mysql-bin|000001.000003:3270] [ + `sql-pattern`: - flag 参数,string,`--sql-pattern`; - `--sql-pattern` 与 `binlog-pos` 必须指定其中一个,且只能指定其中一个。 - - 在指定时表示操作将在 `sql-pattern` 与 binlog event 对应的(经过可选的 router-rule 转换后的)DDL 语句匹配时生效。格式为以 `~` 为前缀的正则表达式,如 ``` ~(?i)ALTER\s+TABLE\s+`db1`.`tbl1`\s+ADD\s+COLUMN\s+col1\s+INT ```。 + - 在指定时表示操作将在 `sql-pattern` 与 binlog event 对应的(经过可选的 router-rule 转换后的)DDL 语句匹配时生效。格式为以 `~` 为前缀的正则表达式,如 ```~(?i)ALTER\s+TABLE\s+`db1`.`tbl1`\s+ADD\s+COLUMN\s+col1\s+INT```。 - 暂时不支持正则表达式中包含原始空格,需要使用 `\s` 或 `\s+` 替代空格。 - 正则表达式必须以 `~` 为前缀,详见[正则表达式语法](https://golang.org/pkg/regexp/syntax/#hdr-Syntax)。 - 正则表达式中的库名和表名必须是经过可选的 router-rule 转换后的名字,即对应下游的目标库名和表名。如上游为 ``` `shard_db_1`.`shard_tbl_1` ```,下游为 ``` `shard_db`.`shard_tbl` ```,则应该尝试匹配 ``` `shard_db`.`shard_tbl` ```。 @@ -233,17 +233,17 @@ sql-skip <--worker=127.0.0.1:8262> [--binlog-pos=mysql-bin|000001.000003:3270] [ - 非 flag 参数,string,必选; - 指定预设的操作将生效的任务。 -#### sql-replace +### sql-replace `sql-replace` 命令用于预设一个替代执行操作,当 binlog event 的 position 或 SQL 语句与指定的 `binlog-pos` 或 `sql-pattern` 匹配时,执行该替代执行操作。 -##### 命令用法 +#### 命令用法 ```bash sql-replace <--worker=127.0.0.1:8262> [--binlog-pos=mysql-bin|000001.000003:3270] [--sql-pattern=~(?i)ALTER\s+TABLE\s+`db1`.`tbl1`\s+ADD\s+COLUMN\s+col1\s+INT] [--sharding] ``` -##### 参数解释 +#### 参数解释 + `worker`: - 与 `sql-skip` 命令的 `--worker` 参数解释一致。 @@ -262,13 +262,13 @@ sql-replace <--worker=127.0.0.1:8262> [--binlog-pos=mysql-bin|000001.000003:3270 + `SQLs`: - 非 flag 参数,string,必选; - - `SQLs` 指定将用于替代原 binlog event 的新的 SQL 语句。多条 SQL 语句间以 `;` 分隔,如 ``` ALTER TABLE shard_db.shard_table drop index idx_c2;ALTER TABLE shard_db.shard_table DROP COLUMN c2; ```。 + - `SQLs` 指定将用于替代原 binlog event 的新的 SQL 语句。多条 SQL 语句间以 `;` 分隔,如 ```ALTER TABLE shard_db.shard_table drop index idx_c2;ALTER TABLE shard_db.shard_table DROP COLUMN c2;```。 -### 使用示例 +## 使用示例 -#### 同步中断后被动执行跳过操作 +### 同步中断后被动执行跳过操作 -##### 应用场景 +#### 应用场景 假设现在需要将上游的 `db1.tbl1` 表同步到下游 TiDB(非合库合表同步场景),初始时表结构为: @@ -294,7 +294,7 @@ ALTER TABLE db1.tbl1 CHANGE c2 c2 DECIMAL (10, 3); 则会由于 TiDB 不支持该 DDL 语句而导致 DM 同步任务中断且报如下错误: ```bash -exec sqls[[USE `db1`; ALTER TABLE `db1`.`tbl1` CHANGE COLUMN `c2` `c2` decimal(10,3);]] failed, +exec sqls[[USE `db1`; ALTER TABLE `db1`.`tbl1` CHANGE COLUMN `c2` `c2` decimal(10,3);]] failed, err:Error 1105: unsupported modify column length 10 is less than origin 11 ``` @@ -302,7 +302,7 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 使用 `query-error` 可以获取该错误的详细信息。比如,执行 `query-error test` 可获得出错的 binlog event 的 position(`failedBinlogPosition`)为 `mysql-bin|000001.000003:34642`。 -##### 被动跳过 SQL 语句 +#### 被动跳过 SQL 语句 假设业务上可以接受下游 TiDB 不执行此 DDL 语句(即继续保持原有的表结构),则可以通过使用 `sql-skip` 命令跳过该 DDL 语句以恢复同步任务。操作步骤如下: @@ -330,7 +330,7 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 11:17:51 operator.go:121: [info] [sql-operator] set a new operator + 2018/12/28 11:17:51 operator.go:121: [info] [sql-operator] set a new operator uuid: 6bfcf30f-2841-4d70-9a34-28d7082bdbd7, pos: (mysql-bin|000001.000003, 34642), op: SKIP, args: on replication unit ``` @@ -357,7 +357,7 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 11:27:46 operator.go:158: [info] [sql-operator] binlog-pos (mysql-bin|000001.000003, 34642) matched, + 2018/12/28 11:27:46 operator.go:158: [info] [sql-operator] binlog-pos (mysql-bin|000001.000003, 34642) matched, applying operator uuid: 6bfcf30f-2841-4d70-9a34-28d7082bdbd7, pos: (mysql-bin|000001.000003, 34642), op: SKIP, args: ``` @@ -365,9 +365,9 @@ err:Error 1105: unsupported modify column length 10 is less than origin 11 5. 使用 `query-error` 确认原错误信息已不再存在。 -#### 同步中断前主动执行替代执行操作 +### 同步中断前主动执行替代执行操作 -##### 应用场景 +#### 应用场景 假设现在需要将上游的 `db2.tbl2` 表同步到下游 TiDB(非合库合表同步场景),初始时表结构为: @@ -394,7 +394,7 @@ ALTER TABLE db2.tbl2 DROP COLUMN c2; 当同步该 DDL 语句对应的 binlog event 到下游时,会由于 TiDB 不支持该 DDL 语句而导致 DM 同步任务中断且报如下错误: ```bash -exec sqls[[USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;]] failed, +exec sqls[[USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;]] failed, err:Error 1105: can't drop column c2 with index covered now ``` @@ -402,7 +402,7 @@ err:Error 1105: can't drop column c2 with index covered now 对于本示例中的 DDL 语句,由于 TiDB 暂时不支持 DROP 存在索引的列,因此可以使用两条新的 SQL 语句来进行替代执行操作,即可以先 DROP 索引、然后再 DROP 列 c2。 -##### 主动替代执行该 SQL 语句 +#### 主动替代执行该 SQL 语句 1. 为将要在上游执行的 DDL 语句(经过可选的 router-rule 转换后的 DDL 语句)设计一个能匹配上的正则表达式。 - 上游将执行的 DDL 语句为 `ALTER TABLE db2.tbl2 DROP COLUMN c2;`。 @@ -438,8 +438,8 @@ err:Error 1105: can't drop column c2 with index covered now 对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 15:33:13 operator.go:121: [info] [sql-operator] set a new operator - uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 15:33:13 operator.go:121: [info] [sql-operator] set a new operator + uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `db2`.`tbl2` DROP INDEX idx_c2; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` on replication unit ``` @@ -449,11 +449,11 @@ err:Error 1105: can't drop column c2 with index covered now 5. 观察下游表结构是否变更成功,对应 DM-worker 节点中也可以看到类似如下日志: ```bash - 2018/12/28 15:33:45 operator.go:158: [info] [sql-operator] - sql-pattern ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` matched SQL - USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;, - applying operator uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, - pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 15:33:45 operator.go:158: [info] [sql-operator] + sql-pattern ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2` matched SQL + USE `db2`; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2`;, + applying operator uuid: c699a18a-8e75-47eb-8e7e-0e5abde2053c, + pattern: ~(?i)ALTER\s+TABLE\s+`db2`.`tbl2`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `db2`.`tbl2` DROP INDEX idx_c2; ALTER TABLE `db2`.`tbl2` DROP COLUMN `c2` ``` @@ -461,15 +461,15 @@ err:Error 1105: can't drop column c2 with index covered now 7. 使用 `query-error` 确认不存在 DDL 执行错误。 -#### 合库合表场景下同步中断后被动执行跳过操作 +### 合库合表场景下同步中断后被动执行跳过操作 -##### 应用场景 +#### 应用场景 假设现在通过多个 DM-worker 将上游多个 MySQL 实例内的多个表进行合库合表同步到下游 TiDB 的同一个表,并且上游各分表执行了 TiDB 不支持的 DDL 语句。 DM-master 通过 DDL lock 协调 DDL 同步、并请求 DDL lock owner 向下游 TiDB 执行该 DDL 语句后,由于 TiDB 不支持该 DDL 语句,同步任务会报错并中断。 -##### 被动跳过 SQL 语句 +#### 被动跳过 SQL 语句 合库合表场景下,被动跳过 TiDB 不支持的 DDL 语句的处理方式与非合库合表场景下的[同步中断后被动执行跳过操作](#同步中断后被动执行跳过操作)基本一致。 @@ -479,9 +479,9 @@ DM-master 通过 DDL lock 协调 DDL 同步、并请求 DDL lock owner 向下游 2. 合库合表场景下,仅需要对 DDL lock owner 执行 `resume-task`(`--worker={DDL-lock-owner}`)。 -#### 合库合表场景下同步中断前主动执行替代执行操作 +### 合库合表场景下同步中断前主动执行替代执行操作 -##### 应用场景 +#### 应用场景 假设现在存在如下四个上游表需要合并同步到下游的同一个表 ``` `shard_db`.`shard_table` ```: @@ -521,7 +521,7 @@ err:Error 1105: can't drop column c2 with index covered now 对于本示例中的 DDL 语句,由于 TiDB 暂时不支持 DROP 存在索引的列,因此可以使用两条新的 SQL 语句来进行替代执行操作,即可以先 DROP 索引、然后再 DROP c2 列。 -##### 主动替代执行该 SQL 语句 +#### 主动替代执行该 SQL 语句 1. 为将要在上游执行的(经过可选的 router-rule 转换后的)DDL 语句设计一个能匹配上的正则表达式。 - 上游将执行的 DDL 语句为 `ALTER TABLE shard_db_*.shard_table_* DROP COLUMN c2`。 @@ -552,13 +552,13 @@ err:Error 1105: can't drop column c2 with index covered now ``` **DM-master** 节点中也可以看到类似如下日志: - + ```bash - 2018/12/28 16:53:33 operator.go:105: [info] [sql-operator] set a new operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" - op:REPLACE args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + 2018/12/28 16:53:33 operator.go:105: [info] [sql-operator] set a new operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" + op:REPLACE args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" sharding:true ``` @@ -567,41 +567,41 @@ err:Error 1105: can't drop column c2 with index covered now 6. 观察下游表结构是否变更成功,对应的 DDL lock **owner** 节点中也可以看到类似如下日志: ```bash - 2018/12/28 16:54:35 operator.go:121: [info] [sql-operator] set a new operator - uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, - pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 16:54:35 operator.go:121: [info] [sql-operator] set a new operator + uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, + pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2` on replication unit ``` ```bash - 2018/12/28 16:54:35 operator.go:158: [info] [sql-operator] - sql-pattern ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL - USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`;, - applying operator uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, - pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, + 2018/12/28 16:54:35 operator.go:158: [info] [sql-operator] + sql-pattern ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL + USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`;, + applying operator uuid: c959f2fb-f1c2-40c7-a1fa-e73cd51736dd, + pattern: ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2`, op: REPLACE, args: ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2` ``` 另外,**DM-master** 节点中也可以看到类似如下日志: ```bash - 2018/12/28 16:54:35 operator.go:122: [info] [sql-operator] get an operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE - args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" - sharding:true - with key ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL + 2018/12/28 16:54:35 operator.go:122: [info] [sql-operator] get an operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE + args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + sharding:true + with key ~(?i)ALTER\s+TABLE\s+`shard_db`.`shard_table`\s+DROP\s+COLUMN\s+`c2` matched SQL USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`; ``` ```bash - 2018/12/28 16:54:36 operator.go:145: [info] [sql-operator] remove an operator - uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE - args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" - args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" - sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" + 2018/12/28 16:54:36 operator.go:145: [info] [sql-operator] remove an operator + uuid: eba35acd-6c5e-4bc3-b0b0-ae8bd1232351, request: name:"test" op:REPLACE + args:"ALTER TABLE `shard_db`.`shard_table` DROP INDEX idx_c2;" + args:"ALTER TABLE `shard_db`.`shard_table` DROP COLUMN `c2`" + sqlPattern:"~(?i)ALTER\\s+TABLE\\s+`shard_db`.`shard_table`\\s+DROP\\s+COLUMN\\s+`c2`" sharding:true ``` diff --git a/v3.0/reference/tools/loader.md b/v3.0/reference/tools/loader.md index 072d94d4636a..219ead6b85b7 100644 --- a/v3.0/reference/tools/loader.md +++ b/v3.0/reference/tools/loader.md @@ -28,13 +28,13 @@ Loader 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/referen ## 使用方法 -#### 注意事项 +### 注意事项 请勿使用 loader 导入 MySQL 实例中 `mysql` 系统数据库到下游 TiDB。 如果 mydumper 使用 -m 参数,会导出不带表结构的数据,这时 loader 无法导入数据。 -如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 +如果使用默认的 `checkpoint-schema` 参数,在导完一个 database 数据库后,请 `drop database tidb_loader` 后再开始导入下一个 database。 推荐数据库开始导入的时候,明确指定 `checkpoint-schema = "tidb_loader"` 参数。 @@ -48,7 +48,7 @@ Loader 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/referen -V 打印 loader 版本 -c string - 指定配置文件启动 loader + 指定配置文件启动 loader -checkpoint-schema string checkpoint 数据库名,loader 在运行过程中会不断的更新这个数据库,在中断并恢复后,会通过这个库获取上次运行的进度 (默认为 "tidb_loader") -d string @@ -113,16 +113,20 @@ port = 4000 通过命令行参数: - ./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +```bash +./bin/loader -d ./test -h 127.0.0.1 -u root -P 4000 +``` 或者使用配置文件 "config.toml": - ./bin/loader -c=config.toml +```bash +./bin/loader -c=config.toml +``` + +## FAQ -## FAQ +### 合库合表场景案例说明 -#### 合库合表场景案例说明 - 根据配置文件的 route-rules 可以支持将分库分表的数据导入到同一个库同一个表中,但是在开始前需要检查分库分表规则: + 是否可以利用 route-rules 的语义规则表示 @@ -130,7 +134,7 @@ port = 4000 Loader 需要配置文件中开启 route-rules 参数以提供合库合表功能 -+ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` ++ 如果使用该功能,必须填写 `pattern-schema` 与 `target-schema` + 如果 `pattern-table` 与 `target-table` 为空,将不进行表名称合并或转换 ```toml diff --git a/v3.0/reference/tools/mydumper.md b/v3.0/reference/tools/mydumper.md index 12ab96499ae7..540201c99218 100644 --- a/v3.0/reference/tools/mydumper.md +++ b/v3.0/reference/tools/mydumper.md @@ -16,7 +16,7 @@ mydumper 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/refer ## 相比于普通的 mydumper,此工具有哪些改进之处? + 使用 `tidb_snapshot` 而非 `FLUSH TABLES WITH READ LOCK` 提供备份一致性 -+ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ++ [允许设置](/how-to/get-started/read-historical-data.md#操作流程) `tidb_snapshot` 的值(即可备份不同时间点的数据) ### 新添参数 diff --git a/v3.0/reference/tools/sync-diff-inspector.md b/v3.0/reference/tools/sync-diff-inspector.md index d82dd0f09a52..505b495ff3f6 100644 --- a/v3.0/reference/tools/sync-diff-inspector.md +++ b/v3.0/reference/tools/sync-diff-inspector.md @@ -167,12 +167,11 @@ password = "" # 库的名称 schema = "test" -# table list which need check in target database. +# table list which need check in target database. # in sharding mode, you must set config for every table in table-config, otherwise will not check the table. # 需要检查的表的名称 tables = ["test"] - # 配置该表对应的分表的相关配置 [[table-config]] # 目标库的名称 diff --git a/v3.0/reference/tools/syncer.md b/v3.0/reference/tools/syncer.md index b7cf3c3dfb7e..ed1d4e6e33fc 100644 --- a/v3.0/reference/tools/syncer.md +++ b/v3.0/reference/tools/syncer.md @@ -353,7 +353,7 @@ target-table = "order_2017" - 5.5 < MySQL 版本 < 5.8 - MariaDB 版本 >= 10.1.2(更早版本的 binlog 部分字段类型格式与 MySQL 不一致) - + > **注意:** > > 如果上游 MySQL/MariaDB server 间构成主从复制结构,则 @@ -460,11 +460,11 @@ target-table = "order_2017" +---------------+-----------------------------------------------------------------------------------+ 1 row in set (0.01 sec) ``` + 6. 检查字符集。 TiDB 和 MySQL 的字符集的兼容性不同,详见 [TiDB 支持的字符集](/reference/sql/character-set.md)。 - ## 监控方案 Syncer 使用开源时序数据库 Prometheus 作为监控和性能指标信息存储方案,使用 Grafana 作为可视化组件进行展示,配合 AlertManager 来实现报警。其方案如下图所示: @@ -499,7 +499,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 #### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: http://localhost:3000 ,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin,密码: admin) + 导入 dashboard 配置文件 @@ -547,7 +547,6 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_binlog_file{node="syncer"}` and `syncer_binlog_file{node="master"}` - info: 需要配置 `position of binlog position` 一起看。`syncer_binlog_file{node="master"}` 表示上游 MySQL 当前 binlog position 的文件编号,`syncer_binlog_file{node="syncer"}` 表示上游 Syncer 已经同步到的 binlog 位置的文件编号 - #### title: execution jobs - metrics: `sum(rate(syncer_add_jobs_total[1m])) by (queueNo)` diff --git a/v3.0/reference/tools/tidb-binlog/tidb-binlog-kafka.md b/v3.0/reference/tools/tidb-binlog/tidb-binlog-kafka.md index 8a482a955e2a..91dc39874b65 100644 --- a/v3.0/reference/tools/tidb-binlog/tidb-binlog-kafka.md +++ b/v3.0/reference/tools/tidb-binlog/tidb-binlog-kafka.md @@ -84,10 +84,10 @@ cd tidb-binlog-kafka-linux-amd64 为了保证数据的完整性,在 Pump 运行 10 分钟左右后按顺序进行如下操作: - * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position - * 全量备份,例如 mydumper 备份 TiDB - * 全量导入备份到目标系统 - * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` + * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position + * 全量备份,例如 mydumper 备份 TiDB + * 全量导入备份到目标系统 + * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` * Drainer 输出为 pb,要在配置文件中设置如下参数: @@ -129,7 +129,7 @@ cd tidb-binlog-kafka-linux-amd64 - `broker.id`:用来标识 Kafka 集群的必备参数,不能重复,如 `broker.id = 1` - `fs.file-max = 1000000`:Kafka 会使用大量文件和网络 socket,建议修改成 1000000,通过 `vi /etc/sysctl.conf` 进行修改 - 修改以下配置为1G, 否则很容易出现事务修改数据较多导致单个消息过大写 kafka 失败 - + * `message.max.bytes=1073741824` * `replica.fetch.max.bytes=1073741824` * `fetch.message.max.bytes=1073741824` diff --git a/v3.0/reference/tools/tidb-binlog/tidb-binlog-local.md b/v3.0/reference/tools/tidb-binlog/tidb-binlog-local.md index 0c93193afa79..b6f87849f042 100644 --- a/v3.0/reference/tools/tidb-binlog/tidb-binlog-local.md +++ b/v3.0/reference/tools/tidb-binlog/tidb-binlog-local.md @@ -37,26 +37,25 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 注意 -* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 -* 手动部署时, 启动顺序为: Pump > TiDB,停止顺序为 TiDB > Pump - +* 需要为一个 TiDB 集群中的每台 TiDB server 部署一个 Pump,目前 TiDB server 只支持以 unix socket 方式的输出 binlog。 +* 手动部署时, 启动顺序为: Pump > TiDB,停止顺序为 TiDB > Pump 我们设置 TiDB 启动参数 binlog-socket 为对应的 Pump 的参数 socket 所指定的 unix socket 文件路径,最终部署结构如下图所示: ![TiDB pump 模块部署结构](/media/tidb-pump-deployment.png) -* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 +* drainer 不支持对 ignore schemas(在过滤列表中的 schemas) 的 table 进行 rename DDL 操作 -* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步。 +* 在已有的 TiDB 集群中启动 drainer,一般需要全量备份 并且获取 savepoint,然后导入全量备份,最后启动 drainer 从 savepoint 开始同步。 为了保证数据的完整性,在 pump 运行 10 分钟左右后按顺序进行下面的操作 - * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` - * 全量备份,例如 mydumper 备份 tidb - * 全量导入备份到目标系统 - * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` + * 以 gen-savepoint model 运行 drainer 生成 drainer savepint 文件,`bin/drainer -gen-savepoint --data-dir= ${drainer_savepoint_dir} --pd-urls=${pd_urls}` + * 全量备份,例如 mydumper 备份 tidb + * 全量导入备份到目标系统 + * 设置 savepoint 文件路径,然后启动 drainer,`bin/drainer --config=conf/drainer.toml --data-dir=${drainer_savepoint_dir}` -* drainer 输出的 pb, 需要在配置文件设置下面的参数 +* drainer 输出的 pb, 需要在配置文件设置下面的参数 ```toml [syncer] @@ -69,14 +68,14 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 使用 TiDB Ansible 部署 Pump (推荐) -* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer +* 搭建全新的 TiDB Cluster,启动顺序 pd-server -> tikv-server -> pump -> tidb-server -> drainer * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook deploy.yml * 执行 ansible-playbook start.yml * drainer 目前需要手动部署 -* 对已有的 TiDB Cluster 部署 binlog +* 对已有的 TiDB Cluster 部署 binlog * 修改 tidb-ansible inventory.ini 文件 * enable_binlog = True * 执行 ansible-playbook rolling_update.yml --tags=tidb @@ -147,7 +146,7 @@ TiDB Binlog 包含在 tidb-enterprise-tools 安装包中,可[在此下载](/re #### 使用 Binary 部署 Drainer -1. Drainer 命令行参数说明 +1. Drainer 命令行参数说明 ``` Usage of drainer: @@ -275,10 +274,10 @@ drainer 启动时可以设置 `--metrics-addr` 和 `--metrics-interval` 两个 ### Grafana 配置 -+ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) ++ 进入 Grafana Web 界面(默认地址: `http://localhost:3000`,默认账号: admin 密码: admin) 点击 Grafana Logo -> 点击 Data Sources -> 点击 Add data source -> 填写 data source 信息 ( 注: Type 选 Prometheus,Url 为 Prometheus 地址,根据实际情况 添加/填写 ) -+ 导入 dashboard 配置文件 ++ 导入 dashboard 配置文件 点击 Grafana Logo -> 点击 Dashboards -> 点击 Import -> 选择需要的 [dashboard 配置文件](https://github.com/pingcap/tidb-ansible/blob/master/scripts/syncer.json)上传 -> 选择对应的 data source diff --git a/v3.0/reference/tools/tidb-lightning/deployment.md b/v3.0/reference/tools/tidb-lightning/deployment.md index ea5c4db72404..0346621a6b93 100644 --- a/v3.0/reference/tools/tidb-lightning/deployment.md +++ b/v3.0/reference/tools/tidb-lightning/deployment.md @@ -37,7 +37,7 @@ aliases: ['/docs-cn/tools/lightning/deployment/'] - 32+ 逻辑核 CPU - 40 GB+ 内存 - 1 TB+ SSD 硬盘,IOPS 越高越好(要求 ≥8000) - * 硬盘必须大于最大的 N 个表的大小总和,其中 N = max(index-concurrency, table-concurrency)。 + * 硬盘必须大于最大的 N 个表的大小总和,其中 N = max(index-concurrency, table-concurrency)。 - 使用万兆网卡,带宽需 300 MB/s 以上 - 运行过程中 CPU、I/O 和网络带宽都可能打满,建议单独部署。 @@ -158,9 +158,9 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche 通过以下链接获取 TiDB-Lightning 安装包(需选择与集群相同的版本): -- **v2.1.9**: https://download.pingcap.org/tidb-v2.1.9-linux-amd64.tar.gz -- **v2.0.9**: https://download.pingcap.org/tidb-lightning-v2.0.9-linux-amd64.tar.gz -- 最新 unstable 版本:https://download.pingcap.org/tidb-lightning-test-xx-latest-linux-amd64.tar.gz +- **v2.1.9**: `https://download.pingcap.org/tidb-v2.1.9-linux-amd64.tar.gz` +- **v2.0.9**: `https://download.pingcap.org/tidb-lightning-v2.0.9-linux-amd64.tar.gz` +- 最新 unstable 版本:`https://download.pingcap.org/tidb-lightning-test-xx-latest-linux-amd64.tar.gz` #### 第 3 步:启动 `tikv-importer` @@ -205,7 +205,7 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche # 第 6 层的算法用于压缩 SST 文件。 # 第 1 至 5 层的算法目前忽略。 compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] - + [rocksdb.writecf] # (同上) compression-per-level = ["lz4", "no", "no", "no", "no", "no", "lz4"] @@ -351,7 +351,7 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche null = '\N' # 是否解析字段内反斜线转义符。 backslash-escape = true - # 如果有行以分隔符结尾,删除尾部分隔符。 + # 如果有行以分隔符结尾,删除尾部分隔符。 trim-last-separator = false [tidb] diff --git a/v3.0/reference/tools/tidb-lightning/monitor.md b/v3.0/reference/tools/tidb-lightning/monitor.md index 9595b39da60f..f81b7f9072d4 100644 --- a/v3.0/reference/tools/tidb-lightning/monitor.md +++ b/v3.0/reference/tools/tidb-lightning/monitor.md @@ -92,15 +92,15 @@ scrape_configs: - **`tikv_import_sst_delivery_duration`** (直方图) 将 SST 文件从 `dispatch-job` 任务发送到 `ImportSSTJob`任务需时的直方图 - + - **`tikv_import_sst_recv_duration`** (直方图) `ImportSSTJob`任务接收从 `dispatch-job` 任务发送过来的 SST 文件需时的直方图。 - + - **`tikv_import_sst_upload_duration`** (直方图) 从 `ImportSSTJob` 任务上传 SST 文件到 TiKV 节点需时的直方图。 - + - **`tikv_import_sst_chunk_bytes`** (直方图) 上传到 TiKV 节点的 SST 文件(压缩)大小的直方图。 @@ -154,7 +154,7 @@ scrape_configs: - **state**:`pending` / `written` / `closed` / `imported` / `altered_auto_inc` / `checksum` / `analyzed` / `completed` - **result**:`success` / `failure` -**`lightning_engines`** (计数器) +- **`lightning_engines`** (计数器) 计算处理后引擎文件的数量以及其状态。标签: @@ -182,7 +182,7 @@ scrape_configs: - **`lightning_row_kv_deliver_seconds`**(直方图) 发送一组与单行 SQL 数据对应的 KV 对需时的直方图。 - + - **`lightning_block_deliver_seconds`**(直方图) 每个 KV 对中的区块传送到 `tikv-importer` 需时的直方图。 diff --git a/v3.0/reference/tools/tikv-control.md b/v3.0/reference/tools/tikv-control.md index 3783bb090f2b..54a41c0b6efa 100644 --- a/v3.0/reference/tools/tikv-control.md +++ b/v3.0/reference/tools/tikv-control.md @@ -260,7 +260,6 @@ success! > - `-p` 选项指定 PD 的 endpoint,不使用 `http` 前缀,用于查询指定的 `region_id` 是否有效。 > - 对于指定 Region 的 peers 所在的每个 store,均须执行该命令。 - ### Ldb 命令 ldb 命令行工具提供多种数据访问以及数据库管理命令。下方列出了一些示例用法。详细信息请在运行 `tikv-ctl ldb` 命令时查看帮助消息或查阅 RocksDB 文档。 @@ -282,4 +281,3 @@ $ tikv-ctl ldb --hex manifest_dump --path=/tmp/db/MANIFEST-000001 您可以通过 `--column_family=` 指定查询的目标列族。 通过 `--try_load_options` 命令加载数据库选项文件以打开数据库。在数据库运行时,建议您保持该命令为开启的状态。如果您使用默认配置打开数据库,LSM-tree 存储组织可能会出现混乱,且无法自动恢复。 - diff --git a/v3.0/reference/transactions/transaction-pessimistic.md b/v3.0/reference/transactions/transaction-pessimistic.md index 466708cbe1ee..ec2bc1ae9a9c 100644 --- a/v3.0/reference/transactions/transaction-pessimistic.md +++ b/v3.0/reference/transactions/transaction-pessimistic.md @@ -67,13 +67,13 @@ default = true - 其次是 session 变量 `tidb_txn_mode`。 -- 最后是配置文件里的 `default`,当使用普通的 `BEGIN` 语句,且 `tidb_txn_mode` 的值为空字符串 `''` 时,根据 `default` 来决定启用悲观事务还是乐观事务。 +- 最后是配置文件里的 `default`,当使用普通的 `BEGIN` 语句,且 `tidb_txn_mode` 的值为空字符串 `''` 时,根据 `default` 来决定启用悲观事务还是乐观事务。 ## 相关配置参数 相关配置都在 `[pessimistic-txn]` 类别下,除了前面介绍过的 `enable` 和 `default`,还可配置以下参数: -- `ttl` +- `ttl` ``` ttl = "30s" diff --git a/v3.0/releases/2.0.10.md b/v3.0/releases/2.0.10.md index cfd0c7106c13..43e063390e31 100644 --- a/v3.0/releases/2.0.10.md +++ b/v3.0/releases/2.0.10.md @@ -24,7 +24,7 @@ aliases: ['/docs-cn/releases/2.0.10/'] - 修复统计信息某些情况下对点查估算的问题 [#8493](https://github.com/pingcap/tidb/pull/8493) - 修复某些情况下返回 Enum 默认值为字符串导致的 panic [#8476](https://github.com/pingcap/tidb/pull/8476) - 修复在宽表场景下,占用太多内存的问题 [#8467](https://github.com/pingcap/tidb/pull/8467) -- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) +- 修复 Parser 对取模操作错误格式化导致的问题 [#8431](https://github.com/pingcap/tidb/pull/8431) - 修复某些情况下添加外键约束导致的 panic 问题 [#8421](https://github.com/pingcap/tidb/pull/8421),[#8410](https://github.com/pingcap/tidb/pull/8410) - 修复 `YEAR` 类型错误转换零值的问题 [#8396](https://github.com/pingcap/tidb/pull/8396) - 修复 `VALUES` 函数在参数不为列的时候 panic 的问题 [#8404](https://github.com/pingcap/tidb/pull/8404) @@ -37,4 +37,4 @@ aliases: ['/docs-cn/releases/2.0.10/'] ## TiKV - 修复迁移 Leader 到新节点时造成请求延时问题 [#3929](https://github.com/tikv/tikv/pull/3929) -- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) \ No newline at end of file +- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) diff --git a/v3.0/releases/2.1.11.md b/v3.0/releases/2.1.11.md index ef414d64e57f..81a7eb513e68 100644 --- a/v3.0/releases/2.1.11.md +++ b/v3.0/releases/2.1.11.md @@ -41,7 +41,6 @@ TiDB Ansible 版本:2.1.11 - TiDB Binlog - 新增 GC 删数据限速功能,避免因为删除数据导致 QPS 降低的问题 [#620](https://github.com/pingcap/tidb-binlog/pull/620) - ## TiDB Ansible - 新增 Drainer 参数 [#760](https://github.com/pingcap/tidb-ansible/pull/760) diff --git a/v3.0/releases/2.1.3.md b/v3.0/releases/2.1.3.md index 4ec8b299cb92..5e9c0dec74d4 100644 --- a/v3.0/releases/2.1.3.md +++ b/v3.0/releases/2.1.3.md @@ -21,13 +21,13 @@ aliases: ['/docs-cn/releases/2.1.3/'] - 允许把 `Sort Merge Join` 用于笛卡尔积 [#9037](https://github.com/pingcap/tidb/pull/9037) - 修复统计信息的 worker 在某些情况下 panic 之后无法恢复的问题 [#9085](https://github.com/pingcap/tidb/pull/9085) - 修复某些情况下 `Sort Merge Join` 结果不正确的问题 [#9046](https://github.com/pingcap/tidb/pull/9046) - - 支持在 `CASE` 子句返回 JSON 类型 [#8355](https://github.com/pingcap/tidb/pull/8355) + - 支持在 `CASE` 子句返回 JSON 类型 [#8355](https://github.com/pingcap/tidb/pull/8355) + Server - 当语句中有非 TiDB hint 的注释时返回警告,而不是错误 [#8766](https://github.com/pingcap/tidb/pull/8766) - 验证设置的 TIMEZONE 的合法性 [#8879](https://github.com/pingcap/tidb/pull/8879) - - 优化 Metrics 项 `QueryDurationHistogram`,展示更多语句的类型 [#8875](https://github.com/pingcap/tidb/pull/8875) + - 优化 Metrics 项 `QueryDurationHistogram`,展示更多语句的类型 [#8875](https://github.com/pingcap/tidb/pull/8875) - 修复 bigint 某些情况下下界溢出的问题 [#8544](https://github.com/pingcap/tidb/pull/8544) - - 支持 `ALLOW_INVALID_DATES` SQL mode [#9110](https://github.com/pingcap/tidb/pull/9110) + - 支持 `ALLOW_INVALID_DATES` SQL mode [#9110](https://github.com/pingcap/tidb/pull/9110) + DDL - 修复一个 RENAME TABLE 的兼容性问题,保持行为跟 MySQL 一致 [#8808](https://github.com/pingcap/tidb/pull/8808) - 支持 `ADD INDEX` 的并发修改即时生效 [#8786](https://github.com/pingcap/tidb/pull/8786) @@ -38,7 +38,7 @@ aliases: ['/docs-cn/releases/2.1.3/'] - 支持 `SHOW CREATE TABLE` 输出列的字符集 [#9053](https://github.com/pingcap/tidb/pull/9053) - 修复 varchar 最大支持字符数在 `utf8mb4` 下限制的问题 [#8818](https://github.com/pingcap/tidb/pull/8818) - 支持 `ALTER TABLE TRUNCATE TABLE PARTITION` [#9093](https://github.com/pingcap/tidb/pull/9093) - - 修复创建表的时候缺省字符集推算的问题 [#9147](https://github.com/pingcap/tidb/pull/9147) + - 修复创建表的时候缺省字符集推算的问题 [#9147](https://github.com/pingcap/tidb/pull/9147) ## PD @@ -56,4 +56,3 @@ aliases: ['/docs-cn/releases/2.1.3/'] - 修复在启动或者重启时 `no available pump` 的问题 [#157](https://github.com/pingcap/tidb-tools/pull/158) - 开启 Pump client log 输出 [#165](https://github.com/pingcap/tidb-tools/pull/165) - 修复表只有 unique key 没有 primary key 的情况下,unique key 包含 NULL 值导致数据更新不一致的问题 - diff --git a/v3.0/releases/2.1.8.md b/v3.0/releases/2.1.8.md index 12387be62774..23385642faf3 100644 --- a/v3.0/releases/2.1.8.md +++ b/v3.0/releases/2.1.8.md @@ -16,7 +16,7 @@ TiDB-Ansible 版本:2.1.8 - 修复 `GROUP_CONCAT` 函数在参数存在 NULL 值情况下与 MySQL 处理逻辑不兼容的问题 [#9930](https://github.com/pingcap/tidb/pull/9930) - 修复在 Distinct 模式下 decimal 类型值之间相等比较的问题 [#9931](https://github.com/pingcap/tidb/pull/9931) -- 修复 `SHOW FULL COLUMNS` 语句在 date,datetime,timestamp 类型的 Collation 的兼容性问题 +- 修复 `SHOW FULL COLUMNS` 语句在 date,datetime,timestamp 类型的 Collation 的兼容性问题 - [#9938](https://github.com/pingcap/tidb/pull/9938) - [#10114](https://github.com/pingcap/tidb/pull/10114) - 修复过滤条件存在关联列的时候统计信息估算行数不准确的问题 [#9937](https://github.com/pingcap/tidb/pull/9937) @@ -29,7 +29,7 @@ TiDB-Ansible 版本:2.1.8 - 统一日志格式规范,利于工具收集分析 [日志规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md) - 修复大量 NULL 值导致统计信息估算不准确的问题 [#9979](https://github.com/pingcap/tidb/pull/9979) - 修复 TIMESTAMP 类型默认值为边界值的时候报错的问题 [#9987](https://github.com/pingcap/tidb/pull/9987) -- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) +- 检查设置 `time_zone` 值的合法性 [#10000](https://github.com/pingcap/tidb/pull/10000) - 支持时间格式 `2019.01.01` [#10001](https://github.com/pingcap/tidb/pull/10001) - 修复某些情况下 `EXPLAIN` 结果中行数估计错误显示的问题 [#10044](https://github.com/pingcap/tidb/pull/10044) - 修复 `KILL TIDB [session id]` 某些情况下无法快速停止语句执行的问题 [#9976](https://github.com/pingcap/tidb/pull/9976) @@ -38,16 +38,16 @@ TiDB-Ansible 版本:2.1.8 ## PD -- 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) +- 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) - 修复 store 读热点的 key 统计不正确问题 [#1487](https://github.com/pingcap/pd/pull/1487) -- 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) -- 添加 PD server 端处理 TSO 请求的耗时 metrics [#1502](https://github.com/pingcap/pd/pull/1502) +- 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) +- 添加 PD server 端处理 TSO 请求的耗时 metrics [#1502](https://github.com/pingcap/pd/pull/1502) ## TiKV - 修复读流量统计错误的问题 [#4441](https://github.com/tikv/tikv/pull/4441) -- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) -- 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) +- 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) +- 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) ## Tools diff --git a/v3.0/releases/2.1ga.md b/v3.0/releases/2.1ga.md index 30a286cbce15..5930a9909f0c 100644 --- a/v3.0/releases/2.1ga.md +++ b/v3.0/releases/2.1ga.md @@ -23,7 +23,7 @@ aliases: ['/docs-cn/releases/2.1ga/'] - 优化 `EXPLAIN` 语句输出格式, 使用层级结构表示算子之间的上下游关系 + SQL 执行引擎 - + - 重构所有聚合函数,提升 `Stream` 和 `Hash` 聚合算子的执行效率 - 实现并行 `Hash Aggregate` 算子,部分场景下有 350% 的性能提升 - 实现并行 `Project` 算子,部分场景有 74% 的性能提升 @@ -47,7 +47,7 @@ aliases: ['/docs-cn/releases/2.1ga/'] + 支持内建函数: - - `json_contains` + - `json_contains` - `json_contains_path` - `encode/decode` @@ -82,8 +82,8 @@ aliases: ['/docs-cn/releases/2.1ga/'] - 支持更多 MySQL 语法 - `BIT` 聚合函数支持 `ALL` 参数 - 支持 `SHOW PRIVILEGES` 语句 - - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 - - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 + - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 + - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 - 支持 `LOAD DATA IGNORE LINES` 语句 - `Show ProcessList` 语句返回更准确信息 @@ -114,7 +114,7 @@ aliases: ['/docs-cn/releases/2.1ga/'] - 新增 `GCSafePoint` 接口,用于支持 TiDB 并发分布式 GC - 新增 `GetAllStores` 接口,用于支持 TiDB 并发分布式 GC + pd-ctl 新增: - + - 使用统计信息进行 Region split - 调用 `jq` 来格式化 JSON 输出 - 查询指定 store 的 Region 信息 @@ -126,7 +126,7 @@ aliases: ['/docs-cn/releases/2.1ga/'] + 监控 - - 增加 `Filter `相关的监控 + - 增加 `Filter`相关的监控 - 新增 etcd Raft 状态机相关监控 + 性能优化 @@ -180,9 +180,9 @@ aliases: ['/docs-cn/releases/2.1ga/'] ## 升级兼容性说明 -- 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 -- 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 ++ 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 ++ 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 + 因为 2.1 版本启用了并行 DDL,对于早于 2.0.1 版本的集群,无法滚动升级到 2.1,可以选择下面两种方案: - 停机升级,直接从早于 2.0.1 的 TiDB 版本升级到 2.1 - - 先滚动升级到 2.0.1 或者之后的 2.0.x 版本,再滚动升级到 2.1 版本 \ No newline at end of file + - 先滚动升级到 2.0.1 或者之后的 2.0.x 版本,再滚动升级到 2.1 版本 diff --git a/v3.0/releases/21rc4.md b/v3.0/releases/21rc4.md index 906a1154011a..213279a4c52c 100644 --- a/v3.0/releases/21rc4.md +++ b/v3.0/releases/21rc4.md @@ -11,33 +11,33 @@ aliases: ['/docs-cn/releases/21rc4/'] ## TiDB + SQL 优化器 - - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) - - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + - 修复某些情况下 `UnionAll` 的列裁剪不正确的问题 [#7941](https://github.com/pingcap/tidb/pull/7941) + - 修复某些情况下 `UnionAll` 算子结果不正确的问题 [#8007](https://github.com/pingcap/tidb/pull/8007) + SQL 执行引擎 - - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) - - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) - - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) - - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) - - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + - 修复 `AVG` 函数的精度问题 [#7874](https://github.com/pingcap/tidb/pull/7874) + - 支持通过 `EXPLAIN ANALYZE` 语句查看 Query 执行过程中各个算子的运行时间,返回结果行数等运行时统计信息 [#7925](https://github.com/pingcap/tidb/pull/7925) + - 修复多次引用同一列时 `PointGet` 算子 panic 的问题 [#7943](https://github.com/pingcap/tidb/pull/7943) + - 修复当 `Limit` 子句中的值太大时 panic 的问题 [#8002](https://github.com/pingcap/tidb/pull/8002) + - 修复某些情况下 `AddDate`/`SubDate` 执行过程中 panic 的问题 [#8009](https://github.com/pingcap/tidb/pull/8009) + 统计信息 - - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) - - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) - - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) - - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) - - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + - 修复将组合索引的直方图下边界前缀判断为越界的问题 [#7856](https://github.com/pingcap/tidb/pull/7856) + - 修复统计信息收集引发的内存泄漏问题 [#7873](https://github.com/pingcap/tidb/pull/7873) + - 修复直方图为空时 panic 的问题 [#7928](https://github.com/pingcap/tidb/pull/7928) + - 修复加载统计信息时直方图边界越界的问题 [#7944](https://github.com/pingcap/tidb/pull/7944) + - 限制统计信息采样过程中数值的最大长度 [#7982](https://github.com/pingcap/tidb/pull/7982) + Server - - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) - - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) - - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) - - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + - 重构 Latch,避免事务冲突误判,提升并发事务的执行性能 [#7711](https://github.com/pingcap/tidb/pull/7711) + - 修复某些情况下收集 Slow Query 导致的 panic 问题 [#7874](https://github.com/pingcap/tidb/pull/7847) + - 修复 `LOAD DATA` 语句中,`ESCAPED BY` 为空字符串时 panic 的问题 [#8005](https://github.com/pingcap/tidb/pull/8005) + - 完善 “coprocessor error” 日志信息 [#8006](https://github.com/pingcap/tidb/pull/8006) + 兼容性 - - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + - 当 Query 为空时,将 `SHOW PROCESSLIST` 结果中的 `Command` 字段设置为 “Sleep” [#7839](https://github.com/pingcap/tidb/pull/7839) + 表达式 - 修复 `SYSDATE` 函数被常量折叠的问题 [#7895](https://github.com/pingcap/tidb/pull/7895) - - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + - 修复 `SUBSTRING_INDEX` 在某些情况下 panic 的问题 [#7897](https://github.com/pingcap/tidb/pull/7897) + DDL - - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) - - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) + - 修复抛出 “invalid ddl job type” 的错误时导致栈溢出的问题 [#7958](https://github.com/pingcap/tidb/pull/7958) + - 修复某些情况下 `ADMIN CHECK TABLE` 结果不正确的问题 [#7975](https://github.com/pingcap/tidb/pull/7975) ## PD diff --git a/v3.0/releases/3.0.0-beta.1.md b/v3.0/releases/3.0.0-beta.1.md index 17ffe7b4ba57..303486887104 100644 --- a/v3.0/releases/3.0.0-beta.1.md +++ b/v3.0/releases/3.0.0-beta.1.md @@ -66,15 +66,15 @@ TiDB-Ansible 版本:3.0.0-beta.1 ## PD -- 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 ++ 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 + 模拟器 - - 支持不同 store 可采用不同的心跳间隔时间 [#1418](https://github.com/pingcap/pd/pull/1418) - - 添加导入数据的场景 [#1263](https://github.com/pingcap/pd/pull/1263) -- 热点调度可配置化 [#1412](https://github.com/pingcap/pd/pull/1412) -- 增加 store 地址为维度的监控项,代替原有的 Store ID [#1429](https://github.com/pingcap/pd/pull/1429) -- 优化 `GetStores` 开销,加快 Region 巡检周期 [#1410](https://github.com/pingcap/pd/pull/1410) -- 新增删除 Tombstone Store 的接口 [#1472](https://github.com/pingcap/pd/pull/1472) - + - 支持不同 store 可采用不同的心跳间隔时间 [#1418](https://github.com/pingcap/pd/pull/1418) + - 添加导入数据的场景 [#1263](https://github.com/pingcap/pd/pull/1263) ++ 热点调度可配置化 [#1412](https://github.com/pingcap/pd/pull/1412) ++ 增加 store 地址为维度的监控项,代替原有的 Store ID [#1429](https://github.com/pingcap/pd/pull/1429) ++ 优化 `GetStores` 开销,加快 Region 巡检周期 [#1410](https://github.com/pingcap/pd/pull/1410) ++ 新增删除 Tombstone Store 的接口 [#1472](https://github.com/pingcap/pd/pull/1472) + ## TiKV + 优化 Coprocessor 计算执行框架,完成 TableScan 算子,单 TableScan 即扫表操作性能提升 5% ~ 30% @@ -83,14 +83,14 @@ TiDB-Ansible 版本:3.0.0-beta.1 - 定义 `BatchExecutor` 接口,实现将请求转化为 `BatchExecutor` 的方法 [#4243](https://github.com/tikv/tikv/pull/4243) - 实现将表达式树转化成 RPN 格式 [#4329](https://github.com/tikv/tikv/pull/4329) - TableScan 算子实现为 Batch 方式,通过向量化计算加速计算 [#4351](https://github.com/tikv/tikv/pull/4351) -- 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 -- 支持 Raw Read 接口使用 Local Reader 进行读 [#4222](https://github.com/tikv/tikv/pull/4222) -- 新增配置信息的 Metrics [#4206](https://github.com/tikv/tikv/pull/4206) -- 新增 Key 越界的 Metrics [#4255](https://github.com/tikv/tikv/pull/4255) -- 新增碰到扫越界错误时 Panic 或者报错选项 [#4254](https://github.com/tikv/tikv/pull/4254) -- 增加 Insert 语义,只有在 Key 不存在的时候 Prewrite 才成功,消除 Batch Get [#4085](https://github.com/tikv/tikv/pull/4085) -- Batch System 使用更加公平的 batch 策略 [#4200](https://github.com/tikv/tikv/pull/4200) -- tikv-ctl 支持 Raw scan [#3825](https://github.com/tikv/tikv/pull/3825) ++ 统一[日志格式规范](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md),利于工具收集分析 ++ 支持 Raw Read 接口使用 Local Reader 进行读 [#4222](https://github.com/tikv/tikv/pull/4222) ++ 新增配置信息的 Metrics [#4206](https://github.com/tikv/tikv/pull/4206) ++ 新增 Key 越界的 Metrics [#4255](https://github.com/tikv/tikv/pull/4255) ++ 新增碰到扫越界错误时 Panic 或者报错选项 [#4254](https://github.com/tikv/tikv/pull/4254) ++ 增加 Insert 语义,只有在 Key 不存在的时候 Prewrite 才成功,消除 Batch Get [#4085](https://github.com/tikv/tikv/pull/4085) ++ Batch System 使用更加公平的 batch 策略 [#4200](https://github.com/tikv/tikv/pull/4200) ++ tikv-ctl 支持 Raw scan [#3825](https://github.com/tikv/tikv/pull/3825) ## Tools @@ -102,8 +102,8 @@ TiDB-Ansible 版本:3.0.0-beta.1 - 支持禁用 TiKV periodic Level-1 compaction,当 TiKV 集群为 2.1.4 或更高时,在导入模式下会自动执行 Level-1 compaction [#119](https://github.com/pingcap/tidb-lightning/pull/119),[#4199](https://github.com/tikv/tikv/pull/4199) - 根据 `table_concurrency` 配置项限制 import engines 数量,默认值:16,防止过多占用 importer 磁盘空间 [#119](https://github.com/pingcap/tidb-lightning/pull/119) - 支持保存中间状态的 SST 到磁盘,减少内存使用 [#4369](https://github.com/tikv/tikv/pull/4369) - - 优化 TiKV-Importer 导入性能,支持将大表的数据和索引分离导入 [#132](https://github.com/pingcap/tidb-lightning/pull/132) - - 支持 CSV 文件导入 [#111](https://github.com/pingcap/tidb-lightning/pull/111) + - 优化 TiKV-Importer 导入性能,支持将大表的数据和索引分离导入 [#132](https://github.com/pingcap/tidb-lightning/pull/132) + - 支持 CSV 文件导入 [#111](https://github.com/pingcap/tidb-lightning/pull/111) + 数据同步对比工具 (sync-diff-inspector) - 支持使用 TiDB 统计信息来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) - - 支持使用多个 column 来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) \ No newline at end of file + - 支持使用多个 column 来划分对比的 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) diff --git a/v3.0/releases/3.0.0-rc.2.md b/v3.0/releases/3.0.0-rc.2.md index 6999e82b0d13..9d6ed2c9c279 100644 --- a/v3.0/releases/3.0.0-rc.2.md +++ b/v3.0/releases/3.0.0-rc.2.md @@ -57,17 +57,17 @@ TiDB Ansible 版本:3.0.0-rc.2 - 修复某些情况下对含有 partition 的 table 添加索引时引发 TiDB panic 的问题 [#10475](https://github.com/pingcap/tidb/pull/10475) - 添加对某些极端情况下导致 schema 出错的防护功能 [#10464](https://github.com/pingcap/tidb/pull/10464) - 创建 range partition 若有单列或者创建 hash partition 时默认开启分区功能 [#9936](https://github.com/pingcap/tidb/pull/9936) - + ## PD - 默认开启 Region storage 将 Region 元信息存储到 Region storage 中 [#1524](https://github.com/pingcap/pd/pull/1524) - 修复热点调度受其他调度器抢占的问题 [#1522](https://github.com/pingcap/pd/pull/1522) - 修复 Leader 优先级不生效的问题 [#1533](https://github.com/pingcap/pd/pull/1533) - 新增 `ScanRegions` 的 gRPC 接口 [#1535](https://github.com/pingcap/pd/pull/1535) -- 主动下发 operator 加快调度速度 [#1536](https://github.com/pingcap/pd/pull/1536) +- 主动下发 operator 加快调度速度 [#1536](https://github.com/pingcap/pd/pull/1536) - 添加 store limit 机制,限制单个 store 的调度速度 [#1474](https://github.com/pingcap/pd/pull/1474) - 修复 `config` 状态不一致的问题 [#1476](https://github.com/pingcap/pd/pull/1476) - + ## TiKV + Engine @@ -96,7 +96,7 @@ TiDB Ansible 版本:3.0.0-rc.2 - `IsFalse` [#4720](https://github.com/tikv/tikv/pull/4720) - 支持 `Int` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Decimal` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - - 支持 `String` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) + - 支持 `String` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Time` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Duration` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) - 支持 `Json` 比较运算 [#4625](https://github.com/tikv/tikv/pull/4625) diff --git a/v3.0/releases/rc3.md b/v3.0/releases/rc3.md index 2404961dccdf..ad4f785dcc51 100644 --- a/v3.0/releases/rc3.md +++ b/v3.0/releases/rc3.md @@ -42,7 +42,7 @@ aliases: ['/docs-cn/releases/rc3/'] - 通过 Key 获取 Region 信息 - 添加、删除 scheduler 和 operator - 获取集群 label 信息 - + ## TiKV + 支持 Async Apply 提升整体写入性能 diff --git a/v3.0/releases/rc4.md b/v3.0/releases/rc4.md index 2de1e77eb021..5b2e5663bd4d 100644 --- a/v3.0/releases/rc4.md +++ b/v3.0/releases/rc4.md @@ -9,7 +9,7 @@ aliases: ['/docs-cn/releases/rc4/'] 2017 年 8 月 4 日,TiDB 正式发布 RC4 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。性能方面重点优化了写入速度,计算任务调度支持优先级,避免分析型大事务影响在线事务。SQL 优化器全新改版,查询代价估算更加准确,且能够自动选择 Join 物理算子。功能方面进一步 MySQL 兼容性。 同时为了更好的支持 OLAP 业务,开源了 TiSpark 项目,可以通过 Spark 读取和分析 TiKV 中的数据。 -## TiDB: +## TiDB + SQL 查询优化器重构 - 更好的支持 TopN 查询 @@ -23,7 +23,7 @@ aliases: ['/docs-cn/releases/rc4/'] + 支持 Json 类型及其操作 + 支持查询优先级、隔离级别的设置 -## PD: +## PD + 支持通过 PD 设置 TiKV location labels + 调度优化 @@ -32,7 +32,7 @@ aliases: ['/docs-cn/releases/rc4/'] - 优化 balance 算法 + 优化数据加载,加快 failover 速度 -## TiKV: +## TiKV + 支持查询优先级设置 + 支持 RC 隔离级别 @@ -41,9 +41,9 @@ aliases: ['/docs-cn/releases/rc4/'] + Coprocessor 支持更多下推函数 + 提升性能,提升稳定性 -## TiSpark Beta Release: - +## TiSpark Beta Release + + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 -+ 通过 TPC-H 测试 (除去一个需要 View 的 Query) \ No newline at end of file ++ 通过 TPC-H 测试 (除去一个需要 View 的 Query) From 948ced135e68330348b1842a74e67e0f5be37238 Mon Sep 17 00:00:00 2001 From: yikeke Date: Thu, 11 Jul 2019 15:07:23 +0800 Subject: [PATCH 2/7] fix lint issues --- .github/ISSUE_TEMPLATE/bug-report.md | 4 -- .github/ISSUE_TEMPLATE/feature-request.md | 4 -- .github/ISSUE_TEMPLATE/question.md | 2 - v2.0/tools/tidb-binlog-kafka.md | 2 +- v2.1-legacy/op-guide/tune-tikv.md | 10 ++--- v2.1-legacy/releases/11alpha.md | 6 +-- v2.1-legacy/releases/11beta.md | 2 +- v2.1-legacy/releases/2.0.10.md | 2 +- v2.1-legacy/releases/2.0.11.md | 6 +-- v2.1-legacy/releases/2.0ga.md | 2 +- v2.1-legacy/releases/2.1.1.md | 2 +- v2.1-legacy/releases/2.1ga.md | 12 +++--- v2.1-legacy/releases/201.md | 2 +- v2.1-legacy/releases/202.md | 1 - v2.1-legacy/releases/203.md | 2 +- v2.1-legacy/releases/204.md | 2 +- v2.1-legacy/releases/205.md | 2 +- v2.1-legacy/releases/206.md | 2 +- v2.1-legacy/releases/207.md | 2 +- v2.1-legacy/releases/208.md | 4 +- v2.1-legacy/releases/209.md | 4 +- v2.1-legacy/releases/21beta.md | 6 +-- v2.1-legacy/releases/21rc1.md | 2 +- v2.1-legacy/releases/21rc2.md | 2 +- v2.1-legacy/releases/21rc5.md | 8 ++-- v2.1-legacy/releases/2rc1.md | 2 +- v2.1-legacy/releases/2rc3.md | 2 +- v2.1-legacy/releases/ga.md | 16 +++---- v2.1-legacy/releases/prega.md | 10 ++--- v2.1-legacy/releases/rc1.md | 42 +++++++++---------- v2.1-legacy/releases/rc4.md | 2 +- v2.1-legacy/tools/tidb-binlog-kafka.md | 20 ++++----- v2.1/reference/tools/tidb-binlog/reparo.md | 2 +- .../tools/tidb-binlog/tidb-binlog-kafka.md | 8 ++-- v2.1/releases/2.0.10.md | 2 +- v2.1/releases/2.0.11.md | 6 +-- v2.1/releases/2.1.1.md | 2 +- v2.1/releases/2.1.3.md | 8 ++-- v2.1/releases/2.1.4.md | 2 +- v3.0/reference/tools/tidb-binlog/reparo.md | 2 +- 40 files changed, 104 insertions(+), 115 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index aafaced030f3..d158793d3bc5 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -3,10 +3,6 @@ name: "\U0001F41B Bug Report" about: Typo, Grammatical error, etc.。 --- - - - - ## Bug 报告 **This repository is ONLY used to solve problems related to DOCS-CN. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 8b684e1725c3..76394d9b70c4 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -3,10 +3,6 @@ name: "\U0001F680 Feature Request" about: Any suggestion? Want to add something new? --- - - - - ## Feature Request **This repository is ONLY used to solve problems related to DOCS-CN. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 093fb2da55b1..cdaa2d5cfe02 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -3,8 +3,6 @@ name: "\U0001F914 Question" about: Usage question that isn't answered in docs or discussion --- - - ## Question **This repository is ONLY used to solve problems related to DOCS-CN. diff --git a/v2.0/tools/tidb-binlog-kafka.md b/v2.0/tools/tidb-binlog-kafka.md index 3dcda9e8738d..aceda3718580 100755 --- a/v2.0/tools/tidb-binlog-kafka.md +++ b/v2.0/tools/tidb-binlog-kafka.md @@ -159,7 +159,7 @@ ZK3="192.168.0.11" -data-dir string Pump 数据存储位置路径 -enable-tolerant -     开启 tolerant 后,如果 binlog 写入失败,Pump 不会报错(默认开启) + 开启 tolerant 后,如果 binlog 写入失败,Pump 不会报错(默认开启) -zookeeper-addrs string (-zookeeper_addrs = "192.168.0.11:2181,192.168.0.12:2181,192.168.0.13:2181") ZooKeeper 地址,该选项从 ZooKeeper 中获取 Kafka 地址 -gc int diff --git a/v2.1-legacy/op-guide/tune-tikv.md b/v2.1-legacy/op-guide/tune-tikv.md index 9a3b0ef03048..8d99f8ae5bf4 100755 --- a/v2.1-legacy/op-guide/tune-tikv.md +++ b/v2.1-legacy/op-guide/tune-tikv.md @@ -229,11 +229,11 @@ block-cache-size = "256MB" 除了以上列出的 `block-cache` 以及 `write-buffer` 会占用系统内存外: -1. 需预留一些内存作为系统的 page cache -2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 +1. 需预留一些内存作为系统的 page cache +2. TiKV 在处理大的查询的时候(例如 `select * from ...`)会读取数据然后在内存中生成对应的数据结构返回给 TiDB,这个过程中 TiKV 会占用一部分内存 ## TiKV 机器配置推荐 -1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 -2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 -3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 +1. 生产环境中,不建议将 TiKV 部署在 CPU 核数小于 8 或内存低于 32GB 的机器上 +2. 如果对写入吞吐要求比较高,建议使用吞吐能力比较好的磁盘 +3. 如果对读写的延迟要求非常高,建议使用 IOPS 比较高的 SSD 盘 diff --git a/v2.1-legacy/releases/11alpha.md b/v2.1-legacy/releases/11alpha.md index e4c73e4e8783..e7d5f179b235 100755 --- a/v2.1-legacy/releases/11alpha.md +++ b/v2.1-legacy/releases/11alpha.md @@ -7,7 +7,7 @@ category: Releases 2018 年 1 月 19 日,TiDB 发布 1.1 Alpha 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB - SQL parser - 兼容更多语法 @@ -28,7 +28,7 @@ category: Releases - Server - 支持 PROXY protocol -## PD: +## PD - 增加更多的 API - 支持 TLS @@ -36,7 +36,7 @@ category: Releases - 调度适应不同的 Region size - Fix 了一些调度的 bug -## TiKV: +## TiKV - 支持 Raft learner - 优化 Raft Snapshot,减少 I/O 开销 diff --git a/v2.1-legacy/releases/11beta.md b/v2.1-legacy/releases/11beta.md index be72f038e76f..2edf8400de27 100755 --- a/v2.1-legacy/releases/11beta.md +++ b/v2.1-legacy/releases/11beta.md @@ -46,4 +46,4 @@ category: Releases + 设置 Raft snapshot max size,防止遗留文件占用太多空间 + `tikv-ctl` 支持更多修复操作 + 优化有序流式聚合操作 -+ 完善 metrics,修复 bug \ No newline at end of file ++ 完善 metrics,修复 bug diff --git a/v2.1-legacy/releases/2.0.10.md b/v2.1-legacy/releases/2.0.10.md index ccd23298b50d..0b47d0a741e4 100755 --- a/v2.1-legacy/releases/2.0.10.md +++ b/v2.1-legacy/releases/2.0.10.md @@ -36,4 +36,4 @@ category: Releases ## TiKV - 修复迁移 Leader 到新节点时造成请求延时问题 [#3929](https://github.com/tikv/tikv/pull/3929) -- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) \ No newline at end of file +- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) diff --git a/v2.1-legacy/releases/2.0.11.md b/v2.1-legacy/releases/2.0.11.md index 82682ff2ec53..0789a8442a83 100755 --- a/v2.1-legacy/releases/2.0.11.md +++ b/v2.1-legacy/releases/2.0.11.md @@ -10,12 +10,12 @@ category: Releases ## TiDB - 修复 PD 发生异常的情况下,Error 没有被正确处理的问题 [#8764](https://github.com/pingcap/tidb/pull/8764) -- 修复 Rename 相同表的行为,跟 MySQL 保持一致 [#8809](https://github.com/pingcap/tidb/pull/8809) +- 修复 Rename 相同表的行为,跟 MySQL 保持一致 [#8809](https://github.com/pingcap/tidb/pull/8809) - 修复 `ADMIN CHECK TABLE` 在 `ADD INDEX` 过程中误报的问题 [#8750](https://github.com/pingcap/tidb/pull/8750) - 修复前缀索引在某些情况下,开闭范围区间错误的问题 [#8877](https://github.com/pingcap/tidb/pull/8877) - 修复在某些添加列的情况下,`UPDATE` 语句 panic 的问题 [#8904](https://github.com/pingcap/tidb/pull/8904) ## TiKV -- 修复了两个 Region merge 相关的问题 -[#4003](https://github.com/tikv/tikv/pull/4003),[#4004](https://github.com/tikv/tikv/pull/4004) \ No newline at end of file +- 修复了两个 Region merge 相关的问题 +[#4003](https://github.com/tikv/tikv/pull/4003),[#4004](https://github.com/tikv/tikv/pull/4004) diff --git a/v2.1-legacy/releases/2.0ga.md b/v2.1-legacy/releases/2.0ga.md index 85983053fe79..bf90ec62748a 100755 --- a/v2.1-legacy/releases/2.0ga.md +++ b/v2.1-legacy/releases/2.0ga.md @@ -153,4 +153,4 @@ TiSpark 使用独立的版本号,现为 1.0 GA。TiSpark 1.0 版本组件提 - ThriftServer/JDBC 支持 - Spark-SQL 交互支持 - PySpark Shell 支持 - - SparkR 支持 \ No newline at end of file + - SparkR 支持 diff --git a/v2.1-legacy/releases/2.1.1.md b/v2.1-legacy/releases/2.1.1.md index f4e90cd8aef2..222506dad3ef 100755 --- a/v2.1-legacy/releases/2.1.1.md +++ b/v2.1-legacy/releases/2.1.1.md @@ -43,4 +43,4 @@ category: Releases - 优化对导入表的 `analyze` 机制,提升了导入速度 - 支持 checkpoint 信息储存在本地文件 + TiDB-Binlog - - 修复 pb files 输出 bug,表只有主键列则无法产生 pb event \ No newline at end of file + - 修复 pb files 输出 bug,表只有主键列则无法产生 pb event diff --git a/v2.1-legacy/releases/2.1ga.md b/v2.1-legacy/releases/2.1ga.md index d58d54f26795..d1ba3137bcc4 100755 --- a/v2.1-legacy/releases/2.1ga.md +++ b/v2.1-legacy/releases/2.1ga.md @@ -81,8 +81,8 @@ category: Releases - 支持更多 MySQL 语法 - `BIT` 聚合函数支持 `ALL` 参数 - 支持 `SHOW PRIVILEGES` 语句 - - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 - - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 + - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 + - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 - 支持 `LOAD DATA IGNORE LINES` 语句 - `Show ProcessList` 语句返回更准确信息 @@ -125,7 +125,7 @@ category: Releases + 监控 - - 增加 `Filter `相关的监控 + - 增加 `Filter`相关的监控 - 新增 etcd Raft 状态机相关监控 + 性能优化 @@ -179,9 +179,9 @@ category: Releases ## 升级兼容性说明 -- 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 -- 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 ++ 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 ++ 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 + 因为 2.1 版本启用了并行 DDL,对于早于 2.0.1 版本的集群,无法滚动升级到 2.1,可以选择下面两种方案: - 停机升级,直接从早于 2.0.1 的 TiDB 版本升级到 2.1 - - 先滚动升级到 2.0.1 或者之后的 2.0.x 版本,再滚动升级到 2.1 版本 \ No newline at end of file + - 先滚动升级到 2.0.1 或者之后的 2.0.x 版本,再滚动升级到 2.1 版本 diff --git a/v2.1-legacy/releases/201.md b/v2.1-legacy/releases/201.md index 135ac3e416f5..400cbde64f51 100755 --- a/v2.1-legacy/releases/201.md +++ b/v2.1-legacy/releases/201.md @@ -46,4 +46,4 @@ category: Releases - 修复特殊情况下开启 learner 无法选举成功的问题 - 修复极端情况下分裂可能导致的脏读问题 - 修正读线程池的配置默认值 -- 修正删大数据表会影响写性能的问题 \ No newline at end of file +- 修正删大数据表会影响写性能的问题 diff --git a/v2.1-legacy/releases/202.md b/v2.1-legacy/releases/202.md index fcc3842152e3..2bfe39b427a7 100755 --- a/v2.1-legacy/releases/202.md +++ b/v2.1-legacy/releases/202.md @@ -27,4 +27,3 @@ category: Releases - 支持配置更多 gRPC 相关参数 - 支持配置选举超时的取值范围 - 修复过期 learner 没有删掉的问题 -- 修复 snapshot 中间文件被误删的问题 \ No newline at end of file diff --git a/v2.1-legacy/releases/203.md b/v2.1-legacy/releases/203.md index 75974a1d1090..8bb4ff170d6f 100755 --- a/v2.1-legacy/releases/203.md +++ b/v2.1-legacy/releases/203.md @@ -34,4 +34,4 @@ category: Releases ## TiKV - 修复 learner flag 错误上报给 PD 的 bug -- 在 `do_div_mod` 中 `divisor/dividend` 为 0 时返回错误 \ No newline at end of file +- 在 `do_div_mod` 中 `divisor/dividend` 为 0 时返回错误 diff --git a/v2.1-legacy/releases/204.md b/v2.1-legacy/releases/204.md index 5266b12a38d6..23aa7846b142 100755 --- a/v2.1-legacy/releases/204.md +++ b/v2.1-legacy/releases/204.md @@ -15,7 +15,7 @@ category: Releases - 优化查询代价估计精度 - 设置 gRPC 的 `backoff max delay` 参数 - 支持通过配置文件设置单条语句的内存使用阈值 -- 重构 Optimizer 的 error +- 重构 Optimizer 的 error - 解决 Cast Decimal 数据的副作用问题 - 解决特定场景下 `Merge Join` 算子结果错误的问题 - 解决转换 `Null` 对象到 String 的问题 diff --git a/v2.1-legacy/releases/205.md b/v2.1-legacy/releases/205.md index 588bed594a4d..b373dfd88a95 100755 --- a/v2.1-legacy/releases/205.md +++ b/v2.1-legacy/releases/205.md @@ -37,4 +37,4 @@ category: Releases ## TiKV - 修复 decimal 运算中潜在的溢出问题 -- 修复 merge 过程中可能发生的脏读问题 \ No newline at end of file +- 修复 merge 过程中可能发生的脏读问题 diff --git a/v2.1-legacy/releases/206.md b/v2.1-legacy/releases/206.md index 439798282357..94d7de221fa9 100755 --- a/v2.1-legacy/releases/206.md +++ b/v2.1-legacy/releases/206.md @@ -46,4 +46,4 @@ category: Releases - 减少回滚事务的连续标记以提升冲突极端严重下的读性能 - 限制 RocksDB log 文件的大小和个数以减少长时间运行下不必要的磁盘占用 - Bug Fixes - - 修复字符串转 Decimal 时出现的 crash \ No newline at end of file + - 修复字符串转 Decimal 时出现的 crash diff --git a/v2.1-legacy/releases/207.md b/v2.1-legacy/releases/207.md index 82cba1593466..ccfa6c4ec1a4 100755 --- a/v2.1-legacy/releases/207.md +++ b/v2.1-legacy/releases/207.md @@ -33,4 +33,4 @@ category: Releases - Improvement - 空集群默认打开 `dynamic-level-bytes` 参数减少空间放大 - Bug Fix - - 在 Region merge 之后更新 Region 的 `approximate size` 和 keys \ No newline at end of file + - 在 Region merge 之后更新 Region 的 `approximate size` 和 keys diff --git a/v2.1-legacy/releases/208.md b/v2.1-legacy/releases/208.md index 196c95d90053..7e5ba2b0410c 100755 --- a/v2.1-legacy/releases/208.md +++ b/v2.1-legacy/releases/208.md @@ -17,7 +17,7 @@ category: Releases - 修复 `duplicate key update` 在某些情况下没有正确插入值的问题 [#7685](https://github.com/pingcap/tidb/pull/7685) - 修复 `UnionScan` 中谓词条件没有下推的问题 [#7726](https://github.com/pingcap/tidb/pull/7726) - 修复增加 `TIMESTAMP` 索引没有正确处理时区的问题 [#7812](https://github.com/pingcap/tidb/pull/7812) - - 修复某些情况下统计信息模块导致的内存泄露问题 [#7864](https://github.com/pingcap/tidb/pull/7864) + - 修复某些情况下统计信息模块导致的内存泄露问题 [#7864](https://github.com/pingcap/tidb/pull/7864) - 修复在某些异常情况下,无法获得 `ANALYZE` 结果的问题 [#7871](https://github.com/pingcap/tidb/pull/7871) - 令 `SYSDATE` 不做表达式展开,以返回正确的结果 [#7894](https://github.com/pingcap/tidb/pull/7894) - 修复某些情况下,`substring_index` panic 的问题 [#7896](https://github.com/pingcap/tidb/pull/7896) @@ -26,4 +26,4 @@ category: Releases ## TiKV + Bug 修复 - - 修复节点宕机时 Raftstore `EntryCache` 占用内存持续上升的问题 [#3529](https://github.com/tikv/tikv/pull/3529) \ No newline at end of file + - 修复节点宕机时 Raftstore `EntryCache` 占用内存持续上升的问题 [#3529](https://github.com/tikv/tikv/pull/3529) diff --git a/v2.1-legacy/releases/209.md b/v2.1-legacy/releases/209.md index 6484b639bd5b..7e425649031c 100755 --- a/v2.1-legacy/releases/209.md +++ b/v2.1-legacy/releases/209.md @@ -10,7 +10,7 @@ category: Releases ## TiDB - 修复统计信息直方图为空的时候导致的问题 [#7927](https://github.com/pingcap/tidb/pull/7927) -- 修复 `UNION ALL` 语句在某些情况下 panic 的问题 [#7942](https://github.com/pingcap/tidb/pull/7942) +- 修复 `UNION ALL` 语句在某些情况下 panic 的问题 [#7942](https://github.com/pingcap/tidb/pull/7942) - 修复错误的 DDL JOB 情况下导致的递归溢出问题 [#7959](https://github.com/pingcap/tidb/pull/7959) - 为 `Commit` 操作加上慢操作日志 [#7983](https://github.com/pingcap/tidb/pull/7983) - 修复 `Limit` 值太大的情况下导致的 panic 问题 [#8004](https://github.com/pingcap/tidb/pull/8004) @@ -43,4 +43,4 @@ category: Releases - 增加 `kv_scan` 接口扫描上界的限制 [#3749](https://github.com/tikv/tikv/pull/3749) - 废弃配置 `max-tasks-xxx` 并新增 `max-tasks-per-worker-xxx` [#3093](https://github.com/tikv/tikv/pull/3093) -- 修复 RocksDB `CompactFiles` 的问题 [#3789](https://github.com/tikv/tikv/pull/3789) \ No newline at end of file +- 修复 RocksDB `CompactFiles` 的问题 [#3789](https://github.com/tikv/tikv/pull/3789) diff --git a/v2.1-legacy/releases/21beta.md b/v2.1-legacy/releases/21beta.md index 578581d8429d..49b0a3bbdfe5 100755 --- a/v2.1-legacy/releases/21beta.md +++ b/v2.1-legacy/releases/21beta.md @@ -41,11 +41,11 @@ category: Releases - 添加 `tidb_disable_txn_auto_retry` 系统变量控制事务是否自动重试 - 修复写入 `time` 类型的数据精度问题 - 支持本地冲突事务排队,优化冲突事务性能 - - 修复 `UPDATE` 语句的 `Affected Rows` + - 修复 `UPDATE` 语句的 `Affected Rows` - 优化 `insert ignore on duplicate key update` 语句性能 - 优化 `Create Table` 语句的执行速度 - 优化 `Add index` 的速度,在某些场景下速度大幅提升 - - 修复 `Alter table add column` 增加列超过表的列数限制的问题 + - 修复 `Alter table add column` 增加列超过表的列数限制的问题 - 修复在某些异常情况下 DDL 任务重试导致 TiKV 压力增加的问题 - 修复在某些异常情况下 TiDB 不断重载 Schema 信息的问题 - DDL @@ -65,7 +65,7 @@ category: Releases - `region merge` 调度时跳过数据行数较多的 Region - 默认开启 `raft learner` 功能,降低调度时出现宕机导致数据不可用的风险 - `pd-recover` 移除 max-replica 参数 -- 增加 `Filter `相关的 metrics +- 增加 `Filter`相关的 metrics - 修复 tikv-ctl unsafe recovery 之后 Region 信息没更新的问题 - 修复某些场景下副本迁移导致 TiKV 磁盘空间耗尽的问题 - 兼容性提示 diff --git a/v2.1-legacy/releases/21rc1.md b/v2.1-legacy/releases/21rc1.md index 669d1b947536..07d7b47fa916 100755 --- a/v2.1-legacy/releases/21rc1.md +++ b/v2.1-legacy/releases/21rc1.md @@ -72,7 +72,7 @@ category: Releases - 修复 `SET` 和 `ENUM` 类型在 `information_schema` 里的 column size [#7347](https://github.com/pingcap/tidb/pull/7347) - 支持建表语句里的 `NATIONAL CHARACTER` 语法 [#7378](https://github.com/pingcap/tidb/pull/7378) - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 [#7391](https://github.com/pingcap/tidb/pull/7391) - - 修复 `SET` 和 `ENUM `类型的 column info [#7417](https://github.com/pingcap/tidb/pull/7417) + - 修复 `SET` 和 `ENUM`类型的 column info [#7417](https://github.com/pingcap/tidb/pull/7417) - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 [#7402](https://github.com/pingcap/tidb/pull/7402) - 修复 `TIMESTAMP` 类型计算过程中丢失精度的问题 [#7418](https://github.com/pingcap/tidb/pull/7418) - 支持更多 `SYSTEM` 变量的合法性验证 [#7196](https://github.com/pingcap/tidb/pull/7196) diff --git a/v2.1-legacy/releases/21rc2.md b/v2.1-legacy/releases/21rc2.md index 231b3f653bfc..426e4289e60d 100755 --- a/v2.1-legacy/releases/21rc2.md +++ b/v2.1-legacy/releases/21rc2.md @@ -116,4 +116,4 @@ category: Releases - Bug 修复 - 修复新分裂 Region 的 PreVote 消息被丢弃导致的 leader 选举问题 [#3557](https://github.com/tikv/tikv/pull/3557) - 修复 Region merge 以后 follower 的相关统计信息 [#3573](https://github.com/tikv/tikv/pull/3573) - - 修复 local reader 使用过期 Region 信息的问题 [#3565](https://github.com/tikv/tikv/pull/3565) \ No newline at end of file + - 修复 local reader 使用过期 Region 信息的问题 [#3565](https://github.com/tikv/tikv/pull/3565) diff --git a/v2.1-legacy/releases/21rc5.md b/v2.1-legacy/releases/21rc5.md index a9d5fc4fb82d..cd4aac521670 100755 --- a/v2.1-legacy/releases/21rc5.md +++ b/v2.1-legacy/releases/21rc5.md @@ -45,9 +45,9 @@ category: Releases - [#1298](https://github.com/pingcap/pd/pull/1298) - [#1299](https://github.com/pingcap/pd/pull/1299) - [#1308](https://github.com/pingcap/pd/pull/1308) -- 修复 `regions/check` API 输出错误的问题 [#1311](https://github.com/pingcap/pd/pull/1311) -- 修复 PD join 失败后无法重新 join 的问题 [#1279](https://github.com/pingcap/pd/pull/1279) -- 修复某些情况下 watch leader 会丢失事件的问题 [#1317](https://github.com/pingcap/pd/pull/1317) ++ 修复 `regions/check` API 输出错误的问题 [#1311](https://github.com/pingcap/pd/pull/1311) ++ 修复 PD join 失败后无法重新 join 的问题 [#1279](https://github.com/pingcap/pd/pull/1279) ++ 修复某些情况下 watch leader 会丢失事件的问题 [#1317](https://github.com/pingcap/pd/pull/1317) ## TiKV @@ -58,4 +58,4 @@ category: Releases ## Tools -- TiDB 支持 TiDB-Binlog cluster,不兼容旧版本 TiDB-Binlog [#8093](https://github.com/pingcap/tidb/pull/8093),[使用文档](https://github.com/pingcap/docs-cn/blob/master/tools/tidb-binlog-cluster.md) \ No newline at end of file +- TiDB 支持 TiDB-Binlog cluster,不兼容旧版本 TiDB-Binlog [#8093](https://github.com/pingcap/tidb/pull/8093),[使用文档](https://github.com/pingcap/docs-cn/blob/master/tools/tidb-binlog-cluster.md) diff --git a/v2.1-legacy/releases/2rc1.md b/v2.1-legacy/releases/2rc1.md index 5df84ccb29ec..6739465e88de 100755 --- a/v2.1-legacy/releases/2rc1.md +++ b/v2.1-legacy/releases/2rc1.md @@ -36,4 +36,4 @@ category: Releases + 增加获取 metrics 的 gRPC API + 启动时候,检查是否使用 SSD + 使用 ReadPool 优化读性能,`raw get` 测试性能提升 30% -+ 完善 metrics,优化 metrics 的使用 \ No newline at end of file ++ 完善 metrics,优化 metrics 的使用 diff --git a/v2.1-legacy/releases/2rc3.md b/v2.1-legacy/releases/2rc3.md index 4489e7e0ab15..a44a69362cfc 100755 --- a/v2.1-legacy/releases/2rc3.md +++ b/v2.1-legacy/releases/2rc3.md @@ -56,4 +56,4 @@ category: Releases - 根据 compaction 事件及时更新对应 Region 的 size 信息 - 对 `scan lock` 的大小进行限制,防止请求超时 - 使用 `DeleteRange` 加速 Region 删除 -- 支持在线修改 RocksDB 的参数 \ No newline at end of file +- 支持在线修改 RocksDB 的参数 diff --git a/v2.1-legacy/releases/ga.md b/v2.1-legacy/releases/ga.md index a8a66ea4463a..65743083591f 100755 --- a/v2.1-legacy/releases/ga.md +++ b/v2.1-legacy/releases/ga.md @@ -7,12 +7,12 @@ category: Releases 2017 年 10 月 16 日,TiDB 发布 GA 版(TiDB 1.0)。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB + SQL 查询优化器 - - 调整代价模型 - - Analyze 下推 - - 函数签名下推 + - 调整代价模型 + - Analyze 下推 + - 函数签名下推 + 优化内部数据格式,减小中间结果大小 + 提升 MySQL 兼容性 @@ -20,12 +20,12 @@ category: Releases + 重构 Hash Aggregator 算子,降低内存使用 + 支持 Stream Aggragator 算子 -## PD: +## PD + 支持基于读流量的热点调度 + 支持设置 Store 权重,以及基于权重的调度 -## TiKV: +## TiKV + Coprocessor 支持更多下推函数 + 支持取样操作下推 @@ -33,7 +33,7 @@ category: Releases + 提升性能和稳定性 + 增加 Debug API,方便调试 -## TiSpark Beta Release: +## TiSpark Beta Release + 支持可配置框架 + 支持 ThriftSever/JDBC 和 Spark SQL 脚本入口 @@ -53,7 +53,7 @@ category: Releases - 腾讯云 - 韩国三星研究院 -### 感谢以下组织/个人提供出色的开源软件/服务: +### 感谢以下组织/个人提供出色的开源软件/服务 - Asta Xie - CNCF diff --git a/v2.1-legacy/releases/prega.md b/v2.1-legacy/releases/prega.md index 76eb4fc15232..75d0d1fcfa44 100755 --- a/v2.1-legacy/releases/prega.md +++ b/v2.1-legacy/releases/prega.md @@ -7,7 +7,7 @@ category: Releases 2017 年 8 月 30 日,TiDB 发布 Pre-GA 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB + SQL 查询优化器 - 调整代价模型 @@ -18,20 +18,20 @@ category: Releases + 完成 JSON 类型支持 (Experimental),包括对 JSON 中的字段查询、更新、建索引 + 裁剪无用数据,减小执行器内存消耗 + 支持在 SQL 语句中设置优先级,并根据查询类型自动设置部分语句的优先级 -+ 完成表达式重构,执行速度提升 30% 左右 ++ 完成表达式重构,执行速度提升 30% 左右 -## PD: +## PD + 支持手动切换 PD 集群 Leader -## TiKV: +## TiKV + Raft Log 使用独立的 RocksDB 实例 + 使用 DeleteRange 加快删除副本速度 + Coprocessor 支持更多运算符下推 + 提升性能,提升稳定性 -## TiSpark Beta Release: +## TiSpark Beta Release + 支持谓词下推 + 支持聚合下推 diff --git a/v2.1-legacy/releases/rc1.md b/v2.1-legacy/releases/rc1.md index b763d946cf4e..20e24a1d6ae8 100755 --- a/v2.1-legacy/releases/rc1.md +++ b/v2.1-legacy/releases/rc1.md @@ -9,33 +9,33 @@ category: Releases ## TiKV - + 提升写入速度 - + 降低磁盘空间占用 - + 支持百 TB 级别数据 - + 提升稳定性,集群规模支持 200 个节点 - + 提供 Raw KV API,以及 Golang client ++ 提升写入速度 ++ 降低磁盘空间占用 ++ 支持百 TB 级别数据 ++ 提升稳定性,集群规模支持 200 个节点 ++ 提供 Raw KV API,以及 Golang client ## PD - + PD 调度策略框架优化,策略更加灵活合理 - + 添加 label 支持,支持跨 DC 调度 - + 提供 PD Controler,方便操作 PD 集群 ++ PD 调度策略框架优化,策略更加灵活合理 ++ 添加 label 支持,支持跨 DC 调度 ++ 提供 PD Controler,方便操作 PD 集群 ## TiDB - + SQL 查询优化器 - - 支持 eager aggregate - - 更详细的 explain 信息 - - union 算子并行化 - - 子查询性能优化 - - 条件下推优化 - - 优化 CBO 框架 - + 重构 time 相关类型的实现,提升和 MySQL 的兼容性 - + 支持更多的 MySQL 内建函数 - + Add Index 语句提速 - + 支持用 change column 语句修改列名;支持使用 Alter table 的 modify column 和 change column 完成部分列类型转换 ++ SQL 查询优化器 + - 支持 eager aggregate + - 更详细的 explain 信息 + - union 算子并行化 + - 子查询性能优化 + - 条件下推优化 + - 优化 CBO 框架 ++ 重构 time 相关类型的实现,提升和 MySQL 的兼容性 ++ 支持更多的 MySQL 内建函数 ++ Add Index 语句提速 ++ 支持用 change column 语句修改列名;支持使用 Alter table 的 modify column 和 change column 完成部分列类型转换 ## 工具 - + Loader:兼容 Percona 的 mydumper 数据格式,提供多线程导入、出错重试、断点续传等功能,并且针对 TiDB 有优化 - + 开发完成一键部署工具 ++ Loader:兼容 Percona 的 mydumper 数据格式,提供多线程导入、出错重试、断点续传等功能,并且针对 TiDB 有优化 ++ 开发完成一键部署工具 diff --git a/v2.1-legacy/releases/rc4.md b/v2.1-legacy/releases/rc4.md index 744f578a2df7..fb4e0eeea71c 100755 --- a/v2.1-legacy/releases/rc4.md +++ b/v2.1-legacy/releases/rc4.md @@ -45,4 +45,4 @@ category: Releases + 支持谓词下推 + 支持聚合下推 + 支持范围裁剪 -+ 通过 TPC-H 测试 (除去一个需要 View 的 Query) \ No newline at end of file ++ 通过 TPC-H 测试 (除去一个需要 View 的 Query) diff --git a/v2.1-legacy/tools/tidb-binlog-kafka.md b/v2.1-legacy/tools/tidb-binlog-kafka.md index 0328677cd7df..aa6df97ce742 100755 --- a/v2.1-legacy/tools/tidb-binlog-kafka.md +++ b/v2.1-legacy/tools/tidb-binlog-kafka.md @@ -24,15 +24,15 @@ TiDB-Binlog 支持以下功能场景: TiDB-Binlog 集群主要分为三个组件: -#### Pump +### Pump Pump 是一个守护进程,在每个 TiDB 主机的后台运行。其主要功能是实时记录 TiDB 产生的 Binlog 并顺序写入 Kafka 中。 -#### Drainer +### Drainer Drainer 从 Kafka 中收集 Binlog,并按照 TiDB 中事务的提交顺序转化为指定数据库兼容的 SQL 语句,最后同步到目的数据库或者写到顺序文件。 -#### Kafka & ZooKeeper +### Kafka & ZooKeeper Kafka 集群用来存储由 Pump 写入的 Binlog 数据,并提供给 Drainer 进行读取。 @@ -44,9 +44,9 @@ Kafka 集群用来存储由 Pump 写入的 Binlog 数据,并提供给 Drainer 以下为 TiDB-Ansible 分支与 TiDB 版本的对应关系,版本选择可咨询官方 info@pingcap.com。 - | TiDB-Ansible 分支 | TiDB 版本 | 备注 | - | ---------------- | --------- | --- | - | release-2.0 | 2.0 版本 | 最新 2.0 稳定版本,可用于生产环境。 | +| TiDB-Ansible 分支 | TiDB 版本 | 备注 | +| ---------------- | --------- | --- | +| release-2.0 | 2.0 版本 | 最新 2.0 稳定版本,可用于生产环境。 | ### 下载官方 Binary @@ -83,10 +83,10 @@ cd tidb-binlog-kafka-linux-amd64 为了保证数据的完整性,在 Pump 运行 10 分钟左右后按顺序进行如下操作: - * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position - * 全量备份,例如 mydumper 备份 TiDB - * 全量导入备份到目标系统 - * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` + * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position + * 全量备份,例如 mydumper 备份 TiDB + * 全量导入备份到目标系统 + * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` * Drainer 输出为 pb,要在配置文件中设置如下参数: diff --git a/v2.1/reference/tools/tidb-binlog/reparo.md b/v2.1/reference/tools/tidb-binlog/reparo.md index 91997884dae7..49ca362b9ad9 100644 --- a/v2.1/reference/tools/tidb-binlog/reparo.md +++ b/v2.1/reference/tools/tidb-binlog/reparo.md @@ -90,4 +90,4 @@ password = "" > - stop-datetime 和 stop-tso 效果一样,只是时间格式上的区别,用于指定结束恢复的时间点;如果不指定,则恢复到最后一个 binlog 文件的结尾。 > - dest-type 指定目标类型,取值为 `mysql`、`print`。 当值为 `mysql` 时,可以恢复到 MySQL/TiDB 等使用或兼容 MySQL 协议的数据库,需要在配置下面的 [dest-db] 填写数据库信息;当取值为 `print` 的时候,只是打印 binlog 信息,通常用于 debug,以及查看 binlog 的内容,此时不需要填写 `[dest-db]`。 > - replicate-do-db 用于指定恢复的库,不指定的话,则全部都恢复。 -> - replicate-do-table 用于指定要恢复的表,不指定的话,则全部都恢复。 \ No newline at end of file +> - replicate-do-table 用于指定要恢复的表,不指定的话,则全部都恢复。 diff --git a/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md b/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md index cabf7a59560c..3c6517236d58 100644 --- a/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md +++ b/v2.1/reference/tools/tidb-binlog/tidb-binlog-kafka.md @@ -83,10 +83,10 @@ cd tidb-binlog-kafka-linux-amd64 为了保证数据的完整性,在 Pump 运行 10 分钟左右后按顺序进行如下操作: - * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position - * 全量备份,例如 mydumper 备份 TiDB - * 全量导入备份到目标系统 - * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` + * 使用 [tidb-tools](https://github.com/pingcap/tidb-tools) 项目中的 [binlogctl](https://github.com/pingcap/tidb-tools/tree/master/tidb-binlog/binlogctl) 工具生成 Drainer 初次启动所需的 position + * 全量备份,例如 mydumper 备份 TiDB + * 全量导入备份到目标系统 + * Kafka 版本 Drainer 启动的 savepoint 默认保存在下游 database tidb_binlog 下的 checkpoint 表中,如果 checkpoint 表中没有有效的数据,可以通过设置 `initial-commit-ts` 启动 Drainer 从指定位置开始消费 - `bin/drainer --config=conf/drainer.toml --initial-commit-ts=${position}` * Drainer 输出为 pb,要在配置文件中设置如下参数: diff --git a/v2.1/releases/2.0.10.md b/v2.1/releases/2.0.10.md index ccd23298b50d..0b47d0a741e4 100644 --- a/v2.1/releases/2.0.10.md +++ b/v2.1/releases/2.0.10.md @@ -36,4 +36,4 @@ category: Releases ## TiKV - 修复迁移 Leader 到新节点时造成请求延时问题 [#3929](https://github.com/tikv/tikv/pull/3929) -- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) \ No newline at end of file +- 修复多余的 Region 心跳 [#3930](https://github.com/tikv/tikv/pull/3930) diff --git a/v2.1/releases/2.0.11.md b/v2.1/releases/2.0.11.md index 82682ff2ec53..0789a8442a83 100644 --- a/v2.1/releases/2.0.11.md +++ b/v2.1/releases/2.0.11.md @@ -10,12 +10,12 @@ category: Releases ## TiDB - 修复 PD 发生异常的情况下,Error 没有被正确处理的问题 [#8764](https://github.com/pingcap/tidb/pull/8764) -- 修复 Rename 相同表的行为,跟 MySQL 保持一致 [#8809](https://github.com/pingcap/tidb/pull/8809) +- 修复 Rename 相同表的行为,跟 MySQL 保持一致 [#8809](https://github.com/pingcap/tidb/pull/8809) - 修复 `ADMIN CHECK TABLE` 在 `ADD INDEX` 过程中误报的问题 [#8750](https://github.com/pingcap/tidb/pull/8750) - 修复前缀索引在某些情况下,开闭范围区间错误的问题 [#8877](https://github.com/pingcap/tidb/pull/8877) - 修复在某些添加列的情况下,`UPDATE` 语句 panic 的问题 [#8904](https://github.com/pingcap/tidb/pull/8904) ## TiKV -- 修复了两个 Region merge 相关的问题 -[#4003](https://github.com/tikv/tikv/pull/4003),[#4004](https://github.com/tikv/tikv/pull/4004) \ No newline at end of file +- 修复了两个 Region merge 相关的问题 +[#4003](https://github.com/tikv/tikv/pull/4003),[#4004](https://github.com/tikv/tikv/pull/4004) diff --git a/v2.1/releases/2.1.1.md b/v2.1/releases/2.1.1.md index f4e90cd8aef2..222506dad3ef 100644 --- a/v2.1/releases/2.1.1.md +++ b/v2.1/releases/2.1.1.md @@ -43,4 +43,4 @@ category: Releases - 优化对导入表的 `analyze` 机制,提升了导入速度 - 支持 checkpoint 信息储存在本地文件 + TiDB-Binlog - - 修复 pb files 输出 bug,表只有主键列则无法产生 pb event \ No newline at end of file + - 修复 pb files 输出 bug,表只有主键列则无法产生 pb event diff --git a/v2.1/releases/2.1.3.md b/v2.1/releases/2.1.3.md index 2c6baab096f0..3374cd294fa7 100644 --- a/v2.1/releases/2.1.3.md +++ b/v2.1/releases/2.1.3.md @@ -20,13 +20,13 @@ category: Releases - 允许把 `Sort Merge Join` 用于笛卡尔积 [#9037](https://github.com/pingcap/tidb/pull/9037) - 修复统计信息的 worker 在某些情况下 panic 之后无法恢复的问题 [#9085](https://github.com/pingcap/tidb/pull/9085) - 修复某些情况下 `Sort Merge Join` 结果不正确的问题 [#9046](https://github.com/pingcap/tidb/pull/9046) - - 支持在 `CASE` 子句返回 JSON 类型 [#8355](https://github.com/pingcap/tidb/pull/8355) + - 支持在 `CASE` 子句返回 JSON 类型 [#8355](https://github.com/pingcap/tidb/pull/8355) + Server - 当语句中有非 TiDB hint 的注释时返回警告,而不是错误 [#8766](https://github.com/pingcap/tidb/pull/8766) - 验证设置的 TIMEZONE 的合法性 [#8879](https://github.com/pingcap/tidb/pull/8879) - - 优化 Metrics 项 `QueryDurationHistogram`,展示更多语句的类型 [#8875](https://github.com/pingcap/tidb/pull/8875) + - 优化 Metrics 项 `QueryDurationHistogram`,展示更多语句的类型 [#8875](https://github.com/pingcap/tidb/pull/8875) - 修复 bigint 某些情况下下界溢出的问题 [#8544](https://github.com/pingcap/tidb/pull/8544) - - 支持 `ALLOW_INVALID_DATES` SQL mode [#9110](https://github.com/pingcap/tidb/pull/9110) + - 支持 `ALLOW_INVALID_DATES` SQL mode [#9110](https://github.com/pingcap/tidb/pull/9110) + DDL - 修复一个 RENAME TABLE 的兼容性问题,保持行为跟 MySQL 一致 [#8808](https://github.com/pingcap/tidb/pull/8808) - 支持 `ADD INDEX` 的并发修改即时生效 [#8786](https://github.com/pingcap/tidb/pull/8786) @@ -37,7 +37,7 @@ category: Releases - 支持 `SHOW CREATE TABLE` 输出列的字符集 [#9053](https://github.com/pingcap/tidb/pull/9053) - 修复 varchar 最大支持字符数在 `utf8mb4` 下限制的问题 [#8818](https://github.com/pingcap/tidb/pull/8818) - 支持 `ALTER TABLE TRUNCATE TABLE PARTITION` [#9093](https://github.com/pingcap/tidb/pull/9093) - - 修复创建表的时候缺省字符集推算的问题 [#9147](https://github.com/pingcap/tidb/pull/9147) + - 修复创建表的时候缺省字符集推算的问题 [#9147](https://github.com/pingcap/tidb/pull/9147) ## PD diff --git a/v2.1/releases/2.1.4.md b/v2.1/releases/2.1.4.md index defa0c34ce2f..3d4d6340833d 100644 --- a/v2.1/releases/2.1.4.md +++ b/v2.1/releases/2.1.4.md @@ -37,4 +37,4 @@ category: Releases - TiKV 在 import 模式下开启 auto compactions [#4199](https://github.com/tikv/tikv/pull/4199) - 增加禁用 TiKV periodic Level-1 compaction 参数,因为当 TiKV 集群为 2.1.4 或更高版本时,在导入模式下会自动执行 Level-1 compaction [#119](https://github.com/pingcap/tidb-lightning/pull/119) - 限制 import engines 数量,避免过大占用 importer 磁盘空间 [#119](https://github.com/pingcap/tidb-lightning/pull/119) -+ 数据同步对比统计 (sync-diff-inspector) 支持使用 TiDB 统计信息来划分 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) \ No newline at end of file ++ 数据同步对比统计 (sync-diff-inspector) 支持使用 TiDB 统计信息来划分 chunk [#197](https://github.com/pingcap/tidb-tools/pull/197) diff --git a/v3.0/reference/tools/tidb-binlog/reparo.md b/v3.0/reference/tools/tidb-binlog/reparo.md index 05822dfa15a0..db69dc41ae71 100644 --- a/v3.0/reference/tools/tidb-binlog/reparo.md +++ b/v3.0/reference/tools/tidb-binlog/reparo.md @@ -91,4 +91,4 @@ password = "" > - stop-datetime 和 stop-tso 效果一样,只是时间格式上的区别,用于指定结束恢复的时间点;如果不指定,则恢复到最后一个 binlog 文件的结尾。 > - dest-type 指定目标类型,取值为 `mysql`、`print`。 当值为 `mysql` 时,可以恢复到 MySQL/TiDB 等使用或兼容 MySQL 协议的数据库,需要在配置下面的 [dest-db] 填写数据库信息;当取值为 `print` 的时候,只是打印 binlog 信息,通常用于 debug,以及查看 binlog 的内容,此时不需要填写 `[dest-db]`。 > - replicate-do-db 用于指定恢复的库,不指定的话,则全部都恢复。 -> - replicate-do-table 用于指定要恢复的表,不指定的话,则全部都恢复。 \ No newline at end of file +> - replicate-do-table 用于指定要恢复的表,不指定的话,则全部都恢复。 From 97f24669a30d02135bbba2463ea0a4c90ba86c7a Mon Sep 17 00:00:00 2001 From: yikeke Date: Thu, 11 Jul 2019 15:55:57 +0800 Subject: [PATCH 3/7] FIX CI ISSUES --- .../tools/tidb-lightning/deployment.md | 10 ++--- .../reference/tools/tidb-lightning/monitor.md | 2 +- v2.1/releases/11alpha.md | 6 +-- v2.1/releases/2.1.10.md | 8 ++-- v2.1/releases/2.1.12.md | 4 +- v2.1/releases/2.1.5.md | 2 +- v2.1/releases/2.1.6.md | 12 +++--- v2.1/releases/2.1.7.md | 2 +- v2.1/releases/2.1.8.md | 10 ++--- v2.1/releases/2.1.9.md | 3 +- v2.1/releases/2.1ga.md | 10 ++--- v2.1/releases/204.md | 2 +- v2.1/releases/208.md | 2 +- v2.1/releases/209.md | 2 +- v2.1/releases/21beta.md | 6 +-- v2.1/releases/21rc5.md | 6 +-- v2.1/releases/3.0-ga.md | 30 ++++++------- v2.1/releases/3.0.0-rc.1.md | 42 +++++++++---------- v2.1/releases/3.0.0-rc.3.md | 2 +- v2.1/releases/3.0beta.md | 2 +- v2.1/releases/ga.md | 16 +++---- v2.1/releases/prega.md | 10 ++--- v2.1/releases/rc1.md | 42 +++++++++---------- 23 files changed, 116 insertions(+), 115 deletions(-) diff --git a/v2.1/reference/tools/tidb-lightning/deployment.md b/v2.1/reference/tools/tidb-lightning/deployment.md index 5d507bb1c2c8..385e77538c0d 100644 --- a/v2.1/reference/tools/tidb-lightning/deployment.md +++ b/v2.1/reference/tools/tidb-lightning/deployment.md @@ -36,7 +36,7 @@ category: reference - 32+ 逻辑核 CPU - 40 GB+ 内存 - 1 TB+ SSD 硬盘,IOPS 越高越好(要求 ≥8000) - * 硬盘必须大于最大的 N 个表的大小总和,其中 N = max(index-concurrency, table-concurrency)。 + * 硬盘必须大于最大的 N 个表的大小总和,其中 N = max(index-concurrency, table-concurrency)。 - 使用万兆网卡,带宽需 300 MB/s 以上 - 运行过程中 CPU、I/O 和网络带宽都可能打满,建议单独部署。 @@ -157,9 +157,9 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche 通过以下链接获取 TiDB-Lightning 安装包(需选择与集群相同的版本): -- **v2.1.9**: https://download.pingcap.org/tidb-v2.1.9-linux-amd64.tar.gz -- **v2.0.9**: https://download.pingcap.org/tidb-lightning-v2.0.9-linux-amd64.tar.gz -- 最新 unstable 版本:https://download.pingcap.org/tidb-lightning-test-xx-latest-linux-amd64.tar.gz +- **v2.1.9**:`https://download.pingcap.org/tidb-v2.1.9-linux-amd64.tar.gz` +- **v2.0.9**:`https://download.pingcap.org/tidb-lightning-v2.0.9-linux-amd64.tar.gz` +- 最新 unstable 版本:`https://download.pingcap.org/tidb-lightning-test-xx-latest-linux-amd64.tar.gz` #### 第 3 步:启动 `tikv-importer` @@ -350,7 +350,7 @@ TiDB-Lightning 可随 TiDB 集群一起用 [Ansible 部署](/how-to/deploy/orche null = '\N' # 是否解析字段内反斜线转义符。 backslash-escape = true - # 如果有行以分隔符结尾,删除尾部分隔符。 + # 如果有行以分隔符结尾,删除尾部分隔符。 trim-last-separator = false [tidb] diff --git a/v2.1/reference/tools/tidb-lightning/monitor.md b/v2.1/reference/tools/tidb-lightning/monitor.md index 4bd2caa2709a..62ed75221d6b 100644 --- a/v2.1/reference/tools/tidb-lightning/monitor.md +++ b/v2.1/reference/tools/tidb-lightning/monitor.md @@ -153,7 +153,7 @@ scrape_configs: - **state**:`pending` / `written` / `closed` / `imported` / `altered_auto_inc` / `checksum` / `analyzed` / `completed` - **result**:`success` / `failure` -**`lightning_engines`** (计数器) +- **`lightning_engines`** (计数器) 计算处理后引擎文件的数量以及其状态。标签: diff --git a/v2.1/releases/11alpha.md b/v2.1/releases/11alpha.md index e4c73e4e8783..e7d5f179b235 100644 --- a/v2.1/releases/11alpha.md +++ b/v2.1/releases/11alpha.md @@ -7,7 +7,7 @@ category: Releases 2018 年 1 月 19 日,TiDB 发布 1.1 Alpha 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB - SQL parser - 兼容更多语法 @@ -28,7 +28,7 @@ category: Releases - Server - 支持 PROXY protocol -## PD: +## PD - 增加更多的 API - 支持 TLS @@ -36,7 +36,7 @@ category: Releases - 调度适应不同的 Region size - Fix 了一些调度的 bug -## TiKV: +## TiKV - 支持 Raft learner - 优化 Raft Snapshot,减少 I/O 开销 diff --git a/v2.1/releases/2.1.10.md b/v2.1/releases/2.1.10.md index 050c720cf862..907002e6486e 100644 --- a/v2.1/releases/2.1.10.md +++ b/v2.1/releases/2.1.10.md @@ -18,15 +18,15 @@ TiDB Ansible 版本:2.1.10 - 修复 `Generated Column` 在 `Replace` 或者 `Insert on duplicate update` 语句中的错误行为 [#10385](https://github.com/pingcap/tidb/pull/10385) - 修复 `BETWEEN` 函数在 `DATE`/`DATETIME` 类型比较的一个 bug [#10407](https://github.com/pingcap/tidb/pull/10407) - 修复使用 `SLOW_QUERY` 表查询慢日志时,单行慢日志长度过长导致的报错 [#10412](https://github.com/pingcap/tidb/pull/10412) -- 修复某些情况下 `DATETIME ` 和 `INTERVAL` 相加的结果跟 MySQL 不一致的问题 [#10416](https://github.com/pingcap/tidb/pull/10416),[#10418](https://github.com/pingcap/tidb/pull/10418) +- 修复某些情况下 `DATETIME` 和 `INTERVAL` 相加的结果跟 MySQL 不一致的问题 [#10416](https://github.com/pingcap/tidb/pull/10416),[#10418](https://github.com/pingcap/tidb/pull/10418) - 增加闰年二月的非法时间的检查 [#10417](https://github.com/pingcap/tidb/pull/10417) - 内部的初始化操作限制只在 DDL Owner 中执行,避免了初始化集群的时候出现的大量冲突报错 [#10426](https://github.com/pingcap/tidb/pull/10426) -- 修复 `DESC` 在输出时间戳列的默认值为 `default current_timestamp on update current_timestamp` 时跟 MySQL 不兼容的问题 [#10337](https://github.com/pingcap/tidb/issues/10337) +- 修复 `DESC` 在输出时间戳列的默认值为 `default current_timestamp on update current_timestamp` 时跟 MySQL 不兼容的问题 [#10337](https://github.com/pingcap/tidb/issues/10337) - 修复 `Update` 语句中权限检查出错的问题 [#10439](https://github.com/pingcap/tidb/pull/10439) - 修复 `CHAR` 类型的列在某些情况下 `RANGE` 计算错误导致的错误结果的问题 [#10455](https://github.com/pingcap/tidb/pull/10455) - 避免 `ALTER SHARD_ROW_ID_BITS` 缩小 shard bits 位数在极低概率下,可能导致的数据错误 [#9868](https://github.com/pingcap/tidb/pull/9868) - 修复 `ORDER BY RAND()` 不返回随机数字的问题 [#10064](https://github.com/pingcap/tidb/pull/10064) -- 禁止 `ALTER` 语句修改 DECIMAL 的精度 [#10458](https://github.com/pingcap/tidb/pull/10458) +- 禁止 `ALTER` 语句修改 DECIMAL 的精度 [#10458](https://github.com/pingcap/tidb/pull/10458) - 修复 `TIME_FORMAT` 函数与 MySQL 的兼容问题 [#10474](https://github.com/pingcap/tidb/pull/10474) - 检查 `PERIOD_ADD` 中参数的合法性 [#10430](https://github.com/pingcap/tidb/pull/10430) - 修复非法的 `YEAR` 字符串在 TiDB 中的表现跟 MySQL 不兼容的问题 [#10493](https://github.com/pingcap/tidb/pull/10493) @@ -45,7 +45,7 @@ TiDB Ansible 版本:2.1.10 - 拒绝在最近发生过成员变更的 Region 上执行 transfer leader,防止迁移失败 [#4684](https://github.com/tikv/tikv/pull/4684) - Coprocessor metrics 上添加 priority 标签 [#4643](https://github.com/tikv/tikv/pull/4643) - 修复 transfer leader 中可能发生的脏读问题 [#4724](https://github.com/tikv/tikv/pull/4724) -- 修复某些情况下 `CommitMerge` 导致 TiKV 不能重启的问题 [#4615](https://github.com/tikv/tikv/pull/4615) +- 修复某些情况下 `CommitMerge` 导致 TiKV 不能重启的问题 [#4615](https://github.com/tikv/tikv/pull/4615) - 修复 unknown 的日志 [#4730](https://github.com/tikv/tikv/pull/4730) ## Tools diff --git a/v2.1/releases/2.1.12.md b/v2.1/releases/2.1.12.md index 1dc21fd7703e..4461812971e9 100644 --- a/v2.1/releases/2.1.12.md +++ b/v2.1/releases/2.1.12.md @@ -25,8 +25,8 @@ TiDB Ansible 版本:2.1.12 - 修复某些情况下 `DECIMAL` 转换成浮点数的溢出问题 [#10730](https://github.com/pingcap/tidb/pull/10730) - 修复 TiDB 跟 TiKV 在 gRPC 最大封包设置不一致导致的某些超大封包报 "grpc: received message larger than max" 错误的问题 [#10710](https://github.com/pingcap/tidb/pull/10710) - 修复某些情况下 `ORDER BY` 没有过滤 NULL 值导致的 panic 问题 [#10488](https://github.com/pingcap/tidb/pull/10488) -- 修复 `UUID` 函数的返回值,在多机器情况可能出现重复的问题 [#10711](https://github.com/pingcap/tidb/pull/10711) -- `CAST(-num as datetime)` 的返回值由错误变更为 NULL 值 [#10703](https://github.com/pingcap/tidb/pull/10703) +- 修复 `UUID` 函数的返回值,在多机器情况可能出现重复的问题 [#10711](https://github.com/pingcap/tidb/pull/10711) +- `CAST(-num as datetime)` 的返回值由错误变更为 NULL 值 [#10703](https://github.com/pingcap/tidb/pull/10703) - 修复某些情况下 unsigned 列直方图遇到 signed 越界的问题 [#10695](https://github.com/pingcap/tidb/pull/10695) - 修复统计信息的 feedback 遇到 bigint unsigned 主键时处理不正确导致读数据时报错的问题 [#10307](https://github.com/pingcap/tidb/pull/10307) - 修复分区表某些情况下 `Show Create Table` 结果显示不正确的问题 [#10690](https://github.com/pingcap/tidb/pull/10690) diff --git a/v2.1/releases/2.1.5.md b/v2.1/releases/2.1.5.md index 0ac3d6077ce4..fd8096a24496 100644 --- a/v2.1/releases/2.1.5.md +++ b/v2.1/releases/2.1.5.md @@ -48,7 +48,7 @@ category: Releases ## Tools -+ Lightning ++ Lightning - 集群中有 Tombstone store 时 Lightning 不会再报错退出 [#4223](https://github.com/tikv/tikv/pull/4223) + TiDB-Binlog - 修正 DDL Binlog 同步方案,确保 DDL 同步的正确性 [#9304](https://github.com/pingcap/tidb/issues/9304) diff --git a/v2.1/releases/2.1.6.md b/v2.1/releases/2.1.6.md index 4f5a58b89d15..a436e3e62cd8 100644 --- a/v2.1/releases/2.1.6.md +++ b/v2.1/releases/2.1.6.md @@ -13,18 +13,18 @@ category: Releases - 当两个表在 `TIDB_INLJ` 的 Hint 中时,基于代价来选择外表 [#9615](https://github.com/pingcap/tidb/pull/9615) - 修复在某些情况下,没有正确选择 IndexScan 的问题 [#9587](https://github.com/pingcap/tidb/pull/9587) - 修复聚合函数在子查询里面的检查跟 MySQL 不兼容的行为 [#9551](https://github.com/pingcap/tidb/pull/9551) - - 使 `show stats_histograms` 语句只输出合法的列,避免 Panic [#9502](https://github.com/pingcap/tidb/pull/9502) + - 使 `show stats_histograms` 语句只输出合法的列,避免 Panic [#9502](https://github.com/pingcap/tidb/pull/9502) + Server - 支持变量 `log_bin`,用于开启/关闭 Binlog [#9634](https://github.com/pingcap/tidb/pull/9634) - 在事务中添加一个防御性检查,避免错误的事务提交 [#9559](https://github.com/pingcap/tidb/pull/9559) - - 修复设置变量导致的 Panic 的问题 [#9539](https://github.com/pingcap/tidb/pull/9539) + - 修复设置变量导致的 Panic 的问题 [#9539](https://github.com/pingcap/tidb/pull/9539) + DDL - 修复 Create Table Like 语句在某些情况导致 Panic 的问题 [#9652](https://github.com/pingcap/tidb/pull/9652) - 打开 etcd client 的 AutoSync 特性,防止某些情况下 TiDB 无法连接上 etcd 的问题 [#9600](https://github.com/pingcap/tidb/pull/9600) ## TiKV -- 修复在某些情况下解析 protobuf 失败导致 `StoreNotMatch` 错误的问题 [#4303](https://github.com/tikv/tikv/pull/4303) +- 修复在某些情况下解析 protobuf 失败导致 `StoreNotMatch` 错误的问题 [#4303](https://github.com/tikv/tikv/pull/4303) ## Tools @@ -33,6 +33,6 @@ category: Releases - 保存原先在内存中的中间状态的 SST 到磁盘,减少内存使用 [#4369](https://github.com/tikv/tikv/pull/4369) - 限制 RocksDB 的内存使用 [#4369](https://github.com/tikv/tikv/pull/4369) - 修复 Region 还没有调度完成时进行 scatter 的问题 [#4369](https://github.com/tikv/tikv/pull/4369) - - 将大表的数据和索引分离导入,在分批导入时能有效降低耗时 [#132](https://github.com/pingcap/tidb-lightning/pull/132) - - 支援 CSV [#111](https://github.com/pingcap/tidb-lightning/pull/111) - - 修复库名中含非英数字符时导入失败的错误 [#9547](https://github.com/pingcap/tidb/pull/9547) + - 将大表的数据和索引分离导入,在分批导入时能有效降低耗时 [#132](https://github.com/pingcap/tidb-lightning/pull/132) + - 支援 CSV [#111](https://github.com/pingcap/tidb-lightning/pull/111) + - 修复库名中含非英数字符时导入失败的错误 [#9547](https://github.com/pingcap/tidb/pull/9547) diff --git a/v2.1/releases/2.1.7.md b/v2.1/releases/2.1.7.md index 409ff4afbcd3..ae7d1dca5ebd 100644 --- a/v2.1/releases/2.1.7.md +++ b/v2.1/releases/2.1.7.md @@ -25,7 +25,7 @@ TiDB-Ansible 版本:2.1.7 - 支持插件机制 [#9880](https://github.com/pingcap/tidb/pull/9880),[#9888](https://github.com/pingcap/tidb/pull/9888) - 支持使用系统变量 `log_bin` 查看 binlog 开启状况 [#9634](https://github.com/pingcap/tidb/pull/9634) - 支持使用 SQL 语句查看 Pump/Drainer 状态 [#9896](https://github.com/pingcap/tidb/pull/9896) -- 修复升级时对 utf8 检查 mb4 字符的兼容性 [#9887](https://github.com/pingcap/tidb/pull/9887) +- 修复升级时对 utf8 检查 mb4 字符的兼容性 [#9887](https://github.com/pingcap/tidb/pull/9887) - 修复某些情况下对 JSON 数据的聚合函数在计算过程中 Panic 的问题 [#9927](https://github.com/pingcap/tidb/pull/9927) ## PD diff --git a/v2.1/releases/2.1.8.md b/v2.1/releases/2.1.8.md index 40ad9491711c..6856212e6301 100644 --- a/v2.1/releases/2.1.8.md +++ b/v2.1/releases/2.1.8.md @@ -15,7 +15,7 @@ TiDB-Ansible 版本:2.1.8 - 修复 `GROUP_CONCAT` 函数在参数存在 NULL 值情况下与 MySQL 处理逻辑不兼容的问题 [#9930](https://github.com/pingcap/tidb/pull/9930) - 修复在 Distinct 模式下 decimal 类型值之间相等比较的问题 [#9931](https://github.com/pingcap/tidb/pull/9931) -- 修复 `SHOW FULL COLUMNS` 语句在 date,datetime,timestamp 类型的 Collation 的兼容性问题 +- 修复 `SHOW FULL COLUMNS` 语句在 date,datetime,timestamp 类型的 Collation 的兼容性问题 - [#9938](https://github.com/pingcap/tidb/pull/9938) - [#10114](https://github.com/pingcap/tidb/pull/10114) - 修复过滤条件存在关联列的时候统计信息估算行数不准确的问题 [#9937](https://github.com/pingcap/tidb/pull/9937) @@ -37,16 +37,16 @@ TiDB-Ansible 版本:2.1.8 ## PD -- 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) +- 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) - 修复 store 读热点的 key 统计不正确问题 [#1487](https://github.com/pingcap/pd/pull/1487) -- 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) -- 添加 PD server 端处理 TSO 请求的耗时 metrics [#1502](https://github.com/pingcap/pd/pull/1502) +- 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) +- 添加 PD server 端处理 TSO 请求的耗时 metrics [#1502](https://github.com/pingcap/pd/pull/1502) ## TiKV - 修复读流量统计错误的问题 [#4441](https://github.com/tikv/tikv/pull/4441) - 修复 Region 数过多的情况下 raftstore 的性能问题 [#4484](https://github.com/tikv/tikv/pull/4484) -- 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) +- 调整当 level 0 SST 数量超过 `level_zero_slowdown_writes_trigger/2` 时不再继续 ingest file [#4464](https://github.com/tikv/tikv/pull/4464) ## Tools diff --git a/v2.1/releases/2.1.9.md b/v2.1/releases/2.1.9.md index 2afc56c9c84d..0c93255fd006 100644 --- a/v2.1/releases/2.1.9.md +++ b/v2.1/releases/2.1.9.md @@ -38,7 +38,8 @@ TiDB-Ansible 版本:2.1.9 - 修复慢语句中带有 `#` 字符的问题 [#10275](https://github.com/pingcap/tidb/pull/10275) - 增加一些信息的列到慢查询的内存表 [#10317](https://github.com/pingcap/tidb/pull/10317) - 将事务提交时间算入慢语句执行时间 [#10310](https://github.com/pingcap/tidb/pull/10310) - - 修复某些时间格式无法被 pt-query-digest 解析的问题 [#10323](https://github.com/pingcap/tidb/pull/10323) + - 修复某些时间格式无法被 pt-query-digest 解析的问题 [#10323](https://github.com/pingcap/tidb/pull/10323) + ## PD - 支持 GetOperator 服务 [#1514](https://github.com/pingcap/pd/pull/1514) diff --git a/v2.1/releases/2.1ga.md b/v2.1/releases/2.1ga.md index d58d54f26795..2f0967269806 100644 --- a/v2.1/releases/2.1ga.md +++ b/v2.1/releases/2.1ga.md @@ -81,8 +81,8 @@ category: Releases - 支持更多 MySQL 语法 - `BIT` 聚合函数支持 `ALL` 参数 - 支持 `SHOW PRIVILEGES` 语句 - - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 - - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 + - 支持 `LOAD DATA` 语句的 `CHARACTER SET` 语法 + - 支持 `CREATE USER` 语句的 `IDENTIFIED WITH` 语法 - 支持 `LOAD DATA IGNORE LINES` 语句 - `Show ProcessList` 语句返回更准确信息 @@ -125,7 +125,7 @@ category: Releases + 监控 - - 增加 `Filter `相关的监控 + - 增加 `Filter` 相关的监控 - 新增 etcd Raft 状态机相关监控 + 性能优化 @@ -179,8 +179,8 @@ category: Releases ## 升级兼容性说明 -- 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 -- 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 ++ 由于新版本存储引擎更新,不支持在升级后回退至 2.0.x 或更旧版本 ++ 从 2.0.6 之前的版本升级到 2.1 之前,最好确认集群中是否存在正在运行中的 DDL 操作,特别是耗时的 Add Index 操作,等 DDL 操作完成后再执行升级操作 + 因为 2.1 版本启用了并行 DDL,对于早于 2.0.1 版本的集群,无法滚动升级到 2.1,可以选择下面两种方案: - 停机升级,直接从早于 2.0.1 的 TiDB 版本升级到 2.1 diff --git a/v2.1/releases/204.md b/v2.1/releases/204.md index 5266b12a38d6..23aa7846b142 100644 --- a/v2.1/releases/204.md +++ b/v2.1/releases/204.md @@ -15,7 +15,7 @@ category: Releases - 优化查询代价估计精度 - 设置 gRPC 的 `backoff max delay` 参数 - 支持通过配置文件设置单条语句的内存使用阈值 -- 重构 Optimizer 的 error +- 重构 Optimizer 的 error - 解决 Cast Decimal 数据的副作用问题 - 解决特定场景下 `Merge Join` 算子结果错误的问题 - 解决转换 `Null` 对象到 String 的问题 diff --git a/v2.1/releases/208.md b/v2.1/releases/208.md index 196c95d90053..1e1e1791c1d1 100644 --- a/v2.1/releases/208.md +++ b/v2.1/releases/208.md @@ -17,7 +17,7 @@ category: Releases - 修复 `duplicate key update` 在某些情况下没有正确插入值的问题 [#7685](https://github.com/pingcap/tidb/pull/7685) - 修复 `UnionScan` 中谓词条件没有下推的问题 [#7726](https://github.com/pingcap/tidb/pull/7726) - 修复增加 `TIMESTAMP` 索引没有正确处理时区的问题 [#7812](https://github.com/pingcap/tidb/pull/7812) - - 修复某些情况下统计信息模块导致的内存泄露问题 [#7864](https://github.com/pingcap/tidb/pull/7864) + - 修复某些情况下统计信息模块导致的内存泄露问题 [#7864](https://github.com/pingcap/tidb/pull/7864) - 修复在某些异常情况下,无法获得 `ANALYZE` 结果的问题 [#7871](https://github.com/pingcap/tidb/pull/7871) - 令 `SYSDATE` 不做表达式展开,以返回正确的结果 [#7894](https://github.com/pingcap/tidb/pull/7894) - 修复某些情况下,`substring_index` panic 的问题 [#7896](https://github.com/pingcap/tidb/pull/7896) diff --git a/v2.1/releases/209.md b/v2.1/releases/209.md index 6484b639bd5b..430587a019a9 100644 --- a/v2.1/releases/209.md +++ b/v2.1/releases/209.md @@ -10,7 +10,7 @@ category: Releases ## TiDB - 修复统计信息直方图为空的时候导致的问题 [#7927](https://github.com/pingcap/tidb/pull/7927) -- 修复 `UNION ALL` 语句在某些情况下 panic 的问题 [#7942](https://github.com/pingcap/tidb/pull/7942) +- 修复 `UNION ALL` 语句在某些情况下 panic 的问题 [#7942](https://github.com/pingcap/tidb/pull/7942) - 修复错误的 DDL JOB 情况下导致的递归溢出问题 [#7959](https://github.com/pingcap/tidb/pull/7959) - 为 `Commit` 操作加上慢操作日志 [#7983](https://github.com/pingcap/tidb/pull/7983) - 修复 `Limit` 值太大的情况下导致的 panic 问题 [#8004](https://github.com/pingcap/tidb/pull/8004) diff --git a/v2.1/releases/21beta.md b/v2.1/releases/21beta.md index 578581d8429d..18cafa4e0de7 100644 --- a/v2.1/releases/21beta.md +++ b/v2.1/releases/21beta.md @@ -41,11 +41,11 @@ category: Releases - 添加 `tidb_disable_txn_auto_retry` 系统变量控制事务是否自动重试 - 修复写入 `time` 类型的数据精度问题 - 支持本地冲突事务排队,优化冲突事务性能 - - 修复 `UPDATE` 语句的 `Affected Rows` + - 修复 `UPDATE` 语句的 `Affected Rows` - 优化 `insert ignore on duplicate key update` 语句性能 - 优化 `Create Table` 语句的执行速度 - 优化 `Add index` 的速度,在某些场景下速度大幅提升 - - 修复 `Alter table add column` 增加列超过表的列数限制的问题 + - 修复 `Alter table add column` 增加列超过表的列数限制的问题 - 修复在某些异常情况下 DDL 任务重试导致 TiKV 压力增加的问题 - 修复在某些异常情况下 TiDB 不断重载 Schema 信息的问题 - DDL @@ -65,7 +65,7 @@ category: Releases - `region merge` 调度时跳过数据行数较多的 Region - 默认开启 `raft learner` 功能,降低调度时出现宕机导致数据不可用的风险 - `pd-recover` 移除 max-replica 参数 -- 增加 `Filter `相关的 metrics +- 增加 `Filter` 相关的 metrics - 修复 tikv-ctl unsafe recovery 之后 Region 信息没更新的问题 - 修复某些场景下副本迁移导致 TiKV 磁盘空间耗尽的问题 - 兼容性提示 diff --git a/v2.1/releases/21rc5.md b/v2.1/releases/21rc5.md index a9d5fc4fb82d..dce12fcb2f69 100644 --- a/v2.1/releases/21rc5.md +++ b/v2.1/releases/21rc5.md @@ -45,9 +45,9 @@ category: Releases - [#1298](https://github.com/pingcap/pd/pull/1298) - [#1299](https://github.com/pingcap/pd/pull/1299) - [#1308](https://github.com/pingcap/pd/pull/1308) -- 修复 `regions/check` API 输出错误的问题 [#1311](https://github.com/pingcap/pd/pull/1311) -- 修复 PD join 失败后无法重新 join 的问题 [#1279](https://github.com/pingcap/pd/pull/1279) -- 修复某些情况下 watch leader 会丢失事件的问题 [#1317](https://github.com/pingcap/pd/pull/1317) ++ 修复 `regions/check` API 输出错误的问题 [#1311](https://github.com/pingcap/pd/pull/1311) ++ 修复 PD join 失败后无法重新 join 的问题 [#1279](https://github.com/pingcap/pd/pull/1279) ++ 修复某些情况下 watch leader 会丢失事件的问题 [#1317](https://github.com/pingcap/pd/pull/1317) ## TiKV diff --git a/v2.1/releases/3.0-ga.md b/v2.1/releases/3.0-ga.md index c1ba491b5e64..2d7962a367a9 100644 --- a/v2.1/releases/3.0-ga.md +++ b/v2.1/releases/3.0-ga.md @@ -119,9 +119,9 @@ TiDB Ansible 版本:3.0.0 ## PD -- 新增从单个节点重建集群的功能 -- 将 Region 元信息从 etcd 移到 go-leveldb 存储引擎,解决大规模集群 etcd 存储瓶颈问题 -+ API ++ 新增从单个节点重建集群的功能 ++ 将 Region 元信息从 etcd 移到 go-leveldb 存储引擎,解决大规模集群 etcd 存储瓶颈问题 ++ API - 新增 `remove-tombstone` 接口,用于清理 Tombstone Store - 新增 `ScanRegions` 接口,用于批量查询 Region 信息 - 新增 `GetOperator` 接口,用于查询运行中的 Operator @@ -148,18 +148,18 @@ TiDB Ansible 版本:3.0.0 ## TiKV -- 新增分布式 GC 以及并行 Resolve Lock 功能,提升 GC 的性能 -- 新增逆向 `raw_scan` 和 `raw_batch_scan` 功能 -- 新增多线程 Raftstore 和 Apply 功能,提升单节点内可扩展性,提升单节点内并发处理能力,提升单节点的资源利用率,降低延时,同等压力情况下性能提升 70% -- 新增批量接收和发送 Raft 消息功能,写入密集的场景 TPS 提升 7% -- 新增 Apply snapshot 之前检查 RocksDB level 0 文件的优化,避免产生 Write stall -- 新增 Titan 存储引擎插件,提升 Value 超过 1KiB 时系统的性能,一定程度上缓解写放大问题(**实验特性**) -- 新增悲观事务模型(**实验特性**) -- 新增通过 HTTP 方式获取监控信息功能 -- 修改 Insert 语义,仅在 Key 不存在的时候 Prewrite 才成功 -- 制定日志格式规范,重构日志系统,方便工具收集分析 -- 新增配置信息,Key 越界相关的性能监控指标 -- RawKV 使用 Local Reader,提升性能 ++ 新增分布式 GC 以及并行 Resolve Lock 功能,提升 GC 的性能 ++ 新增逆向 `raw_scan` 和 `raw_batch_scan` 功能 ++ 新增多线程 Raftstore 和 Apply 功能,提升单节点内可扩展性,提升单节点内并发处理能力,提升单节点的资源利用率,降低延时,同等压力情况下性能提升 70% ++ 新增批量接收和发送 Raft 消息功能,写入密集的场景 TPS 提升 7% ++ 新增 Apply snapshot 之前检查 RocksDB level 0 文件的优化,避免产生 Write stall ++ 新增 Titan 存储引擎插件,提升 Value 超过 1KiB 时系统的性能,一定程度上缓解写放大问题(**实验特性**) ++ 新增悲观事务模型(**实验特性**) ++ 新增通过 HTTP 方式获取监控信息功能 ++ 修改 Insert 语义,仅在 Key 不存在的时候 Prewrite 才成功 ++ 制定日志格式规范,重构日志系统,方便工具收集分析 ++ 新增配置信息,Key 越界相关的性能监控指标 ++ RawKV 使用 Local Reader,提升性能 + Engine - 优化内存管理,减少 `Iterator Key Bound Option` 的内存分配和拷贝,提升性能 - 支持多个 column family 共享 block cache,提升资源的利用率 diff --git a/v2.1/releases/3.0.0-rc.1.md b/v2.1/releases/3.0.0-rc.1.md index 96aea2e59dfe..f5f65e24a61f 100644 --- a/v2.1/releases/3.0.0-rc.1.md +++ b/v2.1/releases/3.0.0-rc.1.md @@ -61,20 +61,20 @@ TiDB-Ansible 版本:3.0.0-rc.1 ## PD -+ 升级 ETCD 版本 [#1452](https://github.com/pingcap/pd/pull/1452) ++ 升级 ETCD 版本 [#1452](https://github.com/pingcap/pd/pull/1452) - 统一 etcd 的日志格式与 pd server 一致 - 修复 prevote 可能无法选出 Leader 的问题 - 快速 drop 掉会失败的 propose 和 read 请求,减少阻塞后面的请求时间 - 修复 Lease 的死锁问题 -- 修复 store 读热点的 keys 统计不正确问题 [#1487](https://github.com/pingcap/pd/pull/1487) -- 支持从单一 PD 节点强制重建 PD 集群 [#1485](https://github.com/pingcap/pd/pull/1485) -- 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) -- 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) -- 热点调度使用高优先级 [#1492](https://github.com/pingcap/pd/pull/1492) -- 添加 PD server 端处理 TSO 请求的耗时 Metrics [#1502](https://github.com/pingcap/pd/pull/1502) -- 添加相对应的 Store ID 和 Address 到 store 相关的 Metrics [#1506](https://github.com/pingcap/pd/pull/1506) -- 支持 GetOperator 服务 [#1477](https://github.com/pingcap/pd/pull/1477) -- 修复 Heartbeat stream 下发送 error 找不到 store 的问题 [#1521](https://github.com/pingcap/pd/pull/1521) ++ 修复 store 读热点的 keys 统计不正确问题 [#1487](https://github.com/pingcap/pd/pull/1487) ++ 支持从单一 PD 节点强制重建 PD 集群 [#1485](https://github.com/pingcap/pd/pull/1485) ++ 修复 Scatter Region 产生无效 Operator Step 的问题 [#1482](https://github.com/pingcap/pd/pull/1482) ++ 修复 Region Merge Operator 超时时间过短的问题 [#1495](https://github.com/pingcap/pd/pull/1495) ++ 热点调度使用高优先级 [#1492](https://github.com/pingcap/pd/pull/1492) ++ 添加 PD server 端处理 TSO 请求的耗时 Metrics [#1502](https://github.com/pingcap/pd/pull/1502) ++ 添加相对应的 Store ID 和 Address 到 store 相关的 Metrics [#1506](https://github.com/pingcap/pd/pull/1506) ++ 支持 GetOperator 服务 [#1477](https://github.com/pingcap/pd/pull/1477) ++ 修复 Heartbeat stream 下发送 error 找不到 store 的问题 [#1521](https://github.com/pingcap/pd/pull/1521) ## TiKV @@ -93,7 +93,7 @@ TiDB-Ansible 版本:3.0.0-rc.1 - 新增 batch index scan executor [#4419](https://github.com/tikv/tikv/pull/4419) - 新增向量化 evaluation 框架 [#4322](https://github.com/tikv/tikv/pull/4322) - 新增 batch 执行器统计框架 [#4433](https://github.com/tikv/tikv/pull/4433) - - 构建 RPN expression 时检查 max column 以防止 evaluation 阶段 column offset 越界的问题 [#4481](https://github.com/tikv/tikv/pull/4481) + - 构建 RPN expression 时检查 max column 以防止 evaluation 阶段 column offset 越界的问题 [#4481](https://github.com/tikv/tikv/pull/4481) - 实现 `BatchLimitExecutor` [#4469](https://github.com/tikv/tikv/pull/4469) - ReadPool 使用 `tokio-threadpool` 替换原本的 `futures-cpupool`,减少 context switch [#4486](https://github.com/tikv/tikv/pull/4486) - 新增 batch 聚合框架 [#4533](https://github.com/tikv/tikv/pull/4533) @@ -120,7 +120,7 @@ TiDB-Ansible 版本:3.0.0-rc.1 - 提升 Lightning encode SQL 性能,性能提升 50%,直接解析数据源文件内容成 TiDB 的 types.Datum,省去 KV encoder 的多余解析工作 [#145](https://github.com/pingcap/tidb-lightning/pull/145) - 日志格式改为 [Unified Log Format](https://github.com/tikv/rfcs/blob/master/text/2018-12-19-unified-log-format.md) [#162](https://github.com/pingcap/tidb-lightning/pull/162) - 新增一些命令行选项,即使缺少配置文件也能使用。[#157](https://github.com/pingcap/tidb-lightning/pull/157) -+ 数据同步对比工具 (sync-diff-inspector) ++ 数据同步对比工具 (sync-diff-inspector) - 支持 checkpoint,记录校验状态,重启后从上次进度继续校验 [#224](https://github.com/pingcap/tidb-tools/pull/224) - 增加配置项 only-use-checksum,只通过计算 checksum 来检查数据是否一致 [#215](https://github.com/pingcap/tidb-tools/pull/215) @@ -130,12 +130,12 @@ TiDB-Ansible 版本:3.0.0-rc.1 - summary 监控适用于用户查看集群状态 - trouble_shooting 监控适用于 DBA 排查问题 - details 监控适用于开发分析问题 -- 修复下载 Kafka 版本 Binlog 失败的 BUG [#730](https://github.com/pingcap/tidb-ansible/pull/730) -- 修改操作系统版本限制,仅支持 CentOS 7.0 及以上,Red Hat 7.0 及以上版本的操作系统 [#733](https://github.com/pingcap/tidb-ansible/pull/733) -- 滚动升级时的版本检测改为多并发 [#736](https://github.com/pingcap/tidb-ansible/pull/736) -- 更新 README 中文档链接[#740](https://github.com/pingcap/tidb-ansible/pull/740) -- 移除重复的 TiKV 监控项,新增 trouble shooting 监控项 [#735](https://github.com/pingcap/tidb-ansible/pull/735) -- 优化 `table-regions.py` 脚本,按表显示 leader 分布 [#739](https://github.com/pingcap/tidb-ansible/pull/739) -- 更新 drainer 配置文件 [#745](https://github.com/pingcap/tidb-ansible/pull/745) -- 优化 TiDB 监控,新增以 SQL 类别显示延迟的监控项 [#747](https://github.com/pingcap/tidb-ansible/pull/747) -- 更新 Lightning 配置文件,新增 tidb_lightning_ctl 脚本 [#1e946f8](https://github.com/pingcap/tidb-ansible/commit/1e946f89908e8fd6ef84128c6da3064ddfccf6a8) ++ 修复下载 Kafka 版本 Binlog 失败的 BUG [#730](https://github.com/pingcap/tidb-ansible/pull/730) ++ 修改操作系统版本限制,仅支持 CentOS 7.0 及以上,Red Hat 7.0 及以上版本的操作系统 [#733](https://github.com/pingcap/tidb-ansible/pull/733) ++ 滚动升级时的版本检测改为多并发 [#736](https://github.com/pingcap/tidb-ansible/pull/736) ++ 更新 README 中文档链接[#740](https://github.com/pingcap/tidb-ansible/pull/740) ++ 移除重复的 TiKV 监控项,新增 trouble shooting 监控项 [#735](https://github.com/pingcap/tidb-ansible/pull/735) ++ 优化 `table-regions.py` 脚本,按表显示 leader 分布 [#739](https://github.com/pingcap/tidb-ansible/pull/739) ++ 更新 drainer 配置文件 [#745](https://github.com/pingcap/tidb-ansible/pull/745) ++ 优化 TiDB 监控,新增以 SQL 类别显示延迟的监控项 [#747](https://github.com/pingcap/tidb-ansible/pull/747) ++ 更新 Lightning 配置文件,新增 tidb_lightning_ctl 脚本 [#1e946f8](https://github.com/pingcap/tidb-ansible/commit/1e946f89908e8fd6ef84128c6da3064ddfccf6a8) diff --git a/v2.1/releases/3.0.0-rc.3.md b/v2.1/releases/3.0.0-rc.3.md index cd15fbc6b70d..141b3c897e54 100644 --- a/v2.1/releases/3.0.0-rc.3.md +++ b/v2.1/releases/3.0.0-rc.3.md @@ -78,7 +78,7 @@ TiDB Ansible 版本:3.0.0-rc.3 - 新增 GC worker 相关监控项 [#4922](https://github.com/tikv/tikv/pull/4922) + Raftstore - - 修复 local reader 的 cache 没有正确清理的问题 [#4778](https://github.com/tikv/tikv/pull/4778) + - 修复 local reader 的 cache 没有正确清理的问题 [#4778](https://github.com/tikv/tikv/pull/4778) - 修复进行 transfer leader 和 conf change 时可能导致请求延迟增加的问题 [#4734](https://github.com/tikv/tikv/pull/4734) - 修复误报 stale command 的问题 [#4682](https://github.com/tikv/tikv/pull/4682) - 修复 command 可能一直 pending 的问题 [#4810](https://github.com/tikv/tikv/pull/4810) diff --git a/v2.1/releases/3.0beta.md b/v2.1/releases/3.0beta.md index 84e1186886b8..229d30aba437 100644 --- a/v2.1/releases/3.0beta.md +++ b/v2.1/releases/3.0beta.md @@ -52,7 +52,7 @@ category: Releases - 优化 `Prepare` 语句,使得 `ORDER BY`/`GROUP BY`/`LIMIT` 子句中可以使用 “?” 占位符 [#8206](https://github.com/pingcap/tidb/pull/8206) + 权限管理 - 增加对 `ANALYZE` 语句的权限检查 [#8486](https://github.com/pingcap/tidb/pull/8486) - - 增加对 `USE` 语句的权限检查 [#8414](https://github.com/pingcap/tidb/pull/8418) + - 增加对 `USE` 语句的权限检查 [#8414](https://github.com/pingcap/tidb/pull/8418) - 增加对 `SET GLOBAL` 语句的权限检查 [#8837](https://github.com/pingcap/tidb/pull/8837) - 增加对 `SHOW PROCESSLIST` 语句的权限检查 [#7858](https://github.com/pingcap/tidb/pull/7858) + Server diff --git a/v2.1/releases/ga.md b/v2.1/releases/ga.md index a8a66ea4463a..65743083591f 100644 --- a/v2.1/releases/ga.md +++ b/v2.1/releases/ga.md @@ -7,12 +7,12 @@ category: Releases 2017 年 10 月 16 日,TiDB 发布 GA 版(TiDB 1.0)。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB + SQL 查询优化器 - - 调整代价模型 - - Analyze 下推 - - 函数签名下推 + - 调整代价模型 + - Analyze 下推 + - 函数签名下推 + 优化内部数据格式,减小中间结果大小 + 提升 MySQL 兼容性 @@ -20,12 +20,12 @@ category: Releases + 重构 Hash Aggregator 算子,降低内存使用 + 支持 Stream Aggragator 算子 -## PD: +## PD + 支持基于读流量的热点调度 + 支持设置 Store 权重,以及基于权重的调度 -## TiKV: +## TiKV + Coprocessor 支持更多下推函数 + 支持取样操作下推 @@ -33,7 +33,7 @@ category: Releases + 提升性能和稳定性 + 增加 Debug API,方便调试 -## TiSpark Beta Release: +## TiSpark Beta Release + 支持可配置框架 + 支持 ThriftSever/JDBC 和 Spark SQL 脚本入口 @@ -53,7 +53,7 @@ category: Releases - 腾讯云 - 韩国三星研究院 -### 感谢以下组织/个人提供出色的开源软件/服务: +### 感谢以下组织/个人提供出色的开源软件/服务 - Asta Xie - CNCF diff --git a/v2.1/releases/prega.md b/v2.1/releases/prega.md index 76eb4fc15232..75d0d1fcfa44 100644 --- a/v2.1/releases/prega.md +++ b/v2.1/releases/prega.md @@ -7,7 +7,7 @@ category: Releases 2017 年 8 月 30 日,TiDB 发布 Pre-GA 版。该版本对 MySQL 兼容性、SQL 优化器、系统稳定性、性能做了大量的工作。 -## TiDB: +## TiDB + SQL 查询优化器 - 调整代价模型 @@ -18,20 +18,20 @@ category: Releases + 完成 JSON 类型支持 (Experimental),包括对 JSON 中的字段查询、更新、建索引 + 裁剪无用数据,减小执行器内存消耗 + 支持在 SQL 语句中设置优先级,并根据查询类型自动设置部分语句的优先级 -+ 完成表达式重构,执行速度提升 30% 左右 ++ 完成表达式重构,执行速度提升 30% 左右 -## PD: +## PD + 支持手动切换 PD 集群 Leader -## TiKV: +## TiKV + Raft Log 使用独立的 RocksDB 实例 + 使用 DeleteRange 加快删除副本速度 + Coprocessor 支持更多运算符下推 + 提升性能,提升稳定性 -## TiSpark Beta Release: +## TiSpark Beta Release + 支持谓词下推 + 支持聚合下推 diff --git a/v2.1/releases/rc1.md b/v2.1/releases/rc1.md index b763d946cf4e..20e24a1d6ae8 100644 --- a/v2.1/releases/rc1.md +++ b/v2.1/releases/rc1.md @@ -9,33 +9,33 @@ category: Releases ## TiKV - + 提升写入速度 - + 降低磁盘空间占用 - + 支持百 TB 级别数据 - + 提升稳定性,集群规模支持 200 个节点 - + 提供 Raw KV API,以及 Golang client ++ 提升写入速度 ++ 降低磁盘空间占用 ++ 支持百 TB 级别数据 ++ 提升稳定性,集群规模支持 200 个节点 ++ 提供 Raw KV API,以及 Golang client ## PD - + PD 调度策略框架优化,策略更加灵活合理 - + 添加 label 支持,支持跨 DC 调度 - + 提供 PD Controler,方便操作 PD 集群 ++ PD 调度策略框架优化,策略更加灵活合理 ++ 添加 label 支持,支持跨 DC 调度 ++ 提供 PD Controler,方便操作 PD 集群 ## TiDB - + SQL 查询优化器 - - 支持 eager aggregate - - 更详细的 explain 信息 - - union 算子并行化 - - 子查询性能优化 - - 条件下推优化 - - 优化 CBO 框架 - + 重构 time 相关类型的实现,提升和 MySQL 的兼容性 - + 支持更多的 MySQL 内建函数 - + Add Index 语句提速 - + 支持用 change column 语句修改列名;支持使用 Alter table 的 modify column 和 change column 完成部分列类型转换 ++ SQL 查询优化器 + - 支持 eager aggregate + - 更详细的 explain 信息 + - union 算子并行化 + - 子查询性能优化 + - 条件下推优化 + - 优化 CBO 框架 ++ 重构 time 相关类型的实现,提升和 MySQL 的兼容性 ++ 支持更多的 MySQL 内建函数 ++ Add Index 语句提速 ++ 支持用 change column 语句修改列名;支持使用 Alter table 的 modify column 和 change column 完成部分列类型转换 ## 工具 - + Loader:兼容 Percona 的 mydumper 数据格式,提供多线程导入、出错重试、断点续传等功能,并且针对 TiDB 有优化 - + 开发完成一键部署工具 ++ Loader:兼容 Percona 的 mydumper 数据格式,提供多线程导入、出错重试、断点续传等功能,并且针对 TiDB 有优化 ++ 开发完成一键部署工具 From 3780ca3b90a47b228bcac7bf4d89dc230265c248 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Thu, 11 Jul 2019 16:34:38 +0800 Subject: [PATCH 4/7] v1.0: remove a duplicate metric --- v1.0/tools/syncer.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/v1.0/tools/syncer.md b/v1.0/tools/syncer.md index 454914fc93b9..9d250a936f9f 100755 --- a/v1.0/tools/syncer.md +++ b/v1.0/tools/syncer.md @@ -480,11 +480,6 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `irate(syncer_binlog_events_total[1m])` - info: Syncer 已经同步到的 master binlog 相关信息统计,主要有 `query`,`rotate`,`update_rows`,`write_rows`,`delete_rows` 五种类型 -#### title: syncer_binlog_file - -- metrics: `syncer_binlog_file` -- info: Syncer 同步 master binlog 的文件数量 - #### title: binlog pos - metrics: `syncer_binlog_pos` @@ -495,7 +490,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_gtid` - info: Syncer 同步当前 master binlog 的 binlog-gtid 信息 -#### title: syncer_binlog_file (new) +#### title: syncer_binlog_file - metrics: `syncer_binlog_file{node="master"} - ON(instance, job) syncer_binlog_file{node="syncer"}` - info: 上游与下游同步时,相差的 binlog 文件数量,正常状态为 0,表示数据正在实时同步。数值越大,表示相差的 binlog 文件数量越多。 From 3e3ee5690f7dbb7c75f38ae1d464b0b297af1ac3 Mon Sep 17 00:00:00 2001 From: Keke Yi <40977455+yikeke@users.noreply.github.com> Date: Thu, 11 Jul 2019 16:35:12 +0800 Subject: [PATCH 5/7] improve wording Co-Authored-By: Lilian Lee --- .github/ISSUE_TEMPLATE/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index cdaa2d5cfe02..1cb2350b6c03 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -19,6 +19,6 @@ Before asking a question, make sure you have: - Searched open and closed [GitHub issues](https://github.com/pingcap/docs-cn/issues?utf8=%E2%9C%93&q=is%3Aissue). - Read the documentation: - - [TiDB Doc](https://github.com/pingcap/docs) + - [TiDB Docs](https://github.com/pingcap/docs) - [TiDB Doc-cn](https://github.com/pingcap/docs-cn) From 9a5387d615303b2dab81a307d6752c0094f3ebe6 Mon Sep 17 00:00:00 2001 From: Keke Yi <40977455+yikeke@users.noreply.github.com> Date: Thu, 11 Jul 2019 16:35:27 +0800 Subject: [PATCH 6/7] improve wording Co-Authored-By: Lilian Lee --- .github/ISSUE_TEMPLATE/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 1cb2350b6c03..b9911c0f9e27 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -20,5 +20,5 @@ Before asking a question, make sure you have: - Read the documentation: - [TiDB Docs](https://github.com/pingcap/docs) - - [TiDB Doc-cn](https://github.com/pingcap/docs-cn) + - [TiDB Docs-cn](https://github.com/pingcap/docs-cn) From 0dcda0586637d5accbfeeee241f44da0a6612c08 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Thu, 11 Jul 2019 16:35:51 +0800 Subject: [PATCH 7/7] v2.0: remove a duplicate metric --- v2.0/tools/syncer.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/v2.0/tools/syncer.md b/v2.0/tools/syncer.md index 3fa8d620e1a6..970edc7fc4bd 100755 --- a/v2.0/tools/syncer.md +++ b/v2.0/tools/syncer.md @@ -480,11 +480,6 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `irate(syncer_binlog_events_total[1m])` - info: Syncer 已经同步到的 master binlog 相关信息统计,主要有 `query`,`rotate`,`update_rows`,`write_rows`,`delete_rows` 五种类型 -#### title: syncer_binlog_file - -- metrics: `syncer_binlog_file` -- info: Syncer 同步 master binlog 的文件数量 - #### title: binlog pos - metrics: `syncer_binlog_pos` @@ -495,7 +490,7 @@ Syncer 对外提供 metric 接口,需要 Prometheus 主动获取数据。配 - metrics: `syncer_gtid` - info: Syncer 同步当前 master binlog 的 binlog-gtid 信息 -#### title: syncer_binlog_file (new) +#### title: syncer_binlog_file - metrics: `syncer_binlog_file{node="master"} - ON(instance, job) syncer_binlog_file{node="syncer"}` - info: 上游与下游同步时,相差的 binlog 文件数量,正常状态为 0,表示数据正在实时同步。数值越大,表示相差的 binlog 文件数量越多。