DEV Community

leo
leo

Posted on

openGauss:gs_backup

gs_backup
Background Information
After the successful deployment of openGauss, various problems and abnormal states will be encountered during the operation of the database. openGauss provides the gs_backup tool to help openGauss back up and restore important data, display help information and version number information.

prerequisite
The openGauss database can be connected normally.
When restoring, it is necessary to ensure that backup files exist in the backup directory of each node.
Run the gs_backup command as the operating system user omm.
grammar
backup database host

gs_backup -t backup --backup-dir=BACKUPDIR [-h HOSTNAME] [--parameter] [--binary] [--all] [-l LOGFILE]
Restoring the database host

gs_backup -t restore --backup-dir=BACKUPDIR [-h HOSTNAME] [--parameter] [--binary] [--all] [-l LOGFILE] [--force]
show help information

gs_backup -? | --help
Display version number information

gs_backup -V | --version
Parameter Description
The gs_backup parameters can be divided into the following categories:

Backup database host parameters:

-h

Specifies the name of the host where the backup file is stored.

Value range: host name. If no hostname is specified, the current database instance is backed up.

--backup-dir=BACKUPDIR

Backup file save path.

–parameter

Back up the parameter file. When the –parameter, –binary, –all parameters are not specified, only the parameter file is backed up by default.

–binary

Backup the binary files in the app directory.

–all

Back up the binary files, pg_hba.conf and postgsql.conf files in the app directory.

-l

Specify the log file and storage path.

Default: $GAUSSLOG/om/gs_backup-YYYY-MM-DD_hhmmss.log

Restore database host parameters:

-h

Specifies the name of the host that needs to be restored.

Value range: host name. If no host is specified, the corresponding backup node will be restored.

--backup-dir=BACKUPDIR

Restore file extraction path.

–parameter

Restore the parameter file. When the --parameter, --binary, and --all parameters are not specified, only the parameter file is restored by default.

–binary

Restore binaries.

–all

Restore binary and parameter files.

-l

Specify the log file and storage path.

Default: $GAUSSLOG/om/gs_backup-YYYY-MM-DD_hhmmss.log

--force

After the static file of the node is lost, it will be restored forcibly, and it will only take effect when –all or –binary is used together.

Other parameters:

-?, --help

Display help information.

-V, --version

Display version number information.

-t

Specifies the type of operation.

Value range: backup or restore.

Top comments (0)