# Upgrading TiDB Clusters

__*TiDB version upgrade*__
__*TiDB non-disruptive upgrades*__
__*TiDB downtime upgrade*__

+ No-downtime upgrades
  + `tiup cluster upgrade <cluster-name> <version>`

+ Downtime upgrade
  + Stopping a cluster
    + `tiup cluster stop <cluster-name>`

  + Offline upgrades
    + `tiup cluster upgrade <cluster-name> <version> --offline`

  + Start a cluster
    + `tiup cluster start <cluster-name>`


-------------------------------------------------------------
There are two ways to upgrade: non-disruptive upgrades and downtime upgrades. TiUP Cluster The default way to upgrade a TiDB cluster is to upgrade a TiDB cluster without downtime, that is, the cluster can still provide external services during the upgrade process. When upgrading, the leader is migration to each node one by one before upgrading and restart, so it takes a long time to complete the entire upgrade operation for large-scale clusters. If the business has a maintenance window for database downtime maintenance, you can use the downtime upgrade method to quickly perform the upgrade operation.

No-downtime upgrades
tiup cluster upgrade <cluster-name><version>

Note:
- A rolling update will upgrade all components one by one. During the TiKV upgrade, all leaders on TiKV will be cut off one by one and then the TiKV instance will be stopped. The default time-out period is 5 minutes (300 seconds), after which the instance is stopped.
- If you do not want to evict the leader and want to quickly upgrade the cluster to a new version, you can specify —force in the above command. This method will cause performance jitter and no data loss.
- If you want to maintain stable performance, you need to ensure that all leaders on TiKV are evicted before stopping the TiKV instance. You can specify —transfer-timeout as a larger value, such as —transfer-timeout 3600, in seconds.
- When upgrading from older versions prior to 5.3 to 5.3 and later versions, online upgrade of TiFlash is not supported. You can only shut down the TiFlash instance first, upgrade the cluster offline, and then reload the entire cluster to ensure that components other than TiFlash do not stop upgrading.

Downtime upgrade
Before an outage upgrade, you first need to shut down the entire cluster.
tiup cluster stop <cluster-name>

After that, add the —offline parameter with the upgrade command to upgrade the downtime.
tiup cluster upgrade <cluster-name><version>—offline

The cluster does not start automatically after the upgrade is complete. You need to use the start command to start the cluster.
TIUP CLUSTER START <cluster-name>