Data Migration
DevKit 25.3.0 includes many changes and cannot be directly upgraded from earlier versions. You need to manually migrate historical data to the new version.
- Before installing DevKit 25.3.0, back up the current DevKit data. In the example, the original installation path is /opt and the backup path is /opt/DevKitBack.
mkdir -p /opt/DevKitBack cp -r /opt/DevKit /opt/DevKitBack
- After the backup is complete, uninstall the DevKit.
bash /opt/DevKit/tools/uninstall.sh
- Install the latest version (DevKit 25.3.0). For details, see Installation. In the example, the installation user is test1 and the installation directory is /opt.
The test1 user must have the read, write, and execute permissions on the /opt directory. Run the following commands as the root user:
setfacl -m u:test1:rwx /opt
To ensure that historical reports can be viewed, it is recommended that the installation directory be the same as that before the upgrade. Otherwise, the source file may fail to be found due to the directory change.
- After the installation is complete, run the following script as the root user to migrate data:
- Create a script.
vi data_migration.sh
- Press i to enter the insert mode and add the following information:
#!/bin/bash install_path="$1" old_install_path="$2" group_name1="$3" user_name1="$4" function main() { # Copy the database. del_frame_sqlite3 del_devkitplugins_sqlite3 # Copy logs in DevKit/logs. move_logs # Copy the reports in DevKit/workspace. move_workspace_report # Copy the remote node information of the performance group. move_node_ssh # Delete the clang_include directory of the matrix. (Duplicate files exist during a full upgrade of the Affinity Analyzer.) if [ -d "${install_path}/DevKit/tools/clang_include" ] && [[ "${install_path}" ]]; then rm -rf "${install_path}/DevKit/tools/clang_include" fi # Change the permission root to the owner group of the installation user.---- chown -R "${group_name1}":"${user_name1}" "${install_path}/DevKit/" echo_and_log "DevKit data is migrate successfully." "${SUCCESS}" } function del_frame_sqlite3() { local bak_frame_sql="${old_install_path}/DevKit/devkitframework/db.sqlite3" cp -rfp "${bak_frame_sql}" "${install_path}/DevKit/devkitframework/" if [ "0" != "$?" ]; then echo_and_log "Failed to restore framework sqlite3 file." "${ERROR}" exit 1 fi } function del_devkitplugins_sqlite3() { local bak_plugin_sql="${old_install_path}/DevKit/devkitplugins/sqlite/db.sqlite3" cp -rfp "${bak_plugin_sql}" "${install_path}/DevKit/devkitplugins/sqlite/" if [ "0" != "$?" ]; then echo_and_log "Failed to restore plugins sqlite3 file." "${ERROR}" exit 1 fi } function move_workspace_report() { local move_workspace_report="${old_install_path}/DevKit/workspace/" cp -rfp "${move_workspace_report}" "${install_path}/DevKit/" if [ "0" != "$?" ]; then echo_and_log "Failed to restore workspace file." "${ERROR}" fi } function move_logs() { local move_workspace_report="${old_install_path}/DevKit/logs/" cp -rfp "${move_workspace_report}" "${install_path}/DevKit/" if [ "0" != "$?" ]; then echo_and_log "Failed to restore Logs file." "${ERROR}" fi } # Migrate password-free data to the new directory. function move_node_ssh() { local old_node_ssh="${install_path}/DevKit/workspace/devadmin/ssh/sys_perf/install_node/" local new_node_ssh="${install_path}/DevKit/config/agent_space/ssh/sys_perf/" # Check whether the target path exists. If the target path does not exist, exit the function. if [ ! -e "${old_node_ssh}" ]; then return # Exit the current function. fi cp -rpf "${old_node_ssh}" "${new_node_ssh}" if [ $? == 0 ]; then echo_and_log "Successfully move node ssh files" "${SUCCESS}" else echo_and_log "Failed to copy node ssh files" "${ERROR}" # Optional error information fi } # Terminal and log printing: echo_and_log [info] [status] [log] function echo_and_log() { local info=$1 local status=$2 local log="" local type="32" if [ $# == 3 ]; then log=$3 # Optional if [ -L "${log}" ]; then echo -e "\e[1;31m The soft link file ${log} is detected. Exit the current operation.\e[0m" exit "${ERROR}" fi if [ ! -f "${log}" ]; then echo -e "\e[1;31m echo_and_log:${log} is not exist \e[0m" exit "${ERROR}" fi fi case "${status}" in 0) type="32";; # Green 1) type="31";; # Red 2) type="33";; # Yellow 3) type="37";; # White *) esac if [ -z "${log}" ]; then echo -e "\e[1;${type}m ${info} \e[0m" else if [ ! -f "${log}" ]; then echo -e "\e[1;31m echo_and_log:${log} is not exist \e[0m" exit "${ERROR}" fi echo -e "\e[1;${type}m ${info} \e[0m" | tee -a "${log}" fi } main - Press Esc, type :wq!, and press Enter to save the file and exit.
- Execute the script to migrate data.
bash data_migration.sh /opt /opt/DevKitBack test1 test1
The migration is successful if the following information is displayed:
DevKit data is migrate successfully.
- /opt: indicates the installation directory of the new DevKit version.
- /opt/DevKitBack: indicates the backup directory of the DevKit of the earlier version. Do not end with a slash (/).
- test1 test1: indicates the user group and user name used for installing the DevKit of the new version.
- Create a script.
- Log in to the DevKit and check whether historical reports can be viewed. If no problem is found, the data migration is successful. You can remove the backup files.
rm -rf /opt/DevKitBack
Parent topic: Common Operations