I used the “docker cp” to move a data.json and a test.schema to inside my container. I entered then in the container and executed the following command:
dgraph bulk -f data.json -s test.schema
The problem is that I’m getting:
2020/12/14 14:29:47 listen tcp 127.0.0.1:8080: bind: address already in use
I don’t know how to solve it since we will have Dgraph running on a Kubernetes cluster thus it needs to be running on containers. Also, I’m thinking about running in production something like this on my host:
Be aware that the standalone image isn’t recommended for production. And it doesn’t have the best characteristics of a cluster with multiple nodes(instances).
Firstly, to make it work you have to do your own standalone image. Cuz the Bulkloader won’t work with a Live cluster. So you have to add a script to check if the bulkload has finished - like “wait-for-It.sh”. So after the bulk load the Alpha instance can start.
This happens, probably because you are trying to start a second Alpha inside the container. The standalone image has an Alpha and a Zero instance that runs automatically.
I see. I will try to create a new docker file running the bulk loader first.
For now, based on what you said, I tried the live loader instead. Just changed the word “bulk” with “live”. It means:
dgraph live -f data.json -s test.schema
Now I got:
Error while processing schema file “test.schema”: rpc error: code = Unknown desc = line 2 column 15: Expected new line after field declaration. Got @
rpc error: code = Unknown desc = line 2 column 15: Expected new line after field declaration. Got @root@e89roroot@e89dbcroot@e89dbrorrrrrrrororororoot@roo
This schema is GraphQL. Liveloader and Bulk has a flag to load GraphQL schemas. But in Bulkload you have to use an empty schema in the main one. Not sure if that was fixed.
Also, your dataset must be inserted by GraphQL mutations, or you have to change it. e.g.