Backup and Restore of cloud DQL database

Background

I am using a dedicated cloud instance with DQL database/schema because I need to use facets.

Goal

  • Use a script to backup production database from command line (or download existing backup?)
  • Use the backup that has been downloaded to run on local version of dgraph docker for development

Whats not working

I can’t seem to work out the first step of backup/download

What I have tried

I have been struggling with the cloud documentation, but after jumping between Backup - Cloud API and Importing and Exporting data from Dgraph Cloud I worked out the below commands.

But the issue is that they run… but don’t seem to do anything (I am assuming that signedUrls should have values in it?).

Any help with this would be great.

# create backup - REQ

curl 'https://<some-url>/admin/slash' \
  -H 'X-Auth-Token: <admin_token_from_ui>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'mutation {
  export {
    response { code message }
    exportId
    taskId
  }
}'

# create backup - RES

{
  "data": {
    "export": {
      "exportId": "exports/2021-12-02/0x26d673b-1006229647",
      "response": {
        "code": "Success",
        "message": "Export queued with ID 0x1bd686d8f"
      },
      "taskId": "0x1bd686d8f"
    }
  }
}

# check status of backup - REQ

curl 'https://<some-url>/admin/slash' \
  -H 'X-Auth-Token: <admin_token_from_ui>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'query {
  exportStatus (
    exportId:"0x1bd686d8f"
    taskId: "0x1bd686d8f"
  ){
    kind
    lastUpdated
    signedUrls
    status
  }
}'

# check status of backup - RES

{
  "data": {
    "exportStatus": {
      "kind": "Export",
      "lastUpdated": "2021-12-02T00:26:42Z",
      "signedUrls": [],
      "status": "Success"
    }
  }
}

In your exportStatus query, the exportId argument should be "exports/2021-12-02/0x26d673b-1006229647":

query ExportStatus {
  exportStatus(
    exportId: "exports/2021-12-02/0x26d673b-1006229647",
    taskId: "0x1bd686d8f"
  ) {
    kind
    lastUpdated
    signedUrls
    status
  }
}

thanks so much, a typo :upside_down_face: :sob:

1 Like