Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-06-2019 06:26 AM
Upon restarting the GCE instance, all db data is wiped from neo4j as the container is being rebuilt.
Find a way to persist this data, e.g. by mounting the graph.db directory to a location on the host system.
I've been trying to add a volume mount to the docker file
but data still didn't stay persistent after restarting the docker container
Does anybody have advice / tips ?
02-06-2019 06:37 AM
We don't want to dump the db rather make sure that after restarting the VM the data is still there. currently the graph.db folder is wiped because it's not mounted to the host system of the docker container
02-06-2019 08:01 AM
Can you show exactly what command you ran/how you mounted the volumes?
Did you follow the documentation? https://neo4j.com/docs/operations-manual/current/docker/
02-07-2019 12:07 AM
Yes I did use the above mentioned documents :
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
#!/bin/bash
docker build -t neo4j-image .
echo 'Image successfully built'
docker run \
--publish=7474:7474 \
--publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--name neo4j-container \
-e NEO4J_dbms_security_procedures_unrestricted=apoc.* \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_dbms_shell_enabled=true \
-d neo4j-image
echo 'Container started'
02-07-2019 03:12 PM
When you do the "docker run" bit, how are you launching it on GCE? Like this directly?
For persistent data, you need to have a volume mapped to a GCE disk in the end. That mapping is why the data would persist after the docker container is gone. What have you tried there?
Doing the volume mounting as you have it here looks like the persistent volume is mapped to your personal client machine / laptop, nothing in GCP.
02-07-2019 11:46 PM
This is done directly on GCE , with in a Virtual machine on GCP ( thus mapping to a persistent volume on GCP)
Hope this makes sense
02-07-2019 11:58 PM
#!/bin/bash
docker build -t neo4j-image .
echo 'Image successfully built'
gcloud auth configure-docker
docker tag neo4j-image gcr.io/$1/neo4j-image:0.1
docker push gcr.io/$1/neo4j-image:0.1
echo 'Image successfully deployed to project $1'
02-08-2019 05:21 AM
OK -- so there's a bit to disentangle here hopefully I'm understanding this right.
You're running the docker command on a GCP VM. That GCP VM is backed by some GCP disk. On the GCP VM, you're mounting your data to $HOME/neo4j/data
. So then it stands to reason that whatever GCP disk is backing your VM, your data is persisted there, at that path.
So is the data disappearing when you restart neo4j or what is the issue? A volume mount here is the right way to go.
02-08-2019 05:27 AM
Exactly, sorry for tangling everything up 😕
Data does not stay persistent after restarting the docker container
What does a volume mount entail ?
All the sessions of the conference are now available online