Backup list tool - Enterprise features

The lsbackup command-line tool prints information about the stored backups in a user-defined location.

Parameters

The lsbackup command has two flags:

Flags:
  -h, --help              help for lsbackup
  -l, --location string   Sets the source location URI (required).
      --verbose           Outputs additional info in backup list.
  • --location: indicates a source URI with Dgraph backup objects. This URI supports all the schemes used for backup.
  • --verbose: if enabled will print additional information about the selected backup.

For example, you can execute the lsbackup command as follows:

dgraph lsbackup -l <source-location-URI>

Source URI

Source URI formats:

  • [scheme]://[host]/[path]?[args]
  • [scheme]:///[path]?[args]
  • /[path]?[args] (only for local or NFS)

Source URI parts:

  • scheme: service handler, one of: s3, minio, file
  • host: remote address; e.g.: dgraph.s3.amazonaws.com
  • path: directory, bucket or container at target; e.g.: /dgraph/backups/
  • args: specific arguments that are ok to appear in logs

Output

The following snippet is an example output of lsbackup:

[Decoder]: Using assembly version of decoder
Page Size: 4096
Listing backups from: ~/bkp
Name	Since	Groups	Encrypted
dgraph_backup/dgraph.20210121.125014.852/manifest.json	30005	map[1:[dgraph.graphql.schema_created_at dgraph.graphql.xid dgraph.drop.op dgraph.type dgraph.cors dgraph.graphql.schema_history score dgraph.graphql.p_query dgraph.graphql.schema dgraph.graphql.p_sha256hash series]]	false

Return values

  • Name: Name of the backup

  • Since: is the timestamp at which this backup was taken. It’s called Since because it will become the timestamp from which to backup in the next incremental backup.

  • Groups: is the map of valid groups to predicates at the time the backup was created. This is printed only if --verbose flag is enabled

  • Encrypted: Indicates whether this backup is encrypted or not

Examples

S3

Checking information about backups stored in an AWS S3 bucket:

dgraph lsbackup -l s3:///s3.us-west-2.amazonaws.com/dgraph_backup

You might need to set up access and secret key environment variables in the shell (or session) you are going to run the lsbackup command. For example:

AWS_SECRET_ACCESS_KEY=<paste-your-secret-access-key>
AWS_ACCESS_ID=<paste-your-key-id>

MinIO

Checking information about backups stored in a MinIO bucket:

dgraph lsbackup -l minio://localhost:9000/dgraph_backup

In case the MinIO server is started without tls, you must specify that secure=false as it set to true by default. You also need to set the environment variables for the access key and secret key.

In order to get the lsbackup running, you should following these steps:

  • Set MINIO_ACCESS_KEY as an environment variable for the running shell this can be done with the following command: (minioadmin is the default access key, unless is changed by the user)

    export MINIO_ACCESS_KEY=minioadmin
    
  • Set MINIO_SECRET_KEY as an environment variable for the running shell this can be done with the following command: (minioadmin is the default secret key, unless is changed by the user)

    export MINIO_SECRET_KEY=minioadmin
    
  • Add the argument secure=false to the lsbackup command, that means the command will look like: (the double quotes " are required)

    dgraph lsbackup -l "minio://localhost:9000/<bucket-name>?secure=false"
    

Local

Checking information about backups stored locally (on disk):

dgraph lsbackup -l ~/dgraph_backup

This is a companion discussion topic for the original entry at https://dgraph.io/docs/enterprise-features/lsbackup/