Skip to content

Commit

Permalink
tiup: add TiUP DM introduction and docs for command dm-restart and …
Browse files Browse the repository at this point in the history
…`dm-patch` (#5325)
  • Loading branch information
CharLotteiu authored Apr 16, 2021
1 parent c6aa3d2 commit 4abe9e6
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 0 deletions.
73 changes: 73 additions & 0 deletions tiup/tiup-component-dm-patch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: tiup dm patch
---

# tiup dm patch

If you need to dynamically replace the binaries of a service while the cluster is running (that is, to keep the cluster available during the replacement), you can use the `tiup dm patch` command. The command does the following:

- Uploads the binary package for replacement to the target machine.
- Takes the related nodes offline using the API.
- Stops the target service.
- Unpacks the binary package and replaces the service.
- Starts the target service.

## Syntax

```shell
tiup dm patch <cluster-name> <package-path> [flags]
```

- `<cluster-name>`: The name of the cluster to be operated.
- `<package-path>`: The path to the binary package used for replacement.

### Preparation

You need to pack the binary package required for this command in advance according to the following steps:

- Determine the name `${component}` of the component to be replaced (dm-master, dm-worker ...), the `${version}` of the component (v2.0.0, v2.0.1 ...), and the operating system `${os}` and platform `${arch}` on which the component runs.
- Download the current component package using the command `wget https://tiup-mirrors.pingcap.com/${component}-${version}-${os}-${arch}.tar.gz -O /tmp/${component}-${version}-${os}-${arch}.tar.gz`.
- Run `mkdir -p /tmp/package && cd /tmp/package` to create a temporary directory to pack files.
- Run `tar xf /tmp/${component}-${version}-${os}-${arch}.tar.gz` to unpack the original binary package.
- Run `find .` to view the file structure in the temporary package directory.
- Copy the binary files or configuration files to the corresponding locations in the temporary directory.
- Run `tar czf /tmp/${component}-hotfix-${os}-${arch}.tar.gz *` to pack the files in the temporary directory.
- Finally, you can use `/tmp/${component}-hotfix-${os}-${arch}.tar.gz` as the value of `<package-path>` in the `tiup dm patch` command.

## Options

### --overwrite

- After you patch a certain component (such as dm-worker), when the tiup-dm scales out the component, tiup-dm uses the original component version by default. To use the version that you patch when the cluster scales out in the future, you need to specify the option `--overwrite` in the command.
- Data type: `BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

### -N, --node

- Specifies the nodes to be replaced. The value of this option is a comma-separated list of node IDs. You can get the node IDs from the first column of the cluster status table returned by the `[tiup dm display](/tiup/tiup-component-dm-display.md)` command.
- Data type: `STRING`
- If this option is not specified, TiUP selects all nodes to replace by default.

> **Note:**
>
> If the option `-R, --role` is specified at the same time, TiUP then replaces service nodes that match both the requirements of `-N, --node` and `-R, --role`.
### -R, --role

- Specifies the roles to be replaced. The value of this option is a comma-separated list of the roles of the nodes. You can get the roles of the nodes from the second column of the cluster status table returned by the `[tiup dm display](/tiup/tiup-component-dm-display.md)` command.
- Data type: `STRING`
- If this option is not specified, TiUP selects all roles to replace by default.

> **Note:**
>
> If the option `-N, --node` is specified at the same time, TiUP then replaces service nodes that match both the requirements of `-N, --node` and `-R, --role`.
### -h, --help

- Prints help information.
- Data type: `BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

## Outputs

The execution log of tiup-dm.
51 changes: 51 additions & 0 deletions tiup/tiup-component-dm-restart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: tiup dm restart
---

# tiup dm restart

The command `tiup dm restart` is used to restart all or some of the services of the specified cluster.

> **Note:**
>
> During the restart process, the related services are unavailable for a period of time.
## Syntax

```shell
tiup dm restart <cluster-name> [flags]
```

`<cluster-name>`: the name of the cluster to operate on. If you forget the cluster name, you can check it with the [cluster list](/tiup/tiup-component-cluster-list.md) command.

## Options

### -N, --node

- Specifies the nodes to be restarted. The value of this option is a comma-separated list of node IDs. You can get the node IDs from the first column of the cluster status table returned by the `[tiup dm display](/tiup/tiup-component-dm-display.md)` command.
- Data type: `STRING`
- If this option is not specified, TiUP restarts all nodes by default.

> **Note:**
>
> If the option `-R, --role` is specified at the same time, TiUP restarts service nodes that match both the requirements of `-N, --node` and `-R, --role`.
### -R, --role

- Specifies the roles of nodes to be restarted. The value of this option is a comma-separated list of the roles of the nodes. You can get the roles of the nodes from the second column of the cluster status table returned by the `[tiup dm display](/tiup/tiup-component-dm-display.md)` command.
- Data type: `STRING`
- If this option is not specified, TiUP restarts nodes of all roles by default.

> **Note:**
>
> If the option `-N, --node` is specified at the same time, TiUP restarts service nodes that match both the requirements of `-N, --node` and `-R, --role`.
### -h, --help

- Prints help information.
- Data type: `BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

## Outputs

The log of the service restart process.
79 changes: 79 additions & 0 deletions tiup/tiup-component-dm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: TiUP DM
---

# TiUP DM

Similar to [TiUP Cluster](/tiup/tiup-component-cluster.md) which is used to manage TiDB clusters, TiUP DM is used to manage DM clusters. You can use the TiUP DM component to perform daily operations and maintenance tasks of DM clusters, including deploying, starting, stopping, destroying, elastic scaling, upgrading DM clusters, and managing the configuration parameters of DM clusters.

## Syntax

```shell
tiup dm [command] [flags]
```

`[command]` is used to pass the name of the command. See the [command list](#list-of-commands) for supported commands.

## Options

### --ssh

- Specifies the SSH client to connect to the remote end (the machine where the TiDB service is deployed) for the command execution.
- Data type:`STRING`
- Support values:

- `builtin`: Uses the built-in easyssh client of tiup-cluster as the SSH client.
- `system`: Uses the default SSH client of the current operating system.
- `none`: No SSH client is used. The deployment is only for the current machine.

- If this option is not specified in the command, `builtin` is used as the default value.

### --ssh-timeout

- Specifies the SSH connection timeout in seconds.
- Data type: `UINT`
- If this option is not specified in the command, the default timeout is `5` seconds.

### --wait-timeout

- Specifies the maximum waiting time (in seconds) for each step in the operation process. The operation process consists of many steps, such as specifying systemctl to start or stop services, and waiting for ports to be online or offline. Each step may take several seconds. If the execution time of a step exceeds the specified timeout, the step exits with an error.
- Data type:`UINT`
- If this option is not specified in the command, the maximum waiting time for each steps is `120` seconds.

### -y, --yes

- Skips the secondary confirmation of all risky operations. It is not recommended to use this option unless you use a script to call TiUP.
- Data type:`BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

### -v, --version

- Prints the current version of TiUP DM.
- Data type:`BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

### -h, --help

- Prints help information about the specified command.
- Data type: `BOOLEAN`
- This option is disabled by default with the `false` value. To enable this option, add this option to the command, and either pass the `true` value or do not pass any value.

## List of commands

- [import](/tiup/tiup-component-dm-import.md): Imports a DM v1.0 cluster deployed by DM-Ansible.
- [deploy](/tiup/tiup-component-dm-deploy.md): Deploys a cluster based on a specified topology.
- [list](/tiup/tiup-component-dm-list.md): Queries the list of deployed clusters.
- [display](/tiup/tiup-component-dm-display.md): Displays the status of a specified cluster.
- [start](/tiup/tiup-component-dm-start.md): Starts a specified cluster.
- [stop](/tiup/tiup-component-dm-stop.md): Stops a specified cluster.
- [restart](/tiup/tiup-component-dm-restart.md): Restarts a specified cluster.
- [scale-in](/tiup/tiup-component-dm-scale-in.md): Scales in a specified cluster.
- [scale-out](/tiup/tiup-component-dm-scale-out.md): Scales out a specified cluster.
- [upgrade](/tiup/tiup-component-dm-upgrade.md): Upgrades a specified cluster.
- [prune](/tiup/tiup-component-dm-prune.md): Cleans up instances in the Tombstone status for a specified cluster.
- [edit-config](/tiup/tiup-component-dm-edit-config.md): Modifies the configuration of a specified cluster.
- [reload](/tiup/tiup-component-dm-reload.md): Reloads the configuration of a specified cluster.
- [patch](/tiup/tiup-component-dm-patch.md): Replaces a specified service in a deployed cluster.
- [destroy](/tiup/tiup-component-dm-destroy.md): Destroys a specified cluster.
- [audit](/tiup/tiup-component-dm-audit.md): Queries the operation audit log of a specified cluster.
- [help](/tiup/tiup-component-dm-help.md): Prints help information.

0 comments on commit 4abe9e6

Please sign in to comment.