Rate This Document
Findability
Accuracy
Completeness
Readability

Performing a Full Backup of an x86 Node

This section describes how to fully back up MySQL on the x86 secondary database node where MySQL primary/secondary replication has been deployed. The operations include preparing for the backup, backing up data, checking backup consistency, and transferring the backup data to another Kunpeng secondary database server.

If MySQL is deployed in primary/secondary replication mode, perform full backup on any secondary database. If MySQL is deployed in standalone mode, you are advised to perform full backup when the server is idle. This section uses the former case as an example.

  1. Create a directory for storing backup data on the x86 secondary database server.
    mkdir -p /data/mysql/data.bak/full
  2. Ensure that the MySQL service of the x86 secondary database is enabled.

    Run the following command to check whether the mysqld process exists:

    ps -ef | grep mysqld

    Expected result: The mysqld process is displayed, indicating that the MySQL service is enabled.

    If the mysqld process does not exist, start the MySQL service. For details about how to start the MySQL service, see 3.

  3. Change the maximum number of the files that can be opened in the system.
    ulimit -n 10240

    During the backup, there may be a large number of database files, so the number of files that can be opened may reach the system limit. It is recommended that this limit be raised temporarily.

  4. Perform a full backup on the x86 secondary database.
    /home/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --defaults-file=/etc/my.cnf --user=root --password=123456 --socket=/data/mysql/run/mysql.sock --backup --target-dir=/data/mysql/data.bak/full

    Table 1 describes the parameters in the preceding commands.

    Table 1 Backup parameters of Percona XtraBackup

    Parameter

    Description

    --defaults-file

    Default path of the database configuration file

    --user

    User, which provides options of the root user, or registering as the user dedicated to backup operations.

    --password

    Database password

    --databases

    Database. Specifies a database for backup. If not specified, all databases are backed up. If the database name is specified, the backup file does not contain the mysql, sys, and performance_schema system databases. Manually initialize the system databases before restoring the secondary database.

    --action

    Operation option. The value can be backup, prepare, copy-back, or move-back.

    --target-dir

    Path of the output backup file

    --datadir

    Used together with --copy-back to specify the data directory of the database during data restoration.

    Expected result:

  5. Check the backup consistency.

    After the backup is complete, run xtrabackup --prepare to verify the consistency of the backup data and ensure that the backup log file is consistent with the current database log file.

    Run the following command on the x86 secondary database:

    /home/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --prepare --target-dir=/data/mysql/data.bak/full

    Expected result:

    If the backup data is inconsistent with the latest data in the database, you are advised to perform the backup again.

  6. Transfer the backup data.
    1. If the backup data needs to be transferred to the Kunpeng secondary database server, create a directory on the server first.
      mkdir /data/mysql/data.bak/
    2. Run scp on the x86 secondary database server to transfer the backup data to the Kunpeng secondary database server.
      scp -r /data/mysql/data.bak/full 192.168.0.3:/data/mysql/data.bak/

      192.168.0.3 is the IP address of the secondary database 2 (Kunpeng) server. Change it based on the actual IP address.