Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb-in-kubernetes: add offline pump document #1757

Merged
merged 7 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions dev/tidb-in-kubernetes/maintain/backup-and-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,37 @@ kubectl get pvc -n <namespace> -l app.kubernetes.io/component=backup,pingcap.com
* PV:默认的下游存储,这种情况下,你可以考虑为 `drainer` 配置更大的 PV 空间(通过修改 `binlog.drainer.storage` 配置);
* 兼容 MySQL 协议的数据库:通过设置 `binlog.drainer.destDBType` 为 `mysql` 来开启,你必须同时在 `binlog.drainer.mysql` 中配置目标数据库的地址和认证信息;
* Apache Kafka:通过设置 `binlog.drainer.destDBType` 为 `kafka` 来开启,你必须同时在 `binlog.drainer.kafka` 中配置目标集群的 Zookeeper 地址和 Kafka 地址。

### Pump 缩容

缩容 Pump 需要挨个先将 Pump 节点从集群中下线之后操作 `helm upgrade` 进行缩容。

1. 下线 Pump 节点:

假设现在有 3 个 Pump 节点,我们需要下线第 3 个 Pump 节点,将 `<ordinal-id>` 替换成 `2`,操作方式是:

{{< copyable "shell-regular" >}}

```shell
kubectl run offline-pump-<ordinal-id> --image=pingcap/tidb-binlog:<version> --namespace=<namespace> --restart=OnFailure -- /binlogctl -pd-urls=http://<release-name>-pd:2379 -cmd offline-pump -node-id <release-name>-pump-<ordinal-id>:8250
```

`<version>` 为当前 TiDB 的版本。

然后查看 Pump 的日志输出,确认输出 `pump offline, please delete my pod` 后即可确认该节点已经成功下线。

{{< copyable "shell-regular" >}}

```shell
kubectl logs -f -n <namespace> <release-name>-pump-<ordinal-id>
```

2. 缩容 Pump:

修改 `values.yaml` 文件中 `binlog.pump.replicas` 为 `2`,然后执行缩容操作:

{{< copyable "shell-regular" >}}

```shell
helm upgrade <release-name> pingcap/tidb-cluster -f values.yaml --version=<chart-version>
```
34 changes: 34 additions & 0 deletions v3.0/tidb-in-kubernetes/maintain/backup-and-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,37 @@ kubectl get pvc -n <namespace> -l app.kubernetes.io/component=backup,pingcap.com
* PV:默认的下游存储,这种情况下,你可以考虑为 `drainer` 配置更大的 PV 空间(通过修改 `binlog.drainer.storage` 配置);
* 兼容 MySQL 协议的数据库:通过设置 `binlog.drainer.destDBType` 为 `mysql` 来开启,你必须同时在 `binlog.drainer.mysql` 中配置目标数据库的地址和认证信息;
* Apache Kafka:通过设置 `binlog.drainer.destDBType` 为 `kafka` 来开启,你必须同时在 `binlog.drainer.kafka` 中配置目标集群的 Zookeeper 地址和 Kafka 地址。

### Pump 缩容

缩容 Pump 需要挨个先将 Pump 节点从集群中下线之后操作 `helm upgrade` 进行缩容。

1. 下线 Pump 节点:

假设现在有 3 个 Pump 节点,我们需要下线第 3 个 Pump 节点,将 `<ordinal-id>` 替换成 `2`,操作方式是:

{{< copyable "shell-regular" >}}

```shell
kubectl run offline-pump-<ordinal-id> --image=pingcap/tidb-binlog:<version> --namespace=<namespace> --restart=OnFailure -- /binlogctl -pd-urls=http://<release-name>-pd:2379 -cmd offline-pump -node-id <release-name>-pump-<ordinal-id>:8250
```

`<version>` 为当前 TiDB 的版本。

然后查看 Pump 的日志输出,确认输出 `pump offline, please delete my pod` 后即可确认该节点已经成功下线。

{{< copyable "shell-regular" >}}

```shell
kubectl logs -f -n <namespace> <release-name>-pump-<ordinal-id>
```

2. 缩容 Pump:

修改 `values.yaml` 文件中 `binlog.pump.replicas` 为 `2`,然后执行缩容操作:

{{< copyable "shell-regular" >}}

```shell
helm upgrade <release-name> pingcap/tidb-cluster -f values.yaml --version=<chart-version>
```