github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/tiup/upgrade-tidb.sh (about) 1 #!/bin/bash 2 3 set -eu 4 5 CLUSTER_NAME="dm-v2" 6 7 DM_VER=$2 8 9 CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 10 PATH=$CUR/../_utils:$PATH # for sync_diff_inspector 11 12 source $CUR/lib.sh 13 14 function deploy_dm() { 15 # install TiUP-DM 16 curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh 17 source /root/.profile 18 tiup install dm 19 20 tiup install dmctl:$DM_VER 21 22 tiup dm deploy --yes $CLUSTER_NAME $DM_VER $CUR/conf/topo.yaml 23 tiup dm start --yes $CLUSTER_NAME 24 } 25 26 function migrate_before_upgrade() { 27 exec_full_stage 28 29 tiup dmctl:$DM_VER --master-addr=master1:8261 operate-source create $CUR/conf/source1.yaml 30 tiup dmctl:$DM_VER --master-addr=master1:8261 operate-source create $CUR/conf/source2.yaml 31 32 tiup dmctl:$DM_VER --master-addr=master1:8261 start-task $CUR/conf/task.yaml 33 34 exec_incremental_stage1 35 36 check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 37 } 38 39 function migrate_after_upgrade() { 40 exec_incremental_stage2 41 42 sleep 10 43 44 check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 45 46 tiup dmctl:$DM_VER --master-addr=master1:8261 stop-task $TASK_NAME 47 } 48 49 function destroy_v2_by_tiup() { 50 tiup dm destroy --yes $CLUSTER_NAME 51 } 52 53 # run this before upgrade TiDB. 54 function before_upgrade() { 55 install_sync_diff 56 57 deploy_dm 58 59 migrate_before_upgrade 60 } 61 62 # run this after upgrade TiDB. 63 function after_upgrade() { 64 migrate_after_upgrade 65 66 # destroy_v2_by_tiup 67 } 68 69 $1