Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 升级TiDB Cluster-303 在线进行版本升级
Non-stop upgrade command:
tiup cluster upgrade
Check the current cluster version:
tiup cluster list
[tidb@node201 ~]$ tiup cluster list;
Name User Version Path PrivateKey
tidb-test tidb v6.1.0 /home/tidb/.tiup/storage/cluster/clusters/tidb-test /home/tidb/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa
The current version is v6.1.0
Check the cluster version list:
[tidb@node201 ~]$ tiup list tidb
[tidb@node201 ~]$ tiup list tidb | grep v6.1.*
v6.1.0 2022-06-13T12:30:16+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.1 2022-09-01T12:09:05+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.2 2022-10-24T15:16:17+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.3 2022-12-05T11:50:23+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.4 2023-02-08T11:34:10+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.5 2023-02-28T11:23:57+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.6 2023-04-12T11:05:35+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
v6.1.7 2023-07-12T11:22:57+08:00 darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
Upgrade the current cluster version from v6.1.0 to v6.1.1
tiup cluster upgrade tidb-test v6.1.1 [–force] [–transfer-timeout=600]
[–force]: Indicates that the upgrade can be forced if the local tikv leader has not migrated to other nodes.
[–transfer-timeout=600]: Indicates the time to wait for the leader nodes in the current tikv node to migrate to other nodes. If there are many tikv leader nodes, it is recommended to increase this parameter value.
Note: TiFlash versions before 5.3 do not support online upgrades and can only be upgraded offline.
[tidb@node201 ~]$ tiup cluster upgrade tidb-test v6.1.1
Before the upgrade, it is recommended to read the upgrade guide at Upgrade TiDB Using TiUP | PingCAP Docs and finish the preparation steps.
This operation will upgrade tidb v6.1.0 cluster tidb-test to v6.1.1:
will upgrade and restart component " pd" to “v6.1.1”,
will upgrade and restart component " tikv" to “v6.1.1”,
will upgrade and restart component " tidb" to “v6.1.1”,
will upgrade and restart component " prometheus" to “v6.1.1”,
will upgrade and restart component " grafana" to “v6.1.1”,
will upgrade and restart component " alertmanager" to “”,
will upgrade component “node-exporter” to “”,
will upgrade component “blackbox-exporter” to “”.
Do you want to continue? [y/N]:(default=N) y
…
Upgrading component tikv
Restarting instance 172.16.1.201:20160
Restart instance 172.16.1.201:20160 success
Evicting 1 leaders from store 172.16.1.202:20160…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Restarting instance 172.16.1.202:20160
Restart instance 172.16.1.202:20160 success
Evicting 1 leaders from store 172.16.1.203:20160…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Still waiting for 1 store leaders to transfer…
Restarting instance 172.16.1.203:20160
Restart instance 172.16.1.203:20160 success
…
Note that the tidb leader switch has a timeout, the default is 300 seconds.
After the upgrade is complete, check the version information:
[tidb@node201 ~]$ tiup cluster list
Name User Version Path PrivateKey
tidb-test tidb v6.1.1 /home/tidb/.tiup/storage/cluster/clusters/tidb-test /home/tidb/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa
At this point, the online version upgrade is complete.