Perform Full Backup and Restore
Apache Cloudberry supports backing up and restoring the full database in parallel. Parallel operations scale regardless of the number of segments in your system, because segment hosts each write their data to local disk storage at the same time.
gpbackup
and gprestore
are Apache Cloudberry command-line utilities that create and restore backup sets for Apache Cloudberry. By default, gpbackup
stores only the object metadata files and DDL files for a backup in the Apache Cloudberry coordinator data directory. Apache Cloudberry segments use the COPY ... ON SEGMENT
command to store their data for backed-up tables in compressed CSV data files, located in each segment's backups directory.
The backup metadata files contain all of the information that gprestore
needs to restore a full backup set in parallel. Each gpbackup
task uses a single transaction in Apache Cloudberry. During this transaction, metadata is backed up on the coordinator host, and data for each table on each segment host is written to CSV backup files using COPY ... ON SEGMENT
commands in parallel. The backup process acquires an ACCESS SHARE
lock on each table that is backed up.
Install the gpbackup
and gprestore
utilities
Before installing the gpbackup
and gprestore
utilities, make sure that you have the Golang (v1.11 or later) installed and that you have set the Go PATH
environment
variable.
-
Pull the
apache/cloudberry-gpbackup
GitHub repository to the target machine.go install github.com/apache/cloudberry-gpbackup@latest
The repository is placed in
$GOPATH/pkg/mod/github.com/apache/cloudberry-gpbackup
. -
Enter the
apache/cloudberry-gpbackup
directory. Then, build and install the source code:cd <$GOPATH/pkg/mod/github.com/apache/cloudberry-gpbackup>
make depend
make buildYou might encounter the
fatal: Not a git repository (or any of the parent directories): .git
prompt after runningmake depend
. Ignore this prompt, because this does not affect the building.The
build
target will put thegpbackup
andgprestore
binaries in$HOME/go/bin
. This operation will also try to copygpbackup_helper
to the Apache Cloudberry segments (by retrieving hostnames fromgp_segment_configuration
). -
Check whether the build is successful by checking whether your
$HOME/go/bin
directory containsgpback
,gprestore
, andgpbackup_helper
.ls $HOME/go/bin