From 68ba709a8e73c35445435a6deb896d0875f771ca Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:06:58 +0800 Subject: [PATCH 01/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 127 ++++++++++++++++++++++++++++++--------- 1 file changed, 100 insertions(+), 27 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index e5569452bfcb..42f62cbc666d 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -6,9 +6,9 @@ aliases: ['/docs-cn/dev/how-to/scale/with-tiup/'] # 使用 TiUP 扩容缩容 TiDB 集群 -TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。 +TiDB 集群可以在不中断线上服务的情况下进行扩容和缩容。 -本文介绍如何使用 TiUP 扩容缩容集群中的 TiDB、TiKV、PD、TiCDC 或者 TiFlash 节点。如未安装 TiUP,可参考[升级文档中的步骤](/upgrade-tidb-using-tiup.md#2-在中控机器上安装-tiup),将集群 import 到 TiUP 环境中,再进行扩容缩容。 +本文介绍如何使用 TiUP 扩容缩容集群中的 TiDB、TiKV、PD、TiCDC 或者 TiFlash 节点。如未安装 TiUP,可参考[升级文档中的步骤](/upgrade-tidb-using-tiup.md#2-在中控机器上安装-tiup),将集群 Import 到 TiUP 环境中,再使用进行扩容缩容。 你可以通过 `tiup cluster list` 查看当前的集群名称列表。 @@ -28,13 +28,13 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。 > **注意:** > -> 添加 TiKV、PD、TiCDC 节点和添加 TiDB 节点的步骤类似。 +> 添加 PD、TiCDC 节点和添加 TiDB 节点的步骤类似。添加 TiKV 节点前,建议预先根据集群的负载情况调整 PD 调度参数。 ### 1.1 编写扩容拓扑配置 > **注意:** > -> 默认情况下,可以不填端口信息。但在单机多实例场景下,你需要分配不同的端口,如果有端口或目录冲突,会在部署或扩容时提醒。 +> 默认情况下,可以不填写端口以及目录信息。但在单机多实例场景下,则需要分配不同的端口以及目录,如果有端口或目录冲突,会在部署或扩容时提醒。 在 scale-out.yaml 文件添加扩容拓扑配置: @@ -44,7 +44,9 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。 vi scale-out.yaml ``` -``` +{{< copyable "" >}} + +```ini tidb_servers: - host: 10.0.1.5 @@ -54,19 +56,59 @@ tidb_servers: port: 4000 status_port: 10080 + + deploy_dir: /data/deploy/install/deploy/tidb-4000 + + log_dir: /data/deploy/install/log/tidb-4000 ``` +TiKV 配置文件参考: -你可以使用 `tiup cluster edit-config ` 查看当前集群的整体配置,其中 global 和 server_configs 的全局配置也会在 `scale-out.yaml` 中生效。 +{{< copyable "" >}} + +```ini +tikv_servers: + + - host: 10.0.1.5 + + ssh_port: 22 + + port: 20160 + + status_port: 20180 + + deploy_dir: /data/deploy/install/deploy/tikv-20160 + + data_dir: /data/deploy/install/data/tikv-20160 + + log_dir: /data/deploy/install/log/tikv-20160 +``` +PD 配置文件参考: + +{{< copyable "" >}} + +```ini +pd_servers: + + - host: 10.0.1.5 + + ssh_port: 22 + + name: pd-1 + + client_port: 2379 + + peer_port: 2380 + + deploy_dir: /data/deploy/install/deploy/pd-2379 + + data_dir: /data/deploy/install/data/pd-2379 + + log_dir: /data/deploy/install/log/pd-2379 +``` + +可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 global 和 server_configs 参数配置,默认会被 `scale-out.yaml` 继承。 -配置后,集群现拓扑结构如下所示: -| 主机 IP | 服务 | -|:----|:----| -| 10.0.1.3 | TiDB + TiFlash  | -| 10.0.1.4 | TiDB + PD | -| 10.0.1.5 | **TiDB** + TiKV + Monitor | -| 10.0.1.1 | TiKV  | -| 10.0.1.2 | TiKV  | ### 1.2 执行扩容命令 @@ -78,6 +120,7 @@ tiup cluster scale-out scale-out.yaml 预期输出 Scaled cluster `` out successfully 信息,表示扩容操作成功。 + ### 1.3 检查集群状态 {{< copyable "shell-regular" >}} @@ -86,7 +129,17 @@ tiup cluster scale-out scale-out.yaml tiup cluster display ``` -打开浏览器访问监控平台 ,监控整个集群和新增节点的状态。 +打开浏览器访问监控平台 ,监控整个集群和新增节点的状态。 + +扩容后,集群拓扑结构如下所示: + +| 主机 IP | 服务 | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash  | +| 10.0.1.4 | TiDB + PD | +| 10.0.1.5 | **TiDB** + TiKV + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | ## 2. 扩容 TiFlash 节点 @@ -119,11 +172,21 @@ tiup cluster scale-out scale-out.yaml tiup cluster display ``` -打开浏览器访问监控平台 ,监控整个集群和新增节点的状态。 +打开浏览器访问监控平台 ,监控整个集群和新增节点的状态。 + +扩容后,集群拓扑结构如下所示: + +| 主机 IP | 服务 | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash  | +| 10.0.1.4 | TiDB + PD + **TiFlash** | +| 10.0.1.5 | TiDB+ TiKV + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | ## 3. 缩容 TiDB/TiKV/PD/TiCDC 节点 -如果要移除一个 TiKV 节点,IP 地址为 10.0.1.5,可以按照如下步骤进行操作。 +如果要移除 IP 地址为 10.0.1.5 的一个 TiKV 节点,可以按照如下步骤进行操作。 > **注意:** > @@ -166,11 +229,11 @@ ID              Role Host        Ports 10.0.1.4:9000 tiflash 10.0.1.4 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 -10.0.1.5:9290   prometheus 10.0.1.5 9290 Up data/prometheus-9290    deploy/prometheus-9290 +10.0.1.5:9090   prometheus 10.0.1.5 9090 Up data/prometheus-9090    deploy/prometheus-9090 -10.0.1.5:3200   grafana 10.0.1.5 3200 Up -                       deploy/grafana-3200 +10.0.1.5:3000   grafana 10.0.1.5 3000 Up -                       deploy/grafana-3000 -10.0.1.5:9293   alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293  deploy/alertmanager-9293 +10.0.1.5:9093   alertmanager 10.0.1.5 9093/9094 Up data/alertmanager-9093  deploy/alertmanager-9093 ``` ### 3.2 执行缩容操作 @@ -197,7 +260,9 @@ tiup cluster scale-in --node 10.0.1.5:20160 tiup cluster display ``` -现拓扑结构如下: +打开浏览器访问监控平台 ,监控整个集群的状态。 + +调整后,拓扑结构如下: | Host IP | Service | |:----|:----| @@ -207,11 +272,9 @@ tiup cluster display | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | -打开浏览器访问监控平台 ,监控整个集群的状态。 - ## 4. 缩容 TiFlash 节点 -如果要下线一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 +如果要缩容 IP 地址为 10.0.1.4 的一个 TiFlash 节点,,可以按照如下步骤进行操作。 > **注意:** > @@ -225,9 +288,9 @@ tiup cluster display 使用 Grafana 或者 pd-ctl 检查节点是否下线成功(下线需要一定时间)。 -### 4.3 关闭 TiFlash 进程 +### 4.3 缩容 TiFlash -等待 TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后,执行如下命令关闭 TiFlash 进程: +TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后,表示 TiFlash 节点已经下线成功,这个时候可以执行如下命令缩容 TiFlash : {{< copyable "shell-regular" >}} @@ -243,4 +306,14 @@ tiup cluster scale-in --node 10.0.1.4:9000 tiup cluster display ``` -打开浏览器访问监控平台 ,监控整个集群的状态。 +打开浏览器访问监控平台 ,监控整个集群的状态。 + +调整后,拓扑结构如下: + +| Host IP | Service | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash  | +| 10.0.1.4 | TiDB + PD**(TiFlash 已删除)** | +| 10.0.1.5 | TiDB + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | From ad8e33d8b152dd43e4f50e4e9c5f3da3263443b4 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:24:44 +0800 Subject: [PATCH 02/29] Create production-offline-deployment-using-tiup.md --- production-offline-deployment-using-tiup.md | 372 ++++++++++++++++++++ 1 file changed, 372 insertions(+) create mode 100644 production-offline-deployment-using-tiup.md diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md new file mode 100644 index 000000000000..f0819d3cfb35 --- /dev/null +++ b/production-offline-deployment-using-tiup.md @@ -0,0 +1,372 @@ +--- +title: 使用 TiUP 离线部署 TiDB 集群 +category: how-to +aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] +--- + + + +# 使用 TiUP 离线部署 TiDB 集群 + +### 1. 部署在线环境 TiUP 组件 + +使用普通用户登录一台与外网相同的机器: + +1. 执行如下命令安装 TiUP 工具: + + {{< copyable "shell-regular" >}} + + ```shell + curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh + ``` +2. 重新声明全局环境变量: + + {{< copyable "shell-regular" >}} + + ```shell + source .bash_profile + ``` +3. 确认 TiUP 工具是否安装: + + {{< copyable "shell-regular" >}} + + ```shell + which tiup + ``` + +### 2. 使用 TiUP 拉取镜像 + +以 tidb 用户在隔离的环境中安装一个 v4.0.0-rc 的 TiDB 集群为例,可以执行以下步骤: + +1. 在一台和外网相通的机器上拉取需要的组件: + + {{< copyable "shell-regular" >}} + + ```bash + tiup mirrors package --os=linux v4.0.0-rc + ``` + + 该命令会在当前目录下创建一个名叫 `package` 的目录,里面有启动一个集群必要的组件包。 + +2. 通过 tar 命令将该组件包打包然后发送到隔离环境的中控机: + + {{< copyable "shell-regular" >}} + + ```bash + tar czvf package.tar.gz package + ``` + + 此时,`package.tar.gz` 就是一个独立的离线环境包。 + +### 3. 部署离线环境 TiUP 组件 + +1. 将包发送到目标集群的中控机后,执行以下命令安装 TiUP 组件: + + {{< copyable "shell-regular" >}} + ```bash + tar xzvf package.tar.gz + + cd package + + sh local_install.sh + + source /home/tidb/.bash_profile + ``` + + +### 4. TiKV 数据盘挂载 + +> **注意:** +> +> 推荐 TiKV 部署目标机器的数据目录使用 EXT4 文件系统格式。相比于 XFS 文件系统格式,EXT4 文件系统格式在 TiDB 集群部署案例较多,生产环境优先选择使用 EXT4 文件系统格式。 + +使用 `root` 用户登录目标机器,将部署目标机器数据盘格式化成 ext4 文件系统,挂载时添加 `nodelalloc` 和 `noatime` 挂载参数。`nodelalloc` 是必选参数,否则 TiUP 安装时检测无法通过;`noatime` 是可选建议参数。 + +> **注意:** +> +> 如果你的数据盘已经格式化成 ext4 并挂载了磁盘,可先执行 `umount /dev/nvme0n1p1` 命令卸载,从编辑 `/etc/fstab` 文件步骤开始执行,添加挂载参数重新挂载即可。 + +以 `/dev/nvme0n1` 数据盘为例,具体操作步骤如下: + +1. 查看数据盘。 + + {{< copyable "shell-root" >}} + + ```bash + fdisk -l + ``` + + ``` + Disk /dev/nvme0n1: 1000 GB + ``` + +2. 创建分区表。 + + {{< copyable "shell-root" >}} + + ```bash + parted -s -a optimal /dev/nvme0n1 mklabel gpt -- mkpart primary ext4 1 -1 + ``` + + > **注意:** + > + > 使用 `lsblk` 命令查看分区的设备号:对于 nvme 磁盘,生成的分区设备号一般为 `nvme0n1p1`;对于普通磁盘(例如 `/dev/sdb`),生成的的分区设备号一般为 `sdb1`。 + +3. 格式化文件系统。 + + {{< copyable "shell-root" >}} + + ```bash + mkfs.ext4 /dev/nvme0n1p1 + ``` + +4. 查看数据盘分区 UUID。 + + 本例中 `nvme0n1p1` 的 UUID 为 `c51eb23b-195c-4061-92a9-3fad812cc12f`。 + + {{< copyable "shell-root" >}} + + ```bash + lsblk -f + ``` + + ``` + NAME FSTYPE LABEL UUID MOUNTPOINT + sda + ├─sda1 ext4 237b634b-a565-477b-8371-6dff0c41f5ab /boot + ├─sda2 swap f414c5c0-f823-4bb1-8fdf-e531173a72ed + └─sda3 ext4 547909c1-398d-4696-94c6-03e43e317b60 / + sr0 + nvme0n1 + └─nvme0n1p1 ext4 c51eb23b-195c-4061-92a9-3fad812cc12f + ``` + +5. 编辑 `/etc/fstab` 文件,添加 `nodelalloc` 挂载参数。 + + {{< copyable "shell-root" >}} + + ```bash + vi /etc/fstab + ``` + + ``` + UUID=c51eb23b-195c-4061-92a9-3fad812cc12f /data1 ext4 defaults,nodelalloc,noatime 0 2 + ``` + +6. 挂载数据盘。 + + {{< copyable "shell-root" >}} + + ```bash + mkdir /data1 && \ + mount -a + ``` + +7. 执行以下命令,如果文件系统为 ext4,并且挂载参数中包含 `nodelalloc`,则表示已生效。 + + {{< copyable "shell-root" >}} + + ```bash + mount -t ext4 + ``` + + ``` + /dev/nvme0n1p1 on /data1 type ext4 (rw,noatime,nodelalloc,data=ordered) + ``` +### 5. 配置初始化参数文件 `topology.yaml` + +集群初始化配置文件需要手动编写,完整的全配置参数模版可以参考 [Github TiUP 项目配置参数模版](https://github.com/pingcap-incubator/tiup-cluster/blob/master/examples/topology.example.yaml)。需要在中控机上面创建 YAML 格式配置文件,例如 `topology.yaml`: + +{{< copyable "shell-regular" >}} + +```shell +cat topology.yaml +``` + +```yaml +# # Global variables are applied to all deployments and used as the default value of +# # the deployments if a specific deployment value is missing. +global: + user: "tidb" + ssh_port: 22 + deploy_dir: "/tidb-deploy" + data_dir: "/tidb-data" + +server_configs: + pd: + replication.enable-placement-rules: true + +pd_servers: + - host: 10.0.1.4 + - host: 10.0.1.5 + - host: 10.0.1.6 +tidb_servers: + - host: 10.0.1.7 + - host: 10.0.1.8 + - host: 10.0.1.9 +tikv_servers: + - host: 10.0.1.1 + - host: 10.0.1.2 + - host: 10.0.1.3 +tiflash_servers: + - host: 10.0.1.10 + data_dir: /data1/tiflash/data,/data2/tiflash/data +cdc_servers: + - host: 10.0.1.6 + - host: 10.0.1.7 + - host: 10.0.1.8 +monitoring_servers: + - host: 10.0.1.4 +grafana_servers: + - host: 10.0.1.4 +alertmanager_servers: + - host: 10.0.1.4 +``` + +### 6. 部署 TiDB 集群 + + +`/path/to/mirror` 是 `tiup mirrors ` 中输出的 package 所在离线机器的位置: + +```bash +export TIUP_MIRRORS=/path/to/mirror + +tiup cluster deploy tidb-test v4.0.0-rc topology.yaml --user root [-p] [-i /home/root/.ssh/gcp_rsa] + +tiup cluster start tidb-test +``` + +> **参数说明:** +> - 通过 TiUP cluster 部署的集群名称为 `tidb-test` +> - 部署版本为 `v4.0.0-rc`,其他版本可以参考[如何查看 TiUP 支持管理的 TiDB 版本](#如何查看-tiup-支持管理的-tidb-版本)的介绍 +> - 初始化配置文件为 `topology.yaml` +> - --user root:通过 root 用户登录到目标主机完成集群部署,该用户需要有 ssh 到目标机器的权限,并且在目标机器有 sudo 权限。也可以用其他有 ssh 和 sudo 权限的用户完成部署。 +> - [-i] 及 [-p]:非必选项,如果已经配置免密登陆目标机,则不需填写。否则选择其一即可,[-i] 为可登录到部署机 root 用户(或 --user 指定的其他用户)的私钥,也可使用 [-p] 交互式输入该用户的密码 + +预期日志结尾输出会有 ```Deployed cluster `tidb-test` successfully``` 关键词,表示部署成功。 + + +部署完成后,集群相关操作可参考 [cluster 命令](/tiup/tiup-cluster.md)。 + + +## 7. mirrors 组件介绍 + +在构建私有云时,通常会使用隔离外网的网络环境,此时无法访问 TiUP 的官方镜像。因此,我们提供了构建私有镜像的方案,它主要由 mirrors 组件来实现,该方案也可用于离线部署。 + +`mirrors` 组件的帮助可以使用 help 命令: + +{{< copyable "shell-regular" >}} + +```bash +tiup mirrors --help +``` + +``` +Starting component `mirrors`: /Users/joshua/.tiup/components/mirrors/v0.0.1/mirrors +Build a local mirrors and download all selected components + +Usage: + tiup mirrors [global-version] [flags] + +Examples: + tiup mirrors local-path --arch amd64,arm --os linux,darwin # Specify the architectures and OSs + tiup mirrors local-path --full # Build a full local mirrors + tiup mirrors local-path --tikv v4 # Specify the version via prefix + tiup mirrors local-path --tidb all --pd all # Download all version for specific component + +Flags: + --overwrite Overwrite the exists tarball + -f, --full Build a full mirrors repository + -a, --arch strings Specify the downloading architecture (default [amd64]) + -o, --os strings Specify the downloading os (default [linux,darwin]) + --tidb strings Specify the versions for component tidb + --tikv strings Specify the versions for component tikv + --pd strings Specify the versions for component pd + --playground strings Specify the versions for component playground + --client strings Specify the versions for component client + --prometheus strings Specify the versions for component prometheus + --package strings Specify the versions for component package + --grafana strings Specify the versions for component grafana + --alertmanager strings Specify the versions for component alertmanager + --blackbox_exporter strings Specify the versions for component blackbox_exporter + --node_exporter strings Specify the versions for component node_exporter + --pushgateway strings Specify the versions for component pushgateway + --tiflash strings Specify the versions for component tiflash + --drainer strings Specify the versions for component drainer + --pump strings Specify the versions for component pump + --cluster strings Specify the versions for component cluster + --mirrors strings Specify the versions for component mirrors + --bench strings Specify the versions for component bench + --insight strings Specify the versions for component insight + --doc strings Specify the versions for component doc + --ctl strings Specify the versions for component ctl + -h, --help help for tiup +``` + +`tiup mirrors` 命令的基本用法如下: + +{{< copyable "shell-regular" >}} + +```bash +tiup mirrors [global-version] [flags] +``` + +- `target-dir`:用于指定克隆下来的数据放到哪个目录里。 +- `global-version`:用于为所有组件快速设置一个共同的版本。 + +`tiup mirrors` 命令提供了很多可选参数,日后可能会提供更多。这些参数一般可以分为四类: + +1. 指定是否覆盖本地的包 + + `--overwrite` 参数表示,如果指定的 `` 中已经有想要下载的包,是否要用官方镜像的包覆盖。如果设置了这个参数,则会覆盖。 + +2. 是否全量克隆 + + `--full` 参数表示,指定完整地克隆官方镜像。 + + > **注意:** + > + > 如果不指定 `--full` 参数或其它参数,那么就只会克隆一些元信息。 + +3. 限定只克隆特定平台的包 + + 如果只想克隆某个平台的包,那么可以使用 `--os` 和 `--arch` 来限定: + + - 只想克隆 linux 平台的,则执行 `tiup mirros --os=linux` + - 只想克隆 amd64 架构的,则执行 `tiup mirros --arch=amd64` + - 只想克隆 linux/amd64 的,则执行 `tiup mirros --os=linux --arch=amd64` + +4. 限定只克隆组件的特定版本 + + 如果只想克隆某个组件的某一个版本而不是所有版本,则使用 `--=` 来限定,例如: + + - 只想克隆 TiDB 的 v4 版本,则执行 `tiup mirrors --tidb v4` + - 只想克隆 TiDB 的 v4 版本,以及 TiKV 的所有版本,则执行 `tiup mirros --tidb v4 --tikv all` + - 克隆一个集群的所有组件的特定版本,则执行 `tiup mirrors v4.0.0-rc` + + +### 8. 构建私有镜像 + +构建私有镜像的方式和离线安装包的制作过程相同,只需要将 package 目录中的内容上传到 CDN 或者文件服务器即可,最简单的方式是: + +{{< copyable "shell-regular" >}} + +```bash +cd package + +python -m SimpleHTTPServer 8000 +``` + +这样就在 这个地址建立了私有镜像。 + +通过私有镜像安装 TiUP: + +{{< copyable "shell-regular" >}} + +```bash +export TIUP_MIRRORS=http://127.0.0.1:8000 + +curl $TIUP_MIRRORS/install.sh | sh +``` + +导入 PATH 变量之后就可以正常使用 TiUP 了(需要保持 `TIUP_MIRRORS` 变量指向私有镜像)。 From 87e74aec2e0ba6181c62abc760bdd0b33d249329 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:51:30 +0800 Subject: [PATCH 03/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 42f62cbc666d..b22d7b104e13 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -106,7 +106,7 @@ pd_servers: log_dir: /data/deploy/install/log/pd-2379 ``` -可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 global 和 server_configs 参数配置,默认会被 `scale-out.yaml` 继承。 +可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 `global` 和 `server_configs` 参数配置,默认会被 `scale-out.yaml` 继承。 From f982d7476c197c94c38d8ad7b0c9b899632ee745 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:52:45 +0800 Subject: [PATCH 04/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index b22d7b104e13..871d3a5bea67 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -8,7 +8,7 @@ aliases: ['/docs-cn/dev/how-to/scale/with-tiup/'] TiDB 集群可以在不中断线上服务的情况下进行扩容和缩容。 -本文介绍如何使用 TiUP 扩容缩容集群中的 TiDB、TiKV、PD、TiCDC 或者 TiFlash 节点。如未安装 TiUP,可参考[升级文档中的步骤](/upgrade-tidb-using-tiup.md#2-在中控机器上安装-tiup),将集群 Import 到 TiUP 环境中,再使用进行扩容缩容。 +本文介绍如何使用 TiUP 扩容缩容集群中的 TiDB、TiKV、PD、TiCDC 或者 TiFlash 节点。如未安装 TiUP,可参考[升级文档中的步骤](/upgrade-tidb-using-tiup.md#2-在中控机器上安装-tiup),将集群 Import 到 TiUP 环境中,再使用 TiUP 进行扩容缩容。 你可以通过 `tiup cluster list` 查看当前的集群名称列表。 From 65a8d9045128b91e9af8516dd137cc83367def15 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:54:55 +0800 Subject: [PATCH 05/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 1 - 1 file changed, 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 871d3a5bea67..93ce982489de 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -81,7 +81,6 @@ tikv_servers: data_dir: /data/deploy/install/data/tikv-20160 log_dir: /data/deploy/install/log/tikv-20160 -``` PD 配置文件参考: {{< copyable "" >}} From 78245146b9e3279530f7e069f563cba7f665882d Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:55:07 +0800 Subject: [PATCH 06/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 1 - 1 file changed, 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 93ce982489de..ce06aa803e0a 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -60,7 +60,6 @@ tidb_servers: deploy_dir: /data/deploy/install/deploy/tidb-4000 log_dir: /data/deploy/install/log/tidb-4000 -``` TiKV 配置文件参考: {{< copyable "" >}} From 9e241df5b0e85681f9e5e4d1d26362d8822f3f0b Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:55:18 +0800 Subject: [PATCH 07/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 1 - 1 file changed, 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index ce06aa803e0a..aa5c69434421 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -107,7 +107,6 @@ pd_servers: 可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 `global` 和 `server_configs` 参数配置,默认会被 `scale-out.yaml` 继承。 - ### 1.2 执行扩容命令 {{< copyable "shell-regular" >}} From c12e614eb9ff6b6967f822ff7d7a8c7da003e17c Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:55:33 +0800 Subject: [PATCH 08/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 1 - 1 file changed, 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index aa5c69434421..6a3a5a71157f 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -117,7 +117,6 @@ tiup cluster scale-out scale-out.yaml 预期输出 Scaled cluster `` out successfully 信息,表示扩容操作成功。 - ### 1.3 检查集群状态 {{< copyable "shell-regular" >}} From cb6327f1f8dad390ebb214c7ed47967271612293 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:55:42 +0800 Subject: [PATCH 09/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 1 - 1 file changed, 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 6a3a5a71157f..e7d07072187e 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -106,7 +106,6 @@ pd_servers: 可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 `global` 和 `server_configs` 参数配置,默认会被 `scale-out.yaml` 继承。 - ### 1.2 执行扩容命令 {{< copyable "shell-regular" >}} From 44642d929b99fcfb6bc7f97309a4f94d68aa8be6 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 20:55:53 +0800 Subject: [PATCH 10/29] Update scale-tidb-using-tiup.md Co-authored-by: Lilian Lee --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index e7d07072187e..9bbe0283d386 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -285,7 +285,7 @@ tiup cluster display ### 4.3 缩容 TiFlash -TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后,表示 TiFlash 节点已经下线成功,这个时候可以执行如下命令缩容 TiFlash : +TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后,表示 TiFlash 节点已经下线成功,这个时候可以执行如下命令缩容 TiFlash: {{< copyable "shell-regular" >}} From eaf607e05a8ac4add5bd27724c2e12ebcfd1b1a0 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Thu, 21 May 2020 23:00:10 +0800 Subject: [PATCH 11/29] Update production-offline-deployment-using-tiup.md --- production-offline-deployment-using-tiup.md | 118 +------------------- 1 file changed, 3 insertions(+), 115 deletions(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index f0819d3cfb35..9da0de70388f 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -231,7 +231,7 @@ alertmanager_servers: ```bash export TIUP_MIRRORS=/path/to/mirror -tiup cluster deploy tidb-test v4.0.0-rc topology.yaml --user root [-p] [-i /home/root/.ssh/gcp_rsa] +tiup cluster deploy tidb-test v4.0.0-rc topology.yaml --user tidb [-p] [-i /home/root/.ssh/gcp_rsa] tiup cluster start tidb-test ``` @@ -240,7 +240,7 @@ tiup cluster start tidb-test > - 通过 TiUP cluster 部署的集群名称为 `tidb-test` > - 部署版本为 `v4.0.0-rc`,其他版本可以参考[如何查看 TiUP 支持管理的 TiDB 版本](#如何查看-tiup-支持管理的-tidb-版本)的介绍 > - 初始化配置文件为 `topology.yaml` -> - --user root:通过 root 用户登录到目标主机完成集群部署,该用户需要有 ssh 到目标机器的权限,并且在目标机器有 sudo 权限。也可以用其他有 ssh 和 sudo 权限的用户完成部署。 +> - --user tidb:通过 tidb 用户登录到目标主机完成集群部署,该用户需要有 ssh 到目标机器的权限,并且在目标机器有 sudo 权限。也可以用其他有 ssh 和 sudo 权限的用户完成部署。 > - [-i] 及 [-p]:非必选项,如果已经配置免密登陆目标机,则不需填写。否则选择其一即可,[-i] 为可登录到部署机 root 用户(或 --user 指定的其他用户)的私钥,也可使用 [-p] 交互式输入该用户的密码 预期日志结尾输出会有 ```Deployed cluster `tidb-test` successfully``` 关键词,表示部署成功。 @@ -251,122 +251,10 @@ tiup cluster start tidb-test ## 7. mirrors 组件介绍 -在构建私有云时,通常会使用隔离外网的网络环境,此时无法访问 TiUP 的官方镜像。因此,我们提供了构建私有镜像的方案,它主要由 mirrors 组件来实现,该方案也可用于离线部署。 - -`mirrors` 组件的帮助可以使用 help 命令: +可以使用 help 命令获取 `mirrors` 组件帮助,详细说明也可以参考[搭建私有镜像](/tiup/tiup-mirrors.md #搭建私有镜像): {{< copyable "shell-regular" >}} ```bash tiup mirrors --help ``` - -``` -Starting component `mirrors`: /Users/joshua/.tiup/components/mirrors/v0.0.1/mirrors -Build a local mirrors and download all selected components - -Usage: - tiup mirrors [global-version] [flags] - -Examples: - tiup mirrors local-path --arch amd64,arm --os linux,darwin # Specify the architectures and OSs - tiup mirrors local-path --full # Build a full local mirrors - tiup mirrors local-path --tikv v4 # Specify the version via prefix - tiup mirrors local-path --tidb all --pd all # Download all version for specific component - -Flags: - --overwrite Overwrite the exists tarball - -f, --full Build a full mirrors repository - -a, --arch strings Specify the downloading architecture (default [amd64]) - -o, --os strings Specify the downloading os (default [linux,darwin]) - --tidb strings Specify the versions for component tidb - --tikv strings Specify the versions for component tikv - --pd strings Specify the versions for component pd - --playground strings Specify the versions for component playground - --client strings Specify the versions for component client - --prometheus strings Specify the versions for component prometheus - --package strings Specify the versions for component package - --grafana strings Specify the versions for component grafana - --alertmanager strings Specify the versions for component alertmanager - --blackbox_exporter strings Specify the versions for component blackbox_exporter - --node_exporter strings Specify the versions for component node_exporter - --pushgateway strings Specify the versions for component pushgateway - --tiflash strings Specify the versions for component tiflash - --drainer strings Specify the versions for component drainer - --pump strings Specify the versions for component pump - --cluster strings Specify the versions for component cluster - --mirrors strings Specify the versions for component mirrors - --bench strings Specify the versions for component bench - --insight strings Specify the versions for component insight - --doc strings Specify the versions for component doc - --ctl strings Specify the versions for component ctl - -h, --help help for tiup -``` - -`tiup mirrors` 命令的基本用法如下: - -{{< copyable "shell-regular" >}} - -```bash -tiup mirrors [global-version] [flags] -``` - -- `target-dir`:用于指定克隆下来的数据放到哪个目录里。 -- `global-version`:用于为所有组件快速设置一个共同的版本。 - -`tiup mirrors` 命令提供了很多可选参数,日后可能会提供更多。这些参数一般可以分为四类: - -1. 指定是否覆盖本地的包 - - `--overwrite` 参数表示,如果指定的 `` 中已经有想要下载的包,是否要用官方镜像的包覆盖。如果设置了这个参数,则会覆盖。 - -2. 是否全量克隆 - - `--full` 参数表示,指定完整地克隆官方镜像。 - - > **注意:** - > - > 如果不指定 `--full` 参数或其它参数,那么就只会克隆一些元信息。 - -3. 限定只克隆特定平台的包 - - 如果只想克隆某个平台的包,那么可以使用 `--os` 和 `--arch` 来限定: - - - 只想克隆 linux 平台的,则执行 `tiup mirros --os=linux` - - 只想克隆 amd64 架构的,则执行 `tiup mirros --arch=amd64` - - 只想克隆 linux/amd64 的,则执行 `tiup mirros --os=linux --arch=amd64` - -4. 限定只克隆组件的特定版本 - - 如果只想克隆某个组件的某一个版本而不是所有版本,则使用 `--=` 来限定,例如: - - - 只想克隆 TiDB 的 v4 版本,则执行 `tiup mirrors --tidb v4` - - 只想克隆 TiDB 的 v4 版本,以及 TiKV 的所有版本,则执行 `tiup mirros --tidb v4 --tikv all` - - 克隆一个集群的所有组件的特定版本,则执行 `tiup mirrors v4.0.0-rc` - - -### 8. 构建私有镜像 - -构建私有镜像的方式和离线安装包的制作过程相同,只需要将 package 目录中的内容上传到 CDN 或者文件服务器即可,最简单的方式是: - -{{< copyable "shell-regular" >}} - -```bash -cd package - -python -m SimpleHTTPServer 8000 -``` - -这样就在 这个地址建立了私有镜像。 - -通过私有镜像安装 TiUP: - -{{< copyable "shell-regular" >}} - -```bash -export TIUP_MIRRORS=http://127.0.0.1:8000 - -curl $TIUP_MIRRORS/install.sh | sh -``` - -导入 PATH 变量之后就可以正常使用 TiUP 了(需要保持 `TIUP_MIRRORS` 变量指向私有镜像)。 From 9450f89342da5a607030c9d58f954fb94a9a3694 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 14:23:12 +0800 Subject: [PATCH 12/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 113 ++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 13 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 9bbe0283d386..db2f5caaa4df 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -1,3 +1,4 @@ + --- title: 使用 TiUP 扩容缩容 TiDB 集群 category: how-to @@ -139,6 +140,12 @@ tiup cluster display ## 2. 扩容 TiFlash 节点 如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 +> **注意:** +> +> #### 在原有 TiDB 集群上新增 TiFlash 组件: +> 1. 首先确认当前 TiDB 的版本支持 TiFlash,否则需要先升级 TiDB 集群至 4.0 rc 以上版本。 +> 2. 在 pd-ctl(目前 pd-ctl 还没有接入 TiUP Cluster,需要从 [这里](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz) 手动进行下载)中输入 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 + ### 2.1 添加节点信息到 scale-out.yaml 文件 @@ -179,7 +186,52 @@ tiup cluster display | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | -## 3. 缩容 TiDB/TiKV/PD/TiCDC 节点 +## 3. 扩容 TiCDC 节点 + +如果要添加 TiCDC 节点,IP 地址为 10.0.1.3、10.0.1.4,可以按照如下步骤进行操作。 + +### 3.1 添加节点信息到 scale-out.yaml 文件 + +编写 scale-out.yaml 文件: + +{{< copyable "" >}} + +```ini +cdc_servers: + - host: 10.0.1.3 + - host: 10.0.1.4 +``` + +### 3.2 运行扩容命令 + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-out scale-out.yaml +``` + +### 3.3 查看集群状态 + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +打开浏览器访问监控平台 ,监控整个集群和新增节点的状态。 + +扩容后,集群拓扑结构如下所示: + +| 主机 IP | 服务 | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash + **TiCDC** | +| 10.0.1.4 | TiDB + PD + TiFlash + **TiCDC** | +| 10.0.1.5 | TiDB+ TiKV + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | + + +## 4. 缩容 TiDB/TiKV/PD/TiCDC 节点 如果要移除 IP 地址为 10.0.1.5 的一个 TiKV 节点,可以按照如下步骤进行操作。 @@ -187,7 +239,7 @@ tiup cluster display > > 移除 TiDB、PD、TiCDC 节点和移除 TiKV 节点的步骤类似。 -### 3.1 查看节点 ID 信息 +### 4.1 查看节点 ID 信息 {{< copyable "shell-regular" >}} @@ -206,6 +258,8 @@ ID              Role Host        Ports --              ---- ----    ----- ------ --------                ---------- +10.0.1.3:8300   cdc 10.0.1.3 8300   Up -             deploy/cdc-8300 +10.0.1.4:8300   cdc 10.0.1.4 8300   Up -             deploy/cdc-8300 10.0.1.4:2379   pd 10.0.1.4 2379/2380 Healthy data/pd-2379            deploy/pd-2379 10.0.1.1:20160  tikv 10.0.1.1 20160/20180 Up data/tikv-20160         deploy/tikv-20160 @@ -231,7 +285,7 @@ ID              Role Host        Ports 10.0.1.5:9093   alertmanager 10.0.1.5 9093/9094 Up data/alertmanager-9093  deploy/alertmanager-9093 ``` -### 3.2 执行缩容操作 +### 4.2 执行缩容操作 {{< copyable "shell-regular" >}} @@ -243,7 +297,7 @@ tiup cluster scale-in --node 10.0.1.5:20160 预期输出 Scaled cluster `` in successfully 信息,表示缩容操作成功。 -### 3.3 检查集群状态 +### 4.3 检查集群状态 下线需要一定时间,下线节点的状态变为 Tombstone 就说明下线成功。 @@ -261,13 +315,13 @@ tiup cluster display | Host IP | Service | |:----|:----| -| 10.0.1.3 | TiDB + TiFlash  | -| 10.0.1.4 | TiDB + PD + TiFlash  | +| 10.0.1.3 | TiDB + TiFlash + TiCDC | +| 10.0.1.4 | TiDB + PD + TiFlash + TiCDC | | 10.0.1.5 | TiDB + Monitor**(TiKV 已删除)** | | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | -## 4. 缩容 TiFlash 节点 +## 5. 缩容 TiFlash 节点 如果要缩容 IP 地址为 10.0.1.4 的一个 TiFlash 节点,,可以按照如下步骤进行操作。 @@ -275,15 +329,15 @@ tiup cluster display > > 本节介绍的缩容流程不会删除缩容节点上的数据文件,如需再次上线该节点,请先手动删除原来的数据文件。 -### 4.1 下线该 TiFlash 节点 +### 5.1 下线该 TiFlash 节点 参考[下线 TiFlash 节点](/tiflash/maintain-tiflash.md#下线-tiflash-节点)一节,对要进行缩容的 TiFlash 节点进行下线操作。 -### 4.2 检查节点是否下线成功 +### 5.2 检查节点是否下线成功 使用 Grafana 或者 pd-ctl 检查节点是否下线成功(下线需要一定时间)。 -### 4.3 缩容 TiFlash +### 5.3 缩容 TiFlash TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后,表示 TiFlash 节点已经下线成功,这个时候可以执行如下命令缩容 TiFlash: @@ -293,7 +347,7 @@ TiFlash 对应的 `store` 消失,或者 `state_name` 变成 `Tombstone` 后, tiup cluster scale-in --node 10.0.1.4:9000 ``` -### 4.4 查看集群状态 +### 5.4 查看集群状态 {{< copyable "shell-regular" >}} @@ -307,8 +361,41 @@ tiup cluster display | Host IP | Service | |:----|:----| -| 10.0.1.3 | TiDB + TiFlash  | -| 10.0.1.4 | TiDB + PD**(TiFlash 已删除)** | +| 10.0.1.3 | TiDB + TiFlash + TiCDC | +| 10.0.1.4 | TiDB + PD + TiCDC **(TiFlash 已删除)** | | 10.0.1.5 | TiDB + Monitor | | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | + +## 6. 缩容 TiCDC 节点 + +如果要缩容 IP 地址为 10.0.1.4 的一个 TiCDC 节点,可以按照如下步骤进行操作。 + +### 6.1 下线该 TiCDC 节点 + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-in --node 10.0.1.4:8300 +``` + +### 6.2 查看集群状态 + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +打开浏览器访问监控平台 ,监控整个集群的状态。 + +调整后,拓扑结构如下: + +| Host IP | Service | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash + TiCDC | +| 10.0.1.4 | TiDB + PD + **(TiCDC 已删除)** | +| 10.0.1.5 | TiDB + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | + From 5cd6c26b20ec4b57e31b9a4edd76efa531e63f08 Mon Sep 17 00:00:00 2001 From: yikeke Date: Fri, 22 May 2020 16:59:32 +0800 Subject: [PATCH 13/29] add TOC; fix format --- TOC.md | 1 + production-offline-deployment-using-tiup.md | 24 ++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/TOC.md b/TOC.md index 887814b1e5a7..90bb405fc9ad 100644 --- a/TOC.md +++ b/TOC.md @@ -33,6 +33,7 @@ - [软硬件环境需求](/hardware-and-software-requirements.md) + 集群部署方式 - [使用 TiUP 部署(推荐)](/production-deployment-using-tiup.md) + - [使用 TiUP 离线部署](/production-offline-deployment-using-tiup.md) - [使用 Ansible 部署](/online-deployment-using-ansible.md) - [使用 Ansible 离线部署](/offline-deployment-using-ansible.md) - [使用 Docker 部署](/test-deployment-using-docker.md) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 9da0de70388f..f83bcddb89ae 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -1,14 +1,11 @@ --- title: 使用 TiUP 离线部署 TiDB 集群 category: how-to -aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] --- - - # 使用 TiUP 离线部署 TiDB 集群 -### 1. 部署在线环境 TiUP 组件 +## 1. 部署在线环境 TiUP 组件 使用普通用户登录一台与外网相同的机器: @@ -19,6 +16,7 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] ```shell curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh ``` + 2. 重新声明全局环境变量: {{< copyable "shell-regular" >}} @@ -26,6 +24,7 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] ```shell source .bash_profile ``` + 3. 确认 TiUP 工具是否安装: {{< copyable "shell-regular" >}} @@ -34,7 +33,7 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] which tiup ``` -### 2. 使用 TiUP 拉取镜像 +## 2. 使用 TiUP 拉取镜像 以 tidb 用户在隔离的环境中安装一个 v4.0.0-rc 的 TiDB 集群为例,可以执行以下步骤: @@ -58,11 +57,12 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] 此时,`package.tar.gz` 就是一个独立的离线环境包。 -### 3. 部署离线环境 TiUP 组件 +## 3. 部署离线环境 TiUP 组件 1. 将包发送到目标集群的中控机后,执行以下命令安装 TiUP 组件: {{< copyable "shell-regular" >}} + ```bash tar xzvf package.tar.gz @@ -73,8 +73,7 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] source /home/tidb/.bash_profile ``` - -### 4. TiKV 数据盘挂载 +## 4. TiKV 数据盘挂载 > **注意:** > @@ -173,7 +172,8 @@ aliases: ['/docs-cn/dev/how-to/deploy/orchestrated/tiup/'] ``` /dev/nvme0n1p1 on /data1 type ext4 (rw,noatime,nodelalloc,data=ordered) ``` -### 5. 配置初始化参数文件 `topology.yaml` + +## 5. 配置初始化参数文件 `topology.yaml` 集群初始化配置文件需要手动编写,完整的全配置参数模版可以参考 [Github TiUP 项目配置参数模版](https://github.com/pingcap-incubator/tiup-cluster/blob/master/examples/topology.example.yaml)。需要在中控机上面创建 YAML 格式配置文件,例如 `topology.yaml`: @@ -223,8 +223,7 @@ alertmanager_servers: - host: 10.0.1.4 ``` -### 6. 部署 TiDB 集群 - +## 6. 部署 TiDB 集群 `/path/to/mirror` 是 `tiup mirrors ` 中输出的 package 所在离线机器的位置: @@ -237,6 +236,7 @@ tiup cluster start tidb-test ``` > **参数说明:** +> > - 通过 TiUP cluster 部署的集群名称为 `tidb-test` > - 部署版本为 `v4.0.0-rc`,其他版本可以参考[如何查看 TiUP 支持管理的 TiDB 版本](#如何查看-tiup-支持管理的-tidb-版本)的介绍 > - 初始化配置文件为 `topology.yaml` @@ -245,10 +245,8 @@ tiup cluster start tidb-test 预期日志结尾输出会有 ```Deployed cluster `tidb-test` successfully``` 关键词,表示部署成功。 - 部署完成后,集群相关操作可参考 [cluster 命令](/tiup/tiup-cluster.md)。 - ## 7. mirrors 组件介绍 可以使用 help 命令获取 `mirrors` 组件帮助,详细说明也可以参考[搭建私有镜像](/tiup/tiup-mirrors.md #搭建私有镜像): From 0d1fa3a15ff119031d445bcedb9d7dda6f915180 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 22:03:43 +0800 Subject: [PATCH 14/29] Update production-offline-deployment-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- production-offline-deployment-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index f83bcddb89ae..5c230c7cfece 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -7,7 +7,7 @@ category: how-to ## 1. 部署在线环境 TiUP 组件 -使用普通用户登录一台与外网相同的机器: +使用普通用户登录一台开放外网访问的机器: 1. 执行如下命令安装 TiUP 工具: From cbec0bdcd413dd80547721b7952a8bb06d47763b Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 22:04:16 +0800 Subject: [PATCH 15/29] Update production-offline-deployment-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- production-offline-deployment-using-tiup.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 5c230c7cfece..7a33be78cf6d 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -64,12 +64,9 @@ category: how-to {{< copyable "shell-regular" >}} ```bash - tar xzvf package.tar.gz - - cd package - - sh local_install.sh - + tar xzvf package.tar.gz && + cd package && + sh local_install.sh && source /home/tidb/.bash_profile ``` From 47ed042e19952f3ae781acda34681a7b0ab991f2 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 22:04:26 +0800 Subject: [PATCH 16/29] Update production-offline-deployment-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- production-offline-deployment-using-tiup.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 7a33be78cf6d..4836a70570c2 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -224,6 +224,8 @@ alertmanager_servers: `/path/to/mirror` 是 `tiup mirrors ` 中输出的 package 所在离线机器的位置: +{{< copyable "shell-regular" >}} + ```bash export TIUP_MIRRORS=/path/to/mirror From 7b4e9e267571555f4532482ee6e9df4817684b1a Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 22:04:40 +0800 Subject: [PATCH 17/29] Update production-offline-deployment-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- production-offline-deployment-using-tiup.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 4836a70570c2..125d0e124319 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -227,10 +227,8 @@ alertmanager_servers: {{< copyable "shell-regular" >}} ```bash -export TIUP_MIRRORS=/path/to/mirror - -tiup cluster deploy tidb-test v4.0.0-rc topology.yaml --user tidb [-p] [-i /home/root/.ssh/gcp_rsa] - +export TIUP_MIRRORS=/path/to/mirror && +tiup cluster deploy tidb-test v4.0.0-rc topology.yaml --user tidb [-p] [-i /home/root/.ssh/gcp_rsa] && tiup cluster start tidb-test ``` From e8398032882ec2eaf333e17f903c4b4a6d950355 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Fri, 22 May 2020 22:06:41 +0800 Subject: [PATCH 18/29] Update production-offline-deployment-using-tiup.md --- production-offline-deployment-using-tiup.md | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 125d0e124319..6622df24f97f 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -35,14 +35,14 @@ category: how-to ## 2. 使用 TiUP 拉取镜像 -以 tidb 用户在隔离的环境中安装一个 v4.0.0-rc 的 TiDB 集群为例,可以执行以下步骤: +以 tidb 用户在隔离的环境中安装一个 v4.0.0-rc.1 的 TiDB 集群为例,可以执行以下步骤: 1. 在一台和外网相通的机器上拉取需要的组件: {{< copyable "shell-regular" >}} ```bash - tiup mirrors package --os=linux v4.0.0-rc + tiup mirrors package --os=linux v4.0.0-rc.1 ``` 该命令会在当前目录下创建一个名叫 `package` 的目录,里面有启动一个集群必要的组件包。 @@ -235,7 +235,7 @@ tiup cluster start tidb-test > **参数说明:** > > - 通过 TiUP cluster 部署的集群名称为 `tidb-test` -> - 部署版本为 `v4.0.0-rc`,其他版本可以参考[如何查看 TiUP 支持管理的 TiDB 版本](#如何查看-tiup-支持管理的-tidb-版本)的介绍 +> - 部署版本为 `v4.0.0-rc.1`,其他版本可以参考[如何查看 TiUP 支持管理的 TiDB 版本](#如何查看-tiup-支持管理的-tidb-版本)的介绍 > - 初始化配置文件为 `topology.yaml` > - --user tidb:通过 tidb 用户登录到目标主机完成集群部署,该用户需要有 ssh 到目标机器的权限,并且在目标机器有 sudo 权限。也可以用其他有 ssh 和 sudo 权限的用户完成部署。 > - [-i] 及 [-p]:非必选项,如果已经配置免密登陆目标机,则不需填写。否则选择其一即可,[-i] 为可登录到部署机 root 用户(或 --user 指定的其他用户)的私钥,也可使用 [-p] 交互式输入该用户的密码 @@ -244,12 +244,3 @@ tiup cluster start tidb-test 部署完成后,集群相关操作可参考 [cluster 命令](/tiup/tiup-cluster.md)。 -## 7. mirrors 组件介绍 - -可以使用 help 命令获取 `mirrors` 组件帮助,详细说明也可以参考[搭建私有镜像](/tiup/tiup-mirrors.md #搭建私有镜像): - -{{< copyable "shell-regular" >}} - -```bash -tiup mirrors --help -``` From 8f1df06f1a8bb8820cd2f3fc7e998f1f93692c53 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Sat, 23 May 2020 22:30:52 +0800 Subject: [PATCH 19/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index db2f5caaa4df..7b95d78637bc 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -23,13 +23,13 @@ TiDB 集群可以在不中断线上服务的情况下进行扩容和缩容。 | 10.0.1.1 | TiKV | | 10.0.1.2 | TiKV  | -## 1. 扩容 TiDB/TiKV/PD/TiCDC 节点 +## 1. 扩容 TiDB/PD/TiKV 节点 如果要添加一个 TiDB 节点,IP 地址为 10.0.1.5,可以按照如下步骤进行操作。 > **注意:** > -> 添加 PD、TiCDC 节点和添加 TiDB 节点的步骤类似。添加 TiKV 节点前,建议预先根据集群的负载情况调整 PD 调度参数。 +> 添加 PD 节点和添加 TiDB 节点的步骤类似。添加 TiKV 节点前,建议预先根据集群的负载情况调整 PD 调度参数。 ### 1.1 编写扩容拓扑配置 @@ -61,6 +61,8 @@ tidb_servers: deploy_dir: /data/deploy/install/deploy/tidb-4000 log_dir: /data/deploy/install/log/tidb-4000 + + TiKV 配置文件参考: {{< copyable "" >}} @@ -81,6 +83,8 @@ tikv_servers: data_dir: /data/deploy/install/data/tikv-20160 log_dir: /data/deploy/install/log/tikv-20160 + + PD 配置文件参考: {{< copyable "" >}} @@ -231,13 +235,13 @@ tiup cluster display | 10.0.1.2 | TiKV  | -## 4. 缩容 TiDB/TiKV/PD/TiCDC 节点 +## 4. 缩容 TiDB/PD/TiKV/ 节点 如果要移除 IP 地址为 10.0.1.5 的一个 TiKV 节点,可以按照如下步骤进行操作。 > **注意:** > -> 移除 TiDB、PD、TiCDC 节点和移除 TiKV 节点的步骤类似。 +> 移除 TiDB、PD 节点和移除 TiKV 节点的步骤类似。 ### 4.1 查看节点 ID 信息 From 53e97f3dcde7a742ba5cfb4f96e4bd1ab8f9f013 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Sun, 24 May 2020 13:26:58 +0800 Subject: [PATCH 20/29] Update production-offline-deployment-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- production-offline-deployment-using-tiup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/production-offline-deployment-using-tiup.md b/production-offline-deployment-using-tiup.md index 6622df24f97f..2ac2082c2294 100644 --- a/production-offline-deployment-using-tiup.md +++ b/production-offline-deployment-using-tiup.md @@ -5,6 +5,8 @@ category: how-to # 使用 TiUP 离线部署 TiDB 集群 +本文介绍如何使用 TiUP 离线部署 TiDB 集群,具体的操作步骤如下。 + ## 1. 部署在线环境 TiUP 组件 使用普通用户登录一台开放外网访问的机器: @@ -243,4 +245,3 @@ tiup cluster start tidb-test 预期日志结尾输出会有 ```Deployed cluster `tidb-test` successfully``` 关键词,表示部署成功。 部署完成后,集群相关操作可参考 [cluster 命令](/tiup/tiup-cluster.md)。 - From f2d65a2b5d9aecb50433bfa64bb142406302c5f4 Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Sun, 24 May 2020 13:27:06 +0800 Subject: [PATCH 21/29] Update scale-tidb-using-tiup.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- scale-tidb-using-tiup.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 7b95d78637bc..213ebf2e7cfe 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -235,7 +235,7 @@ tiup cluster display | 10.0.1.2 | TiKV  | -## 4. 缩容 TiDB/PD/TiKV/ 节点 +## 4. 缩容 TiDB/PD/TiKV 节点 如果要移除 IP 地址为 10.0.1.5 的一个 TiKV 节点,可以按照如下步骤进行操作。 @@ -402,4 +402,3 @@ tiup cluster display | 10.0.1.5 | TiDB + Monitor | | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | - From 73748b9ad3e5dfc1a8b64ce95e8c1f33a91c0377 Mon Sep 17 00:00:00 2001 From: yikeke Date: Mon, 25 May 2020 10:36:40 +0800 Subject: [PATCH 22/29] Update TOC.md --- TOC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TOC.md b/TOC.md index ae86b9e06f79..d989414ff14c 100644 --- a/TOC.md +++ b/TOC.md @@ -38,7 +38,7 @@ + 安装与启动 + Linux + [使用 TiUP 部署](/production-deployment-using-tiup.md) @李仲舒 - + [使用 TiUP 离线部署](/production-deployment-using-tiup-offline.md) @刘金龙 + + [使用 TiUP 离线部署](/production-offline-deployment-using-tiup.md ) @刘金龙 + [使用 Ansible 部署](/online-deployment-using-ansible.md) + [使用 Ansible 离线部署](/offline-deployment-using-ansible.md) + [使用 Docker 部署](/test-deployment-using-docker.md) From 427ef9c5695d66b68e8eb4175d143d8e536e5a66 Mon Sep 17 00:00:00 2001 From: yikeke Date: Mon, 25 May 2020 10:37:14 +0800 Subject: [PATCH 23/29] fix a link --- TOC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TOC.md b/TOC.md index d989414ff14c..2d5084c886ea 100644 --- a/TOC.md +++ b/TOC.md @@ -38,7 +38,7 @@ + 安装与启动 + Linux + [使用 TiUP 部署](/production-deployment-using-tiup.md) @李仲舒 - + [使用 TiUP 离线部署](/production-offline-deployment-using-tiup.md ) @刘金龙 + + [使用 TiUP 离线部署](/production-offline-deployment-using-tiup.md) @刘金龙 + [使用 Ansible 部署](/online-deployment-using-ansible.md) + [使用 Ansible 离线部署](/offline-deployment-using-ansible.md) + [使用 Docker 部署](/test-deployment-using-docker.md) From d335ffda899cc1ae20cc5eeed92fccc13ff06500 Mon Sep 17 00:00:00 2001 From: yikeke Date: Mon, 25 May 2020 10:43:44 +0800 Subject: [PATCH 24/29] fix lint ci --- scale-tidb-using-tiup.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 213ebf2e7cfe..dcf1d7ed0520 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -1,4 +1,3 @@ - --- title: 使用 TiUP 扩容缩容 TiDB 集群 category: how-to @@ -143,13 +142,14 @@ tiup cluster display ## 2. 扩容 TiFlash 节点 -如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 > **注意:** > -> #### 在原有 TiDB 集群上新增 TiFlash 组件: +> 在原有 TiDB 集群上新增 TiFlash 组件需要注意: +> > 1. 首先确认当前 TiDB 的版本支持 TiFlash,否则需要先升级 TiDB 集群至 4.0 rc 以上版本。 -> 2. 在 pd-ctl(目前 pd-ctl 还没有接入 TiUP Cluster,需要从 [这里](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz) 手动进行下载)中输入 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 +> 2. 在 pd-ctl(目前 pd-ctl 还没有接入 TiUP Cluster,需要从[这里](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz) 手动进行下载)中输入 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 +如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 ### 2.1 添加节点信息到 scale-out.yaml 文件 @@ -234,7 +234,6 @@ tiup cluster display | 10.0.1.1 | TiKV  | | 10.0.1.2 | TiKV  | - ## 4. 缩容 TiDB/PD/TiKV 节点 如果要移除 IP 地址为 10.0.1.5 的一个 TiKV 节点,可以按照如下步骤进行操作。 From 606ffa3f50eaa66c7fe09171d2e4ef466c7803d7 Mon Sep 17 00:00:00 2001 From: kissmydb Date: Mon, 25 May 2020 22:12:42 +0800 Subject: [PATCH 25/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index dcf1d7ed0520..4513ed1431e7 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -147,7 +147,7 @@ tiup cluster display > 在原有 TiDB 集群上新增 TiFlash 组件需要注意: > > 1. 首先确认当前 TiDB 的版本支持 TiFlash,否则需要先升级 TiDB 集群至 4.0 rc 以上版本。 -> 2. 在 pd-ctl(目前 pd-ctl 还没有接入 TiUP Cluster,需要从[这里](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz) 手动进行下载)中输入 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 +> 2. 下载 [pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz),执行 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 From 20541f2758a16c0e80dd2b5810e0ce2f6383232a Mon Sep 17 00:00:00 2001 From: King-Dylan <50897894+King-Dylan@users.noreply.github.com> Date: Tue, 26 May 2020 02:14:03 +0800 Subject: [PATCH 26/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 4513ed1431e7..1bb7bf24df34 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -147,7 +147,7 @@ tiup cluster display > 在原有 TiDB 集群上新增 TiFlash 组件需要注意: > > 1. 首先确认当前 TiDB 的版本支持 TiFlash,否则需要先升级 TiDB 集群至 4.0 rc 以上版本。 -> 2. 下载 [pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz),执行 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 +> 2. 下载 [pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc.2-linux-amd64.tar.gz),执行 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 From 63079ffe842a70d7c7ebf6b3222210a408fd3526 Mon Sep 17 00:00:00 2001 From: yikeke Date: Tue, 26 May 2020 11:01:17 +0800 Subject: [PATCH 27/29] fix format --- scale-tidb-using-tiup.md | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 1bb7bf24df34..3dc9fde517b7 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -48,19 +48,13 @@ vi scale-out.yaml ```ini tidb_servers: - - host: 10.0.1.5 - ssh_port: 22 - port: 4000 - status_port: 10080 - deploy_dir: /data/deploy/install/deploy/tidb-4000 - log_dir: /data/deploy/install/log/tidb-4000 - +``` TiKV 配置文件参考: @@ -68,21 +62,14 @@ TiKV 配置文件参考: ```ini tikv_servers: - - host: 10.0.1.5 - ssh_port: 22 - port: 20160 - status_port: 20180 - deploy_dir: /data/deploy/install/deploy/tikv-20160 - data_dir: /data/deploy/install/data/tikv-20160 - log_dir: /data/deploy/install/log/tikv-20160 - +``` PD 配置文件参考: @@ -90,21 +77,13 @@ PD 配置文件参考: ```ini pd_servers: - - host: 10.0.1.5 - ssh_port: 22 - name: pd-1 - client_port: 2379 - peer_port: 2380 - deploy_dir: /data/deploy/install/deploy/pd-2379 - data_dir: /data/deploy/install/data/pd-2379 - log_dir: /data/deploy/install/log/pd-2379 ``` @@ -132,13 +111,13 @@ tiup cluster display 扩容后,集群拓扑结构如下所示: -| 主机 IP | 服务 | +| 主机 IP | 服务 | |:----|:----| | 10.0.1.3 | TiDB + TiFlash  | | 10.0.1.4 | TiDB + PD | -| 10.0.1.5 | **TiDB** + TiKV + Monitor | -| 10.0.1.1 | TiKV  | -| 10.0.1.2 | TiKV  | +| 10.0.1.5 | **TiDB** + TiKV + Monitor | +| 10.0.1.1 | TiKV  | +| 10.0.1.2 | TiKV  | ## 2. 扩容 TiFlash 节点 From 4ae222eec98027737bc86bea29f519daa4090d0b Mon Sep 17 00:00:00 2001 From: yikeke Date: Tue, 26 May 2020 11:05:58 +0800 Subject: [PATCH 28/29] fix a link --- scale-tidb-using-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 3dc9fde517b7..81e50e849123 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -126,7 +126,7 @@ tiup cluster display > 在原有 TiDB 集群上新增 TiFlash 组件需要注意: > > 1. 首先确认当前 TiDB 的版本支持 TiFlash,否则需要先升级 TiDB 集群至 4.0 rc 以上版本。 -> 2. 下载 [pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc.2-linux-amd64.tar.gz),执行 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 +> 2. 下载 [pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc.2-linux-amd64.tar.gz),执行 `config set enable-placement-rules true` 命令,以开启 PD 的 Placement Rules 功能。 如果要添加一个 TiFlash 节点,IP 地址为 10.0.1.4,可以按照如下步骤进行操作。 From 0871b41fa0ce5cb034542b2c698e918061630e80 Mon Sep 17 00:00:00 2001 From: kissmydb Date: Tue, 26 May 2020 11:46:25 +0800 Subject: [PATCH 29/29] Update scale-tidb-using-tiup.md --- scale-tidb-using-tiup.md | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/scale-tidb-using-tiup.md b/scale-tidb-using-tiup.md index 81e50e849123..338c7e9dae54 100644 --- a/scale-tidb-using-tiup.md +++ b/scale-tidb-using-tiup.md @@ -48,12 +48,12 @@ vi scale-out.yaml ```ini tidb_servers: - - host: 10.0.1.5 - ssh_port: 22 - port: 4000 - status_port: 10080 - deploy_dir: /data/deploy/install/deploy/tidb-4000 - log_dir: /data/deploy/install/log/tidb-4000 + - host: 10.0.1.5 + ssh_port: 22 + port: 4000 + status_port: 10080 + deploy_dir: /data/deploy/install/deploy/tidb-4000 + log_dir: /data/deploy/install/log/tidb-4000 ``` TiKV 配置文件参考: @@ -62,13 +62,13 @@ TiKV 配置文件参考: ```ini tikv_servers: - - host: 10.0.1.5 - ssh_port: 22 - port: 20160 - status_port: 20180 - deploy_dir: /data/deploy/install/deploy/tikv-20160 - data_dir: /data/deploy/install/data/tikv-20160 - log_dir: /data/deploy/install/log/tikv-20160 + - host: 10.0.1.5 + ssh_port: 22 + port: 20160 + status_port: 20180 + deploy_dir: /data/deploy/install/deploy/tikv-20160 + data_dir: /data/deploy/install/data/tikv-20160 + log_dir: /data/deploy/install/log/tikv-20160 ``` PD 配置文件参考: @@ -77,14 +77,14 @@ PD 配置文件参考: ```ini pd_servers: - - host: 10.0.1.5 - ssh_port: 22 - name: pd-1 - client_port: 2379 - peer_port: 2380 - deploy_dir: /data/deploy/install/deploy/pd-2379 - data_dir: /data/deploy/install/data/pd-2379 - log_dir: /data/deploy/install/log/pd-2379 + - host: 10.0.1.5 + ssh_port: 22 + name: pd-1 + client_port: 2379 + peer_port: 2380 + deploy_dir: /data/deploy/install/deploy/pd-2379 + data_dir: /data/deploy/install/data/pd-2379 + log_dir: /data/deploy/install/log/pd-2379 ``` 可以使用 `tiup cluster edit-config ` 查看当前集群的配置信息,因为其中的 `global` 和 `server_configs` 参数配置,默认会被 `scale-out.yaml` 继承。 @@ -138,7 +138,7 @@ tiup cluster display ```ini tiflash_servers: - - host: 10.0.1.4 + - host: 10.0.1.4 ``` ### 2.2 运行扩容命令 @@ -181,8 +181,8 @@ tiup cluster display ```ini cdc_servers: - - host: 10.0.1.3 - - host: 10.0.1.4 + - host: 10.0.1.3 + - host: 10.0.1.4 ``` ### 3.2 运行扩容命令