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).
Restoring Data on the SCC Background

Restoring Data on the SCC Background

Restoring Data on SCC-GaussDB Nodes

This section describes how to restore data in the task center.

Context

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

  • If an exception occurs or the operation has not achieved the expected result after an important operation on system components, such as a system upgrade or critical data modification.
  • The disks or OSs of both the active and standby nodes are faulty, and the node data is lost.
  • Data is damaged due to misoperation.
Prerequisites
  • A PC that can communicate with the node is available.
  • You have obtained the IP addresses of the active and standby nodes as well as the passwords of users root and sccadmin if the nodes are deployed in active/standby mode.
  • The system is running properly.
  • If the backup data stored on a third-party backup 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 logging in to the third-party backup server.
  • You have obtained a tool, such as PuTTY, used for remote access on various platforms.
  • A file transfer tool, such as WinSCP, is available.
Procedure

Preparing data

  1. Use PuTTY to log in to the SCC-GuassDB-FusionGuard01 management VM using the IP address corresponding to SCC-DB01.

    Default username: sccadmin; default password: Scloud12#$

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

    sudo su - root

  3. Run the following command to check the database status and check whether the current node is the active one:

    service had query

    Information similar to that shown in Figure 2-8 is displayed. The node whose ROLE is active is the active node.

    Figure 2-8 Database status

  4. Determine 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 whether the backup directory contains the backup file on a specific date that can be used for restoration:

    ll /opt/backup/DB

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

  8. Run the following command to import environment variables:

    source /etc/profile

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

    cat /opt/gaussdb/ha/tools/backupAndRestore/backuplist

  10. Run the following command to download the file located in Step 9:

    downloadFTPFile xxx.tar.gz

    In the preceding command, xxx.tar.gz is the file found in Step 9.
    NOTE:

    The directory for saving the downloaded backup file is /opt/backup/downloadPath by default.

Restoring data

  1. Use PuTTY to log in to the SCC-GuassDB-FusionGuard01 management VM using the IP address corresponding to SCC-DB01.

    Default username: sccadmin; default password: Scloud12#$

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

    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 service:

    haStopAll -a

    stop ha successful

  5. Repeat Step 11 to Step 14 on the standby DB node to stop the database service.
  6. Run the following command on the active DB 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

    Alternatively, you can run the following command to use the backup file generated at a specified time to restore the database:

    dbRestore -t '[year]-[month]-[day] [hour]:[minute]:[second]'

    For example:

    dbRestore -t '2015-06-01 14:58:03'

    NOTE:
    • Run the dbRestore -h command to display the command help.
    • If you run the dbRestore command without specifying a backup file, the system uses the latest backup file in the /opt/backup/rmanBackup directory to restore the database.

    The database is restored if the following information is displayed:

    Recovery successfully!

Verifying the result

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

    su - dbadmin

  2. Run the following command to start the database as the active one:

    gs_ctl start -M primary

  3. Run the following command and enter the 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

  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 user dbadmin:

    exit

  10. Run the following command to enable the high availability (HA) service:

    haStartAll -a

    The HA service is enabled if the following information is displayed:

    start ha successful

  11. Run the following command on the standby database node to start the database service:

    haStartAll -a

    The HA service is enabled if the following information is displayed:

    start ha successful

Translation
Download
Updated: 2019-06-14

Document ID: EDOC1100062366

Views: 813

Downloads: 9

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