No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

HUAWEI CLOUD Stack 6.5.0 Backup and Restoration Guide 03

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Full Data Restoration

Full Data Restoration

Scenarios

The same GaussdbHA database is deployed for VPC, Combined API, Task Center, SDR, and CCS. The database backs up the data of all services in one backup package. This section describes how to restore all data of these services.

You need to roll back the system to restore data in any of the following scenarios:

  • After an important operation, such as upgrade or critical data modification, is performed for the system, an exception occurs or the operation has not achieved the expected result.
  • The disks or OSs of both the active and standby DMK nodes are faulty, and the node data is lost.
  • Data is damaged due to misoperations.
NOTE:

For services that are not deployed together with other services, such as Auto Scaling (AS), perform operations described in this section when you need to restore data.

Prerequisites

  • A local PC that can communicate with the database nodes is available.
  • You have obtained IP addresses of the active and standby nodes and the passwords of OS accounts root, gaussdb, and dbadmin as well as the database administrator account dbadmin if the database nodes are deployed in active/standby mode.
    NOTE:

    The default password of user root is Cloud12#$, that of user gaussdb is Huawei@123, that of user dbadmin is Manager@123, and that of the database administrator account dbadmin is Manager@123.

  • The database is running properly.
  • If the backup data stored on the third-party server is required, ensure that the following conditions are met:
    • The local PC communicates with the third-party backup server properly.
    • You have obtained the IP address of the third-party backup server.
    • You have obtained the password of user root for the third-party backup server.
  • An application, such as PuTTY, which can be used for remote access on various platforms, is available.
  • You have obtained a network transfer tool, such as WinSCP.

Procedure

Preparing Data

  1. Log in to the PUB-DB01 node using PuTTY.

    The default account is gaussdb. The default password is Huawei@123.

  2. Run the following command and enter the password of the root user as prompted to switch to the root user (the default password is Cloud12#$):

    sudo su - root

  3. Run the following command to view the database status and check whether the currently logged-in node is the active one:

    service had query

    Information similar to that shown in Figure 2-1 is displayed. If active is displayed in the ROLE column, the current node is the active node.

    Figure 2-1 Database status

  4. Check whether the currently logged-in node is the active one based on the command output in Step 3.

  5. Run the following command to disable user logout upon system timeout:

    TMOUT=0

  6. Run the following command to check backup files in the backup directory:

    ll /opt/backup/DB

    [root@PUB-DB01 fsp]# ll /opt/backup/DB/
    total 121096
    -rw-------. 1 dbadmin gaussdb 10282499 Apr  2 04:10 cn-south-1FAT-METERTICKET-TASKCENTER-TASKMGR-CONSOLE-CCS-VPC-20190402D001.tar.gz
    -rw-------. 1 dbadmin gaussdb 15256811 Apr  2 20:00 cn-south-1FAT-METERTICKET-TASKCENTER-TASKMGR-CONSOLE-CCS-VPC-20190402D003.tar.gz
    -rw-------. 1 dbadmin gaussdb 10682461 Apr  3 00:10 cn-south-1FAT-METERTICKET-TASKCENTER-TASKMGR-CONSOLE-CCS-VPC-20190403D004.tar.gz

  7. Check whether the backup file that meets data restoration requirements exists in the directory based on the command output in Step 6.

  8. Run the following command to log in to the third-party backup server:

    sftp Third-party backup server login name@IP address of the third-party backup server

  9. Run the following command to query the files on the third-party backup server and locate the file to be downloaded:

    cd /sftpuser/

    sftpuser indicates the backup file path of the third-party backup server.

  10. Run the following command to download the file queried in Step 9 to the specified directory on the current node:

    get Backup data compression file /tmp/

    Example:

    get XXFAT-METERTICKET-VPC-CCS-TASKMGR-CONSOLE-TASKCENTER-20180418D001.tar.gz /tmp/

Restoring Data

  1. Use PuTTY to log in to the active database node.

    The default account is gaussdb. The default password is Huawei@123.

  2. Run the following command and enter the password of user root to switch to user root:

    sudo su - root

  3. Run the following command to make environment variables take effect:

    source /etc/profile

  4. Run the following command to stop the database:

    haStopAll -a

    The database is stopped if the following information is displayed:

    stop ha successful

  5. Stop the database service on the standby node by performing Step 11 to Step 14.
  6. Run the following command on the active node to restore the database:

    dbRestore -f Relative or absolute path in which the backup file is stored

    For example:

    dbRestore -f /opt/backup/DB/XXFAT-METERTICKET-VPC-CCS-TASKMGR-CONSOLE-TASKCENTER-20180418D001.tar.gz

    NOTE:

    Run the dbRestore -h command to view the command help.

    The database is restored if the following information is displayed:

    Recovery successfully!

  1. Run the following command to start the high availability (HA) service:

    haStartAll -a

  2. Run the following command to switch to the dbadmin user:

    su - dbadmin

  3. Run the following command and enter the password (default password: Manager@123) of database administrator account dbadmin as prompted to connect to the database:

    gsql

  4. Run the following command to check whether the database is restored:

    \l

    Run the following command to check whether all databases are displayed in the List of databases column:

  5. Run the following command to exit the database:

    \q

  6. Run the following command to log in to the specified database:

    gsql -d Database name -U Username -W Password

  7. Run the following command to check whether the database contains all tables:

    \d

    Check whether all tables of the database are displayed in the command output.

  8. Run the following command to exit the database:

    \q

  9. Run the following command to log out the dbadmin user:

    exit

Translation
Download
Updated: 2019-06-14

Document ID: EDOC1100062366

Views: 828

Downloads: 10

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next