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 SMN Data

Restoring SMN Data

Background Information

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

  • An exception occurs or an operation has not achieved the expected result after an important operation, such as a system upgrade or critical data modification.
  • The disks or OSs of both the active and standby database nodes are faulty, and the node data is lost.
  • Data is corrupted due to misoperations.

Prerequisites

  • A PC that can communicate with the database node is available.
  • You have obtained IP addresses of the active and standby database nodes and the passwords of OS accounts root, hermes, and dbadmin as well as database administrator account dbadmin.
  • Services are running properly.
  • The following conditions are met if the backup file stored on the third-party server is used to restore data:
    • 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.
  • An application, such as PuTTY, which can be used for remote access across various platforms, is available.
  • A file transfer tool, such as WinSCP, is available.

Procedure

Obtain the required backup files.

  1. Use PuTTY to log in to the SMNALL-PS-NS-DB-MEM01 node.

    The default username is hermes, and the default password is Hermes@123.

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

    sudo su - root

    The default password of user root is Cloud12#$.

  3. Run the following command to check the database status:

    service had query

    Information similar to the following is displayed.

    Figure 2-9 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

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

    ll /opt/backup/DB

  2. Check whether the backup files that meet the data restoration requirements exist in the directory based on the command output in Step 6.

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

    Ensure that user hermes and the management IP address of the node are used to establish the connection.

    The default password of user hermes is Hermes@123.

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

    sudo su - root

    The default password of user root is Cloud12#$.

  2. Perform operations in Step 6 and check whether the required backup files exist.

  3. Use WinSCP to copy the required backup files from the /opt/backup/DB directory to the local PC.

    After this step is complete, go to Step 13.

  4. Use WinSCP to copy the required backup files from the third-party backup server to the local PC.

    The backup files are saved in the specified directory on the FTPS server or the UDS bucket.

  5. Use WinSCP to copy the required backup files from the local PC to the /opt/backup/DB directory on the active database node.

Restore data.

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

    Ensure that user hermes and the management IP address of the node are used to establish the connection.

    The default password of user hermes is Hermes@123.

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

    sudo su - root

    The default password of user root is Cloud12#$.

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

    source /etc/profile

  3. Run the following command to stop the database service:

    haStopAll -a

    The database service stops if the following information is displayed:

    stop ha successful

  4. Log in to the standby database node and repeat Step 15 to Step 17 to stop the database service.
  1. Run the following command on the active database node to restore the database:

    dbRestore -f Relative or absolute path under which backup files are stored

    For example:

    dbRestore -f /opt/backup/DB/XXFATYYDB20150601D004.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.

Verify the result.

  1. The database is restored if the following information is displayed:

    Recovery successfully!

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

    su - dbadmin

  3. Run the following command to start the current node as the active database node:

    gs_ctl start -M primary

  4. Run the following command and enter the password of database administrator account dbadmin as prompted to connect to the database:

    gsql

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

    \l

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

    \d

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

  6. Run the following command to exit the database:

    \q

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

    exit

  1. Run the following command to start the HA service:

    haStartAll -a

    The HA service has started if the following information is displayed:

    start ha successful

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

    haStartAll -a

Translation
Download
Updated: 2019-06-14

Document ID: EDOC1100062366

Views: 767

Downloads: 9

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