GBase 8c Physical Backup and Cross-Machine Recovery Guide

Cong Li - Sep 5 - - Dev Community

GBase 8c is a high-performance, high-availability multi-model database cluster that supports various data types and SQL standards. It is widely used in key industries such as finance, telecommunications, and government. As data volume grows and business needs become more complex, data backup and recovery have become critical aspects of database management. GBase 8c database supports several backup and recovery types, including physical backups, logical backups, and flashback recovery. Physical backups provide a complete copy of data, including data files and log files, ensuring data consistency and integrity.

Cross-machine recovery of physical backups refers to the process of migrating data from one server to another and quickly recovering the GBase database on the new server. This article provides guidance for cross-machine recovery using GBase 8c V5 5.0.0 as an example.

1. Overview of Cross-Machine Physical Backup Recovery

This recovery method is suitable for various scenarios such as server hardware upgrades, fault migration, and data migration, meeting the following user requirements:

  • Business Continuity: As businesses demand higher continuity, backup and recovery capabilities become critical metrics for database reliability. GBase 8c ensures business continuity and data availability through efficient physical backup and cross-machine recovery features.
  • Data Security: In today's world, where data security is paramount, physical backups offer a secure method of data protection. Through cross-machine recovery, data can be quickly restored on a new server in the event of a failure on the original server, reducing the risk of data loss.
  • System Upgrade and Migration: As technology evolves, businesses may need to upgrade or migrate their existing database systems. The cross-machine recovery feature of physical backups makes this process smoother and more efficient, minimizing the impact of system upgrades or migrations on business operations.
  • Disaster Recovery Plan: An effective disaster recovery plan is essential for mitigating risks in the face of natural disasters or unforeseen events. GBase 8c’s cross-machine recovery functionality is a key component of such a plan, ensuring that business operations can be restored quickly in the event of a disaster.
  • Performance Optimization: Cross-machine recovery can also be used for performance optimization. For example, by restoring backup data to a more powerful server, the database's processing capabilities and response speed can be improved.

2. Backup Preparation

This section describes the local physical backup preparation steps required before recovery.

2.1 Source Database Local Backup

1) Initialize the Local Backup Path

   gs_probackup init -B /home/gbase/database/backup_dir
Enter fullscreen mode Exit fullscreen mode

2) Add Backup Instance

   gs_probackup add-instance -B /home/gbase/database/backup_dir -D /home/gbase/database/install/data/dn --instance test_name
Enter fullscreen mode Exit fullscreen mode

3) Backup Data

   gs_probackup backup -B /home/gbase/database/backup_dir --instance test_name -b full -d postgres -p 15400
Enter fullscreen mode Exit fullscreen mode

2.2 Backup Data Migration

Migrate the backup data to the target recovery machine, and it's recommended to keep the backup path consistent with the source path.

3. Recovery

3.1 Cluster Preparation for Recovery

Install the target recovery cluster. It is recommended to keep the installation directory and data storage directory consistent with the source cluster.

3.2 Performing the Recovery

Follow these steps to restore source data to the target recovery machine:

1) Stop the Database Service

   gs_om -t stop
Enter fullscreen mode Exit fullscreen mode

2) Delete the Current Data Directory

   rm -rf /home/gbase/database/install/data/dn
Enter fullscreen mode Exit fullscreen mode

3) Execute the Recovery

   gs_probackup restore -B /home/gbase/database/backup_dir --instance test_name -D /home/gbase/database/install/data/dn
Enter fullscreen mode Exit fullscreen mode

4) Modify postgresql.conf and pg_hba.conf Configuration Files

  • postgresql.conf:

    • Modify the IP address to the current machine’s IP and adjust related ports.
    • Change pgxc_node_name to match the current cluster configuration.
    • Update synchronous_standby_names to match the current cluster configuration.
    • If the restored database is standalone, and the source cluster was in master-slave mode, comment out replconninfo1.
  • pg_hba.conf:

    • Add the current machine’s IP.

5) Start the Database Service

   gs_om -t start
Enter fullscreen mode Exit fullscreen mode

After starting the cross-machine database, check the data to ensure successful recovery.

Feel free to leave a comment if you have questions about other typical backup and recovery scenarios!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player