Skip to content

Commit

Permalink
Merge pull request #159 from tigergraph/Deji/DOC-1493
Browse files Browse the repository at this point in the history
[WIP] DOC-1493 - Backup documentation improvements
  • Loading branch information
victorleeTG authored Jun 30, 2023
2 parents cb48007 + a33894a commit bfa75b3
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 3 deletions.
111 changes: 110 additions & 1 deletion modules/backup-and-restore/pages/backup-cluster.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,40 @@ The process also applies to single-server instances.
Backing up a cluster is an online operation.
Your database remains available during the backup.

[NOTE]
====
A new API for Backup and Restore feature has been added to `gadmin` toolchain with improved stability and performance. The legacy Graph Backup and Restore(GBAR) tool remains available.
====

== Gadmin backup subcommands:

[.wrap,console]
----
~$ gadmin backup -h
Back up a cluster
Usage:
gadmin backup [flags]
gadmin backup [command]
Description:
Back up and restore a cluster
Available Commands:
create Create a cluster backup
list List backups
remove Remove backup
restore Restore a cluster from backup
Flags:
-h, --help help for backup
Global Flags:
--debug enable debug log output to stdout
Use "gadmin backup [command] --help" for more information about a command.
----

== Prerequisites
* You have access to the TigerGraph Linux user account on your cluster.
All commands must be run from the TigerGraph Linux user.
Expand Down Expand Up @@ -37,6 +71,81 @@ $ gadmin backup create weekly

This creates a backup file named `weekly-<timestamp>` at the xref:configurations.adoc[backup location you configured].

[.wrap,console]
----
$ gadmin backup create weekly
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Tag is weekly-2022-10-26T085124
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Backup timeout is 18000 seconds
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Backup path: /home/tigergraph/backup/weekly-2022-10-26T085124
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Staging path: /home/tigergraph/tigergraph/data/backup/weekly-2022-10-26T085124 (shared: false)
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Created backup directories
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Begin to check needed disk space...
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Exporting GSQL data... (async)
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Exporting GUI data... (async)
[ Info] [Wed Oct 26 08:51:24 UTC 2022] Exporting GPE data... (async)
[ Info] [Wed Oct 26 08:51:25 UTC 2022] GUI exported
[ Info] [Wed Oct 26 08:51:25 UTC 2022] GSQL exported
[ Info] [Wed Oct 26 08:51:25 UTC 2022] GPE exported
[ Info] [Wed Oct 26 08:51:27 UTC 2022] Exporting GSE data... (async)
[ Info] [Wed Oct 26 08:51:28 UTC 2022] GSE exported
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculating the raw size of the exported data...
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GSE_2_1
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GSQL
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GPE_1_1
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GPE_2_1
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GUI
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the raw size of GSE_1_1
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving exported data...
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GUI data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GSE_2_1 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GSE_1_1 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GPE_2_1 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GPE_1_1 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Archiving GSQL data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculating the file size of the archives...
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GSQL.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GSE_2_1.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GPE_2_1.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GUI.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GSE_1_1.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Calculate the file size of GPE_1_1.tar.lz4 data
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Backup completes, backup files are under the path: /home/tigergraph/backup/weekly-2022-10-26T085124
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Clean staging directory: /home/tigergraph/tigergraph/data/backup/weekly-2022-10-26T085124
[ Info] [Wed Oct 26 08:51:28 UTC 2022] Clean staging directory /home/tigergraph/tigergraph/data/backup/weekly-2022-10-26T085124 successfully
----

== List Backup Files

[source,console]
----
gbar backup list
----
This command lists all generated backup files in the storage place configured by the user. For each file, it shows the file’s full tag, its size in human-readable format, and its creation time.

[.wrap,console]
----
$ gadmin backup list
+--------------------------+----------+---------------------+
| TAG | SIZE | CREATED AT |
+--------------------------+----------+---------------------+
| weekly-2022-10-22T133912 | 2.6 MB | 2022-10-22 13:39:12 |
| weekly-2022-10-23T133941 | 20.6 MB | 2022-10-23 13:39:41 |
| weekly-2022-10-24T134133 | 80.1 MB | 2022-10-24 13:41:33 |
| weekly-2022-10-25T134242 | 102.3 MB | 2022-10-25 13:42:42 |
+--------------------------+----------+---------------------+
----

== Remove a backup

To remove a backup, run the `gadmin backup remove tag [tag...]` command:

[source,console]
----
$ gadmin backup remove <backup_tag>
----

The command removes a backup from the backup storage path. To retrieve the tag of a backup, you can use the `gbar list` command.

[#_metadata_backup_optional]
=== Metadata backup (Optional)

Expand All @@ -51,4 +160,4 @@ $ gadmin backup list <backup_tag> --meta

This produces a file called `metadata` in the current path where the command is run.
Store this file in a secure location.
This file is required to restore the backup in another database cluster.
This file is required to restore the backup in another database cluster.
58 changes: 56 additions & 2 deletions modules/backup-and-restore/pages/restore-backup-same.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,62 @@ To restore a backup, run the following command:
----
$ gadmin backup restore <backup_tag>
----
To retrieve the tag of a backup, you can use the `gadmin backup list` command.
Run `gadmin backup restore -h` get all subcommands and flags for backup restore.

For example, if you want to restore a backup with the tag `weekly-2022-08-31T004132`, run gadmin `backup restore weekly-2022-08-31T004132`.
[.wrap,console]
----
$ gadmin backup restore -h
Restore a cluster from backup
Usage:
gadmin backup restore <tag> [flags]
Description:
Restores a backup of cluster data.
Example:
gadmin backup restore my-backup-2021-11-04T120000
Flags:
-h, --help help for restore
--ignore-space-check Ignore the space check during the backup/restore. Default is false.
--meta string path to metadata file, for cross-cluster restore
--staging-path string The path used to store the graph data during backup/restore. Defaults to dataroot.
-y, --y yes to all questions
Global Flags:
--debug enable debug log output to stdout
----

For example, if you want to restore a backup with the tag `weekly-2022-10-25T141957`, run gadmin `weekly-2022-10-25T141957`.

[.wrap,console]
----
$ gadmin backup restore weekly-2022-10-25T141957
[ Note] gadmin backup restore needs to reset TigerGraph system.
Are you sure? (y/N)y
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Staging path: /home/tigergraph/tigergraph/data/backup/weekly-2022-10-25T141957 (shared: false)
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Begin to check needed disk space...
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Scan backup archives under the path /home/tigergraph/backup/weekly-2022-10-25T141957
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Prepare archives...
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Start to restore GPE & GSE data...
[ Info] [Tue Nov 1 09:53:35 UTC 2022] Stopping GPE & GSE...
[ Info] [Tue Nov 1 09:53:47 UTC 2022] Backupping current GPE & GSE data...
[ Info] [Tue Nov 1 09:53:47 UTC 2022] Extracting GPE & GSE data...
[ Info] [Tue Nov 1 09:53:48 UTC 2022] Reseting GPE & GSE
[ Info] [Tue Nov 1 09:53:58 UTC 2022] Starting services
[ Info] [Tue Nov 1 09:54:06 UTC 2022] Restore GPE & GSE successfully. you can remove manually the path /home/tigergraph/tigergraph/data/gstore-20221101095347 after the restore is finished.
[ Info] [Tue Nov 1 09:54:06 UTC 2022] Importing GUI data... (async)
[ Info] [Tue Nov 1 09:54:06 UTC 2022] Checksumming and extracting on GUI#1
[ Info] [Tue Nov 1 09:54:06 UTC 2022] Importing GSQL data... (async)
[ Info] [Tue Nov 1 09:54:06 UTC 2022] Checksumming and extracting on GSQL
[ Info] [Tue Nov 1 09:54:06 UTC 2022] GUI imported
[ Info] [Tue Nov 1 09:54:47 UTC 2022] GSQL imported
[ Info] [Tue Nov 1 09:54:47 UTC 2022] Restore completes
[ Info] [Tue Nov 1 09:54:47 UTC 2022] Clean staging directory: /home/tigergraph/tigergraph/data/backup/weekly-2022-10-25T141957
[ Info] [Tue Nov 1 09:54:47 UTC 2022] Clean staging directory /home/tigergraph/tigergraph/data/backup/weekly-2022-10-25T141957 successfully
----

The restore operation cannot be canceled once started.
The restore operation cannot be canceled once started.

0 comments on commit bfa75b3

Please sign in to comment.