Performing Full Restoration on the Kunpeng Node
Restore the backup data of the x86 node to the Kunpeng node to ensure the complete data migration.
- Install and configure MySQL on the Kunpeng server.
- Install MySQL. For details, see the MySQL Installation Guide.
Select a MySQL version as required. This section describes how to install MySQL 8.0.36 using an RPM package.
- Initialize the MySQL configuration.
- Modify the MySQL configuration file /etc/my.cnf as follows:
[mysqld_safe] log-error=/data/mysql/log/mysql.log pid-file=/data/mysql/run/mysqld.pid [mysqldump] quick [mysql] no-auto-rehash [client] default-character-set=utf8 [mysqld] basedir=/usr/local/mysql socket=/data/mysql/run/mysql.sock tmpdir=/data/mysql/tmp datadir=/data/mysql/data default_authentication_plugin=caching_sha2_password port=3306 user=mysql server-id=3 # The server-id of the secondary database 2 (Kunpeng) server is 3. log-bin=/data/mysql/data/mysql-bin relay_log=/data/mysql/relaylog/relay-bin report_host=192.168.0.3 # 192.168.0.3 is the IP address of the secondary database 2 (Kunpeng) server. Change it based on the actual IP address.
If MySQL is installed using the RPM package, skip the rest of this section and go to 2.
- Change the user group and user permission on the /etc/my.cnf file to mysql:mysql.
chown mysql:mysql /etc/my.cnf
- To enable MySQL to run as a service, add MySQL to the system service and change the user group and user permission of /etc/init.d/mysql to mysql:mysql.
chmod 755 /usr/local/mysql/support-files/mysql.server cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chkconfig mysql on chown -R mysql:mysql /etc/init.d/mysql ll /etc/init.d/mysql

- Configure the environment variable.
After MySQL is installed, add the path of the MySQL binary file to the environment variable.
- Open the /etc/profile file.
vi /etc/profile
- Press i to enter the insert mode and add the following content to the end of the file:
export PATH=$PATH:/usr/local/mysql/bin
In the command, /usr/local/mysql/bin in PATH is the absolute path of the bin file in the MySQL installation directory. Change the path as required to match your installation.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Make the environment variable configurations take effect.
source /etc/profile
- Open the /etc/profile file.
- Modify the MySQL configuration file /etc/my.cnf as follows:
- Install MySQL. For details, see the MySQL Installation Guide.
- Change the owner of the data backup directory (for example, /data/mysql/data.bak/full) to mysql:mysql.
chown -R mysql:mysql /data/mysql/data.bak/full
- Restore the backup data to the MySQL data directory.
/usr/local/xtrabackup/bin/xtrabackup --move-back --target-dir=/data/mysql/data.bak/full chown -R mysql:mysql /data/mysql/data/*
When --move-back is used to restore data, the received backup file is moved to the default /data/mysql/data directory. If you want to retain the original backup file, replace --move-back with --datadir and specify the target directory to which the backup file is copied. Please note that the copy speed is slow.
Execution result:
After the data is moved, you can check the /data/mysql/data directory.ll /data/mysql/data

- Start the MySQL service of the secondary database.
mysqld --defaults-file=/etc/my.cnf &
or
/usr/sbin/mysqld --defaults-file=/etc/my.cnf &
If MySQL is installed by compiling the source code, run the following command to start the MySQL service:
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf &