实际操作:
1、下载4.0.12离线包
2、升级tiup
cd /data1/update_tidb tar xzvf tidb-community-server-v4.0.12-linux-amd64.tar.gz [root@host-172-21-210-40 update_tidb]# tiup -version v1.0.8 tiup Go Version: go1.13 Git Branch: master GitHash: 4276089 sh tidb-community-server-v4.0.12-linux-amd64/local_install.sh source /home/tidb/.bash_profile [tidb@host-172-21-210-40 update_tidb]$ tiup -version 1.4.0 tiup Go Version: go1.16.2 Git Ref: v1.4.0 GitHash: eb335e6ad9d0dc19d1c43db422cd409d62bc3cea
3、升级cluster
[root@host-172-21-210-40 ~]# tiup cluster --version Starting component `cluster`: --version tiup version v1.0.8 tiup Go Version: go1.13 Git Branch: master GitHash: 4276089 [root@host-172-21-210-40 update_tidb]# tiup update cluster component cluster version v1.4.0 is already installed Updated successfully!
4、升级集群(根据数据多少来定时间,数据越多时间越长)
[root@host-172-21-210-40 update_tidb]# tiup cluster upgrade tidb v4.0.12 Starting component `cluster`: /root/.tiup/components/cluster/v1.4.0/tiup-cluster upgrade tidb v4.0.12 This operation will upgrade tidb v4.0.4 cluster tidb to v4.0.12. Do you want to continue? [y/N]:(default=N) Upgrading cluster... + [ Serial ] - SSHKeySet: privateKey=/root/.tiup/storage/cluster/clusters/tidb/ssh/id_rsa, publicKey=/root/.tiup/storage/cluster/clusters/tidb/ssh/id_rsa.pub + [Parallel] - UserSSH: user=tidb, host=172.21.210.40 + [Parallel] - UserSSH: user=tidb, host=172.21.210.40 + [Parallel] - UserSSH: user=tidb, host=172.21.210.44 + [Parallel] - UserSSH: user=tidb, host=172.21.210.40 + [Parallel] - UserSSH: user=tidb, host=172.21.210.40 + [Parallel] - UserSSH: user=tidb, host=172.21.210.43 + [Parallel] - UserSSH: user=tidb, host=172.21.210.45 + [Parallel] - UserSSH: user=tidb, host=172.21.210.46 + [Parallel] - UserSSH: user=tidb, host=172.21.210.40 + [ Serial ] - Download: component=alertmanager, version=, os=linux, arch=amd64 + [ Serial ] - Download: component=tikv, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - Download: component=prometheus, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - Download: component=tidb, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - Download: component=grafana, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - Download: component=tiflash, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - Download: component=pd, version=v4.0.12, os=linux, arch=amd64 + [ Serial ] - BackupComponent: component=pd, currentVersion=v4.0.4, remote=172.21.210.40:/data1/tidb-deploy/pd-2379 + [ Serial ] - BackupComponent: component=tidb, currentVersion=v4.0.4, remote=172.21.210.40:/data1/tidb-deploy/tidb-4000 + [ Serial ] - BackupComponent: component=alertmanager, currentVersion=v4.0.4, remote=172.21.210.40:/data1/tidb-deploy/alertmanager-9093 + [ Serial ] - BackupComponent: component=tiflash, currentVersion=v4.0.4, remote=172.21.210.46:/data1/tidb-deploy/tiflash-9000 + [ Serial ] - BackupComponent: component=tikv, currentVersion=v4.0.4, remote=172.21.210.45:/data1/tidb-deploy/tikv-20160 + [ Serial ] - BackupComponent: component=tikv, currentVersion=v4.0.4, remote=172.21.210.43:/data1/tidb-deploy/tikv-20160 + [ Serial ] - BackupComponent: component=prometheus, currentVersion=v4.0.4, remote=172.21.210.40:/data1/tidb-deploy/prometheus-9090 + [ Serial ] - BackupComponent: component=grafana, currentVersion=v4.0.4, remote=172.21.210.40:/data1/tidb-deploy/grafana-3000 + [ Serial ] - BackupComponent: component=tikv, currentVersion=v4.0.4, remote=172.21.210.44:/data1/tidb-deploy/tikv-20160 + [ Serial ] - CopyComponent: component=pd, version=v4.0.12, remote=172.21.210.40:/data1/tidb-deploy/pd-2379 os=linux, arch=amd64 + [ Serial ] - CopyComponent: component=tidb, version=v4.0.12, remote=172.21.210.40:/data1/tidb-deploy/tidb-4000 os=linux, arch=amd64 + [ Serial ] - CopyComponent: component=alertmanager, version=, remote=172.21.210.40:/data1/tidb-deploy/alertmanager-9093 os=linux, arch=amd64 + [ Serial ] - CopyComponent: component=prometheus, version=v4.0.12, remote=172.21.210.40:/data1/tidb-deploy/prometheus-9090 os=linux, arch=amd64 + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.40, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/alertmanager-9093.service, deploy_dir=/data1/tidb-deploy/alertmanager-9093, data_dir=[/data1/tidb-data/alertmanager-9093], log_dir=/data1/tidb-deploy/alertmanager-9093/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.40, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/pd-2379.service, deploy_dir=/data1/tidb-deploy/pd-2379, data_dir=[/data1/tidb-data/pd-2379], log_dir=/data1/tidb-deploy/pd-2379/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - CopyComponent: component=tikv, version=v4.0.12, remote=172.21.210.44:/data1/tidb-deploy/tikv-20160 os=linux, arch=amd64 + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.40, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/tidb-4000.service, deploy_dir=/data1/tidb-deploy/tidb-4000, data_dir=[], log_dir=/data1/tidb-deploy/tidb-4000/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - CopyComponent: component=tikv, version=v4.0.12, remote=172.21.210.43:/data1/tidb-deploy/tikv-20160 os=linux, arch=amd64 + [ Serial ] - CopyComponent: component=tikv, version=v4.0.12, remote=172.21.210.45:/data1/tidb-deploy/tikv-20160 os=linux, arch=amd64 + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.40, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/prometheus-9090.service, deploy_dir=/data1/tidb-deploy/prometheus-9090, data_dir=[/data1/tidb-data/prometheus-9090], log_dir=/data1/tidb-deploy/prometheus-9090/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.44, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/tikv-20160.service, deploy_dir=/data1/tidb-deploy/tikv-20160, data_dir=[/data1/tidb-data/tikv-20160], log_dir=/data1/tidb-deploy/tikv-20160/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - CopyComponent: component=tiflash, version=v4.0.12, remote=172.21.210.46:/data1/tidb-deploy/tiflash-9000 os=linux, arch=amd64 + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.43, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/tikv-20160.service, deploy_dir=/data1/tidb-deploy/tikv-20160, data_dir=[/data1/tidb-data/tikv-20160], log_dir=/data1/tidb-deploy/tikv-20160/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.45, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/tikv-20160.service, deploy_dir=/data1/tidb-deploy/tikv-20160, data_dir=[/data1/tidb-data/tikv-20160], log_dir=/data1/tidb-deploy/tikv-20160/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - CopyComponent: component=grafana, version=v4.0.12, remote=172.21.210.40:/data1/tidb-deploy/grafana-3000 os=linux, arch=amd64 + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.40, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/grafana-3000.service, deploy_dir=/data1/tidb-deploy/grafana-3000, data_dir=[], log_dir=/data1/tidb-deploy/grafana-3000/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - InitConfig: cluster=tidb, user=tidb, host=172.21.210.46, path=/root/.tiup/storage/cluster/clusters/tidb/config-cache/tiflash-9000.service, deploy_dir=/data1/tidb-deploy/tiflash-9000, data_dir=[/data1/tidb-data/tiflash-9000], log_dir=/data1/tidb-deploy/tiflash-9000/log, cache_dir=/root/.tiup/storage/cluster/clusters/tidb/config-cache + [ Serial ] - UpgradeCluster Upgrading component tiflash Restarting instance 172.21.210.46 Restart 172.21.210.46 success Upgrading component pd Restarting instance 172.21.210.40 Restart 172.21.210.40 success Upgrading component tikv Evicting 2233 leaders from store 172.21.210.43:20160... Still waitting for 2233 store leaders to transfer... Still waitting for 2233 store leaders to transfer... Still waitting for 2233 store leaders to transfer... Still waitting for 2233 store leaders to transfer... Still waitting for 2232 store leaders to transfer... Still waitting for 2232 store leaders to transfer... Restarting instance 172.21.210.43 Restart 172.21.210.43 success Evicting 3350 leaders from store 172.21.210.44:20160... Still waitting for 3350 store leaders to transfer... Still waitting for 3350 store leaders to transfer... Still waitting for 3284 store leaders to transfer... Still waitting for 3284 store leaders to transfer... Still waitting for 3284 store leaders to transfer... Still waitting for 3284 store leaders to transfer... Still waitting for 145 store leaders to transfer... Still waitting for 145 store leaders to transfer... Restarting instance 172.21.210.44 Restart 172.21.210.44 success Evicting 3360 leaders from store 172.21.210.45:20160... Still waitting for 3360 store leaders to transfer... Still waitting for 3360 store leaders to transfer... Still waitting for 3360 store leaders to transfer... Still waitting for 3360 store leaders to transfer... Still waitting for 3215 store leaders to transfer... Still waitting for 3215 store leaders to transfer... Still waitting for 3215 store leaders to transfer... Still waitting for 79 store leaders to transfer... Still waitting for 79 store leaders to transfer... Still waitting for 79 store leaders to transfer... Still waitting for 79 store leaders to transfer... Restarting instance 172.21.210.45 Restart 172.21.210.45 success Upgrading component tidb Restarting instance 172.21.210.40 Restart 172.21.210.40 success Upgrading component prometheus Restarting instance 172.21.210.40 Restart 172.21.210.40 success Upgrading component grafana Restarting instance 172.21.210.40 Restart 172.21.210.40 success Upgrading component alertmanager Restarting instance 172.21.210.40 Restart 172.21.210.40 success Upgraded cluster `tidb` successfully