Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

live loader instructions in v22 docs #548

Closed
benwoodward opened this issue Apr 3, 2023 · 2 comments
Closed

live loader instructions in v22 docs #548

benwoodward opened this issue Apr 3, 2023 · 2 comments

Comments

@benwoodward
Copy link

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/export dgraph live --alpha localhost:9080 -f ./g01.json.gz -s ./g01.schema.gz
@Rajakavitha1
Copy link
Contributor

Hi @benwoodward Thank you for raising the issue. The documentation does mention about this:

Before you begin
Verify that you have a local folder <local-path-to-data> containing

at least one data file in RDF or JSON in plain or gzip format with the data to import
an optional schema file.
Those files have been generated by an [export](https://dgraph.io/docs/howto/exportdata/about-export/) or by a [data migration](https://dgraph.io/docs/migration/about-data-migration/) tool.

Can you please confirm if you faced this issue even after you followed these steps before you used live import. I am marking this issue as closed for now. Please feel free to reopen if any other issues that need to be addressed in the documentation

@thelovesmith
Copy link

@benwoodward What errors did you get when you tried to follow the documentation? I am getting a no accessJWT error when I try to live import into v23.10. It's very frustrating because I am following the instructions from the docs, but as I look for a solution, I am seeing different setups for the command using Docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants