File location and multiple databases

I’m new to Docker and Memgraph and I have several questions.

  1. I want to know where files and databases are stored on my computer.
    The docs said the volume directories are in \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\ and I can find mg_lib inside there. The docs also mentioned memgraph.conf, but I can only find it in ...\version-pack-data\community\docker\overlay2\..., which doesn’t make sense to me. Also I want to know how and where the database is stored. Can I export a database directly instead of exporting a Cypher file?
  2. I don’t know whether it can create multiple databases. Docs didn’t mention it. If it can, how?
    Thanks for your help.

Some more requests (off-topic): can anyone tell me how to clean up the wsl files please?

Hi @SketchySketch! :grinning_face_with_smiling_eyes:

1. Where is Memgraph stored when using WSL?

Are you running Memgraph with named volumes?
If yes, Docker should automatically create the directories:

  • mg_lib - contains the database snapshots
  • mg_log - contains the log files
  • mg_etc - contains the configuration file

For example, I am running the following command:

docker run -it -p 7687:7687 -p 3000:3000 -e MEMGRAPH="--bolt-port=7687" `
  -v mg_lib:/var/lib/memgraph `
  -v mg_log:/var/log/memgraph `
  -v mg_etc:/etc/memgraph `

When I open the path \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes I can see the aforementioned directories.

2. Can I export a database directly instead of exporting a Cypher file?

Yes, you can just save the latest database snapshot located in mg_lib\_data\snapshots. Check out this guide about creating backups in the form of snapshots.

3. Can I create multiple databases?

The only option is to start multiple Memgraph instances. When using Docker, it’s important to use different ports and named volumes. For example, you could change the command from the first section like this to start a new Memgraph instance:

docker run -it -p 7688:7687 -p 3001:3000 -e MEMGRAPH="--bolt-port=7687" `
  -v mg_lib_2:/var/lib/memgraph `
  -v mg_log_2:/var/log/memgraph `
  -v mg_etc_2:/etc/memgraph `

If you mean the Docker volume data in the \\wsl$\ directory, then you will need to:

  1. Delete all containers (or only those that you don’t use) with: docker container prune (this command will delete every container)
  2. Delete all the unused volumes (those that don’t have a container anymore) with: docker container prune

Hope this helps :grinning_face_with_smiling_eyes:

Thanks for your detailed information!