Ask a Question

Backup

List Backups

List all backups of the current backend.

Cloud Endpoint

https://${DEPLOYMENT_URL}/admin/slash

API Command

query {
    listBackups {
        response {
            type
            backupNum
            folder
            timestamp
        }, errors {
            message
        }
    }
}

Example

#!/usr/bin/env bash

DEPLOYMENT_URL="polished-violet.us-east-1.aws.cloud.dgraph.io"
DEPLOYMENT_JWT="<deployment-jwt>"

curl "https://${DEPLOYMENT_URL}/admin/slash" \
  -H 'Content-Type: application/json' \
  -H "X-Auth-Token: ${DEPLOYMENT_JWT}" \
  --data-binary '{"query":"{\n listBackups {\n response {\n type\n backupNum\n folder\n timestamp\n }, errors {\n message\n }\n} \n}","variables":{}}' \
  --compressed
{
  "data": {
    "listBackups": {
      "errors": [],
      "response": [
        [
          {
            "backupNum": 1,
            "folder": "2021-15",
            "timestamp": "2021-04-15T18:00:58+0000",
            "type": "full"
          },
          {
            "backupNum": 2,
            "folder": "2021-15",
            "timestamp": "2021-04-15T18:04:29+0000",
            "type": "incremental"
          }
        ]
      ]
    }
  }
}

Export Data

Export data from your backend.

Cloud Endpoint

https://${DEPLOYMENT_URL}/admin/slash

API Command

mutation {
  export {
    signedUrls
  }
}

Example

#!/usr/bin/env bash

DEPLOYMENT_URL="polished-violet.us-east-1.aws.cloud.dgraph.io"
DEPLOYMENT_JWT="<deployment-jwt>"

curl "https://${DEPLOYMENT_URL}/admin/slash" \
  -H 'Content-Type: application/json' \
  -H "X-Auth-Token: ${DEPLOYMENT_JWT}" \
  --data-binary '{"query":"mutation {\n export {\n signedUrls\n }\n }","variables":{}}' \
  --compressed
{
  "data": {
    "export": {
      "signedUrls": [
        "<export-url>",
        "<export-url>",
        "<export-url>"
      ]
    }
  }
}

Import Data

Import your data back using Dgraph Live Loader (requires Docker).

Shell Command

Live loader command (via Docker):

docker run -it --rm -v /tmp/file:/tmp/g01.json.gz dgraph/dgraph:v20.11-slash \
  dgraph live --slash_grpc_endpoint=${DEPLOYMENT_URL} -f /tmp/g01.json.gz -t ${DEPLOYMENT_JWT}

Example

#!/usr/bin/env bash

DEPLOYMENT_URL="lively-dream.grpc.us-east-1.aws.cloud.dgraph.io"
DEPLOYMENT_JWT="<deployment-jwt>"

docker run -it --rm -v /users/dgraph/downloads:/tmp dgraph/dgraph:v20.11-slash \
  dgraph live --slash_grpc_endpoint=${DEPLOYMENT_URL}:443 -f /tmp/1million.rdf.gz -t ${DEPLOYMENT_JWT}