How to specify the location of data files when starting dgraph

What I want to do

How to specify the location of data files when starting dgraph?

What I did

I run the docker container dgraph/standalone, then the generated data files is in directory /dgraph.

I directly started “dgraph zero & dgraph alpha” in the host computer, the data files in the user’s home directory.

Dgraph metadata

dgraph version

v22.0.2

I don’t get it. Are you using Docker or the binary?

If docker you have to bind the path to your computer.

docker run -it -p 5080:5080 -p 6080:6080 -p 8080:8080 \
  -p 9080:9080 -v ~/dgraph:/dgraph --name dgraph \
  dgraph/standalone:latest

if you are using the binary you can use

dgraph zero -w /path/to/home/dgraph/zw & 
dgraph alpha -p /path/to/home/dgraph/p -w /path/to/home/dgraph/w

You should not us both at the same time. Stick to Docker cuz it is easier to handle.

Please, use our Tour Welcome | Intro | Dgraph Tour