This repository was archived by the owner on Mar 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
This repository was archived by the owner on Mar 29, 2025. It is now read-only.
live loader instructions in v22 docs #548
Copy link
Copy link
Closed
Description
I'm running standalone Docker locally, I couldn't get the instructions from the docs to work:
https://dgraph.io/docs/howto/importdata/live-loader/
docker run -it --rm -v <local-path-to-data>:/tmp dgraph/dgraph:latest \
dgraph live --slash_grpc_endpoint <grpc-endpoint> -f /tmp/<data-file> -s /tmp/<schema-file> -t <api-key>
What did work was using docker cp to copy the export files into the container, and then run the dgraph live command in the container. This is a much easier to understand approach.
Step 1: Send export mutation to /admin endpoint
endpoint: http://localhost:8080/admin
mutation {
export(input: { format: "json" }) {
response {
message
code
}
exportedFiles
}
}
Response will look like:
{
"data": {
"export": {
"response": {
"message": "Export completed.",
"code": "Success"
},
"exportedFiles": [
"dgraph.r1180002.u0403.2322/g01.json.gz",
"dgraph.r1180002.u0403.2322/g01.schema.gz",
"dgraph.r1180002.u0403.2322/g01.gql_schema.gz"
]
}
},
"extensions": {
"tracing": {
"version": 1,
"startTime": "2023-04-03T23:22:08.9252618Z",
"endTime": "2023-04-03T23:22:09.4391514Z",
"duration": 513889700
}
}
}
Files will be present in an export directory inside the directory you specified as the volume for the Docker container, e.g. -v ~/dgraph-v22:/dgraph
Step 2: Use docker cp to copy the exported files into your container
Using the Docker desktop application, click the button to invoke the container's CLI.
- In the CLI, navigate to
/dgraph(cd /dgraph) - Make a directory named
export(mkdir export) - In your system CLI, i.e. not inside container, copy the export files into the container:
docker cp ./g01.json.gz dgraph-22.0.2:/dgraph/export+docker cp ./g01.schema.gz dgraph-22.0.2:/dgraph/export(use the container name or ID, and copy them to the export directory you just created) - Back inside the container CLI, run
cd /dgraph/exportdgraph live --alpha localhost:9080 -f ./g01.json.gz -s ./g01.schema.gz
thelovesmith
Metadata
Metadata
Assignees
Labels
No labels