# Upgrading the `TiDB` Cluster

+ Online (rolling) upgrade
  + **`tiup cluster upgrade {cluster_name} {version}`**

+ Offline upgrade
  + Stopping a cluster
    + **`tiup cluster stop {cluster_name}`**

  + Offline upgrade
    + **`tiup cluster upgrade {cluster_name} {version} --offline`**

  + Start the cluster
    + **`tiup cluster start {cluster_name}`**

-------------------------------------------------------------
You can upgrade your cluster in one of the two ways: online upgrade and offline upgrade.

By default, `TiUP` Cluster upgrades the `TiDB` cluster using the online method, which means that the `TiDB` cluster can still provide services during the upgrade process. With the online upgrade, the leaders are migrated one by one on each node before the upgrade and restart. Therefore, for a large-scale cluster, it takes a long time to complete the entire upgrade operation. 

If your application has a maintenance window for the database to be stopped for maintenance, you can use the offline upgrade method to quickly perform the upgrade operation.

Online upgrade notices:
- An online upgrade upgrades all components one by one. During the upgrade of `TiKV`, all leaders in a `TiKV` instance are evicted before stopping the instance. The default timeout time is 5 minutes (300 seconds). The instance is directly stopped after this timeout time.
- You can use the `--force` parameter to upgrade the cluster immediately without evicting the leader. However, the errors that occur during the upgrade will be ignored, which means that you are not notified of any upgrade failure. Therefore, use the `--force` parameter with caution.
- To keep a stable performance, make sure that all leaders in a `TiKV` instance are evicted before stopping the instance. You can set `--transfer-timeout` to a larger value, for example, `--transfer-timeout 3600` (unit: second).
