Admin export HTTP response


(Kevin Orr) #1

Currently, by accessing http://<host>:<port>/admin/export, the HTTP response doesn’t indicate the name or path to the export. Reading through dgraph/cmd/alpha/admin.go and worker/export.go, it doesn’t seem to return the name to the user anywhere. What’s the best way to figure out the name of the export?


(Daniel Mai) #2

By default exports are written to the export directory where the Dgraph Alpha runs. This is configurable by the Dgraph Alpha flag --export).


(Kevin Orr) #3

Thanks for the reply @dmai. I’m wondering about the name of each specific import. I.e., the name of the export under the export directory.


(Daniel Mai) #4

The Alpha log will show the exported file paths:

I0531 20:40:41.367570       1 export.go:262] Exporting data for group: 1 at /dgraph/export/dgraph.r1.u0531.2040/g01.rdf.gz
I0531 20:40:41.367685       1 export.go:273] Exporting schema for group: 1 at /dgraph/export/dgraph.r1.u0531.2040/g01.schema.gz

And here’s the tree output for the export directory from this example:

$ tree ./export
./export
`-- dgraph.r1.u0531.2040
    |-- g01.rdf.gz
    `-- g01.schema.gz

The files themselves are named g01.rdf.gz and g01.schema.gz for the data and schema files. “g01” means this export data is from Alpha Group 1. If there are multiple Alpha groups, then each group creates their own export for g02, g03, etc.

The directory “dgraph.r1.u0531.2040” is the name of the directory. “r1” is the read timestamp at the time of the export (1, in this case). “u0531.2040” is the UTC timestamp of the export in the format MMDD.HHMM. Each export will be in its own directory following this naming structure. e.g., in the following example the second export for group 1 had a read timestamp of 202 and happened at 05/31, 20:45 UTC.

$ tree ./export
./export
|-- dgraph.r1.u0531.2040
|   |-- g01.rdf.gz
|   `-- g01.schema.gz
`-- dgraph.r202.u0531.2045
    |-- g01.rdf.gz
    `-- g01.schema.gz

(Kevin Orr) #5

Ok. I was thinking it would be nice if the name of the export was returned in the HTTP API response, but knowing that I can find the most recent export based on the timestamp format is enough. Thanks