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

*: add TiDB 2.1 Upgrade Guide #780

Merged
merged 7 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
- [Scale Using Ansible](op-guide/ansible-deployment-scale.md)
+ Upgrade
- [Upgrade the Component Version](op-guide/ansible-deployment-rolling-update.md#upgrade-the-component-version)
- [TiDB 2.0 Upgrade Guide](op-guide/tidb-v2-upgrade-guide.md)
- [TiDB 2.0 Upgrade Guide](op-guide/tidb-v2.0-upgrade-guide.md)
- [TiDB 2.1 Upgrade Guide](op-guide/tidb-v2.1-upgrade-guide.md)
- [Tune Performance](op-guide/tune-tikv.md)
+ Backup and Migrate
- [Backup and Restore](op-guide/backup-restore.md)
Expand Down
5 changes: 4 additions & 1 deletion op-guide/ansible-deployment-rolling-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ When you perform a rolling update for a TiDB cluster, the service is shut down s

## Upgrade the component version

- To upgrade between large versions, you need to upgrade [`tidb-ansible`](https://github.com/pingcap/tidb-ansible). If you want to upgrade the version of TiDB from 1.0 to 2.0, see [TiDB 2.0 Upgrade Guide](../op-guide/tidb-v2-upgrade-guide.md).
- To upgrade between large versions, you must upgrade [`tidb-ansible`](https://github.com/pingcap/tidb-ansible).

- To upgrade the TiDB version from 1.0 to 2.0, see [TiDB 2.0 Upgrade Guide](../op-guide/tidb-v2.0-upgrade-guide.md).
- To upgrade the TiDB version from 2.0 to 2.1, see [TiDB 2.1 Upgrade Guide](../op-guide/tidb-v2.1-upgrade-guide.md).

- For a minor upgrade, it is also recommended to update `tidb-ansible` for the latest configuration file templates, features, and bug fixes.

Expand Down
5 changes: 3 additions & 2 deletions op-guide/ansible-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ You can use the TiDB-Ansible configuration file to set up the cluster topology a
- [Modify component configuration](../op-guide/ansible-deployment-rolling-update.md#modify-component-configuration)
- [Scale the TiDB cluster](../op-guide/ansible-deployment-scale.md)
- [Upgrade the component version](../op-guide/ansible-deployment-rolling-update.md#upgrade-the-component-version)
- [Enable the cluster binlog](../tools/tidb-binlog-cluster.md)
- [Clean up data of the TiDB cluster](../op-guide/ansible-operation.md#clean-up-cluster-data)
- [Destroy the TiDB cluster](../op-guide/ansible-operation.md#destroy-a-cluster)

Expand Down Expand Up @@ -128,8 +129,8 @@ Make sure you have logged in to the Control Machine using the `root` user accoun

| tidb-ansible branch | TiDB version | Note |
| ------------------- | ------------ | ---- |
| release-2.0 | 2.0 version | This is the latest stable version. You can use it in production. |
| release-2.1 | 2.1 version | The latest 2.1 RC version. It is not recommended to use it in the production environment. |
| release-2.0 | 2.0 version | The latest 2.0 stable version. You can use it in the production environment. |
| release-2.1 | 2.1 version | The latest 2.1 stable version. You can use it in the production environment (recommended). |
| master | master version | This version includes the latest features with a daily update. |

2. Download the corresponding TiDB-Ansible branch from the [TiDB-Ansible project](https://github.com/pingcap/tidb-ansible). The default folder name is `tidb-ansible`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ category: deployment

This document describes how to upgrade from TiDB 1.0 or TiDB 2.0 RC version to TiDB 2.0 GA version.

## Install Ansible and dependencies in the Control Machine
## Step 1: Install Ansible and dependencies in the Control Machine

TiDB-Ansible release-2.0 depends on Ansible 2.4.2 or later, and is compatible with the latest Ansible 2.5. In addition, TiDB-Ansible release-2.0 depends on the Python module: `jinja2>=2.9.6` and `jmespath>=0.9.0`.

Expand All @@ -31,13 +31,13 @@ Version: 0.9.0
>
> - You must install Ansible and its dependencies following the above procedures.
> - Make sure that the Jinja2 version is correct, otherwise an error occurs when you start Grafana.
> - Make sure that the jmespath is correct, otherwise an error occurs when you perform a rolling update for TiKV.
> - Make sure that the jmespath version is correct, otherwise an error occurs when you perform a rolling update for TiKV.

## Download TiDB-Ansible to the Control Machine
## Step 2: Download TiDB-Ansible to the Control Machine

1. Login to the Control Machine using the `tidb` user account and enter the `/home/tidb` directory.
1. Log in to the Control Machine using the `tidb` user account and enter the `/home/tidb` directory.

2. Back up the `tidb-ansible` folders of TiDB 1.0 OR TiDB 2.0 RC versions using the following command:
2. Back up the `tidb-ansible` folders of TiDB 1.0 or TiDB 2.0 RC versions using the following command:

```
$ mv tidb-ansible tidb-ansible-bak
Expand All @@ -49,9 +49,9 @@ Version: 0.9.0
$ git clone -b release-2.0 https://github.com/pingcap/tidb-ansible.git
```

## Edit the `inventory.ini` file and the configuration file
## Step 3: Edit the `inventory.ini` file and the configuration file

Login to the Control Machine using the `tidb` user account and enter the `/home/tidb/tidb-ansible` directory.
Log in to the Control Machine using the `tidb` user account and enter the `/home/tidb/tidb-ansible` directory.

### Edit the `inventory.ini` file

Expand Down Expand Up @@ -96,21 +96,21 @@ readpool:

For the cluster topology of multiple TiKV instances on a single machine, you need to modify the three parameters above. Recommended configuration: `number of instances * parameter value = number of CPU cores * 0.8`.

## Download TiDB 2.0 binary to the Control Machine
## Step 4: Download TiDB 2.0 binary to the Control Machine

Make sure that `tidb_version = v2.0.4` in the `tidb-ansible/inventory.ini` file, and then run the following command to download TiDB 2.0 binary to the Control Machine:

```
$ ansible-playbook local_prepare.yml
```

## Perform a rolling update to TiDB cluster components
## Step 5: Perform a rolling update to TiDB cluster components

```
$ ansible-playbook rolling_update.yml
```

## Perform a rolling update to TiDB monitoring component
## Step 6: Perform a rolling update to TiDB monitoring component

To meet the users' demand on mixed deployment, the systemd service of the monitoring component is distinguished by port.

Expand Down
117 changes: 117 additions & 0 deletions op-guide/tidb-v2.1-upgrade-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
title: TiDB 2.1 Upgrade Guide
summary: Learn how to upgrade from TiDB 2.0 (TiDB 2.0.1 or later) or TiDB 2.1 RC version to TiDB 2.1 GA version.
category: deployment
---

# TiDB 2.1 Upgrade Guide

This document describes how to upgrade from TiDB 2.0 (TiDB 2.0.1 or later) or TiDB 2.1 RC version to TiDB 2.1 GA version. TiDB 2.1 is not compatible with the Kafka version of TiDB-Binlog. If your current TiDB cluster has already been using the [Kafka version of TiDB-Binlog](../tools/tidb-binlog-kafka.md), you need to [upgrade it to the cluster version of TiDB-Binlog](../tools/tidb-binlog-cluster.md#tidb-binlog-upgrade).

## Step 1: Install Ansible and dependencies on the Control Machine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a description of how to do a rolling update without Ansible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gregwebs Currently, we only provide the Ansible approach, which is also the recommended one. (I've checked with @liubo0127 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we describe in abstract terms what Ansible is doing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I see it here, would be good to link there.


TiDB-Ansible release-2.1 depends on Ansible 2.4.2 ~ 2.7.0 (`ansible>=2.4.2,<2.7.0`) and the Python module `jinja2>=2.9.6` and `jmespath>=0.9.0`.

To make it easy to manage dependencies, use `pip` to install Ansible and its dependencies. For details, see [Install Ansible and its dependencies on the Control Machine](../op-guide/ansible-deployment.md#step-4-install-ansible-and-its-dependencies-on-the-control-machine). For offline environment, see [Install Ansible and its dependencies offline on the Control Machine](../op-guide/offline-ansible-deployment.md#step-3-install-ansible-and-its-dependencies-offline-on-the-control-machine).

After the installation is finished, you can view the version information using the following command:

```bash
$ ansible --version
ansible 2.6.8
$ pip show jinja2
Name: Jinja2
Version: 2.10
$ pip show jmespath
Name: jmespath
Version: 0.9.3
```

> **Note:**
>
> - You must install Ansible and its dependencies following the above procedures.
> - Make sure that the Jinja2 version is correct, otherwise an error occurs when you start Grafana.
> - Make sure that the jmespath version is correct, otherwise an error occurs when you perform a rolling update for TiKV.

## Step 2: Download TiDB-Ansible to the Control Machine

1. Log in to the Control Machine using the `tidb` user account and enter the `/home/tidb` directory.

2. Back up the `tidb-ansible` folders of TiDB 2.0 or TiDB 2.1 RC versions using the following command:

```
$ mv tidb-ansible tidb-ansible-bak
```

3. Download the latest tidb-ansible `release-2.1` branch using the following command. The default folder name is `tidb-ansible`.

```
$ git clone -b release-2.1 https://github.com/pingcap/tidb-ansible.git
```

## Step 3: Edit the `inventory.ini` file and the configuration file

Log in to the Control Machine using the `tidb` user account and enter the `/home/tidb/tidb-ansible` directory.

### Edit the `inventory.ini` file

Edit the `inventory.ini` file. For IP information, see the `/home/tidb/tidb-ansible-bak/inventory.ini` backup file.

Pay special attention to the following variables configuration. For variable meaning, see [Description of other variables](../op-guide/ansible-deployment.md#edit-other-variables-optional).

1. Make sure that `ansible_user` is the normal user. For unified privilege management, remote installation using the root user is no longer supported. The default configuration uses the `tidb` user as the SSH remote user and the program running user.

```ini
## Connection
# ssh via normal user
ansible_user = tidb
```

You can refer to [How to configure SSH mutual trust and sudo rules on the Control Machine](../op-guide/ansible-deployment.md#step-5-configure-the-ssh-mutual-trust-and-sudo-rules-on-the-control-machine) to automatically configure the mutual trust among hosts.

2. Keep the `process_supervision` variable consistent with that in the previous version. It is recommended to use `systemd` by default.

```ini
# process supervision, [systemd, supervise]
process_supervision = systemd
```

If you need to modify this variable, see [How to modify the supervision method of a process from `supervise` to `systemd`](../op-guide/ansible-deployment.md#how-to-modify-the-supervision-method-of-a-process-from-supervise-to-systemd). Before you upgrade, first use the `/home/tidb/tidb-ansible-bak/` backup branch to modify the supervision method of a process.

### Edit the configuration file of TiDB cluster components

If you have previously customized the configuration file of TiDB cluster components, refer to the backup file to modify the corresponding configuration file in `/home/tidb/tidb-ansible/conf`.

In TiKV configuration, `end-point-concurrency` is changed to three parameters: `high-concurrency`, `normal-concurrency` and `low-concurrency`.

```yaml
readpool:
coprocessor:
# Notice: if CPU_NUM > 8, default thread pool size for coprocessors
# will be set to CPU_NUM * 0.8.
# high-concurrency: 8
# normal-concurrency: 8
# low-concurrency: 8
```

For the cluster topology of multiple TiKV instances on a single machine, you need to modify the three parameters above. Recommended configuration: `number of instances * parameter value = number of CPU cores * 0.8`.

## Step 4: Download TiDB 2.1 binary to the Control Machine

Make sure that `tidb_version = v2.1.0` in the `tidb-ansible/inventory.ini` file, and then run the following command to download TiDB 2.1 binary to the Control Machine:

```
$ ansible-playbook local_prepare.yml
```

## Step 5: Perform a rolling update to TiDB cluster components

```
$ ansible-playbook rolling_update.yml
```

## Step 6: Perform a rolling update to TiDB monitoring component

```
$ ansible-playbook rolling_update_monitor.yml
```
Loading