To install minikube I followed See these instructions. Therefore you need to:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start
The startup will take a short time.
kubectl apply -f minikube/minikube-namespace.yaml
Check with
kubectl get namespaces
kubectl apply -f minikube/minikube-persistentVolume.yaml
Check with
kubectl get pv
kubectl apply -f minikube/minikube-persistentVolumeClaim.yaml
Check with
kubectl get pvc --namespace neo4j-namespace
kubectl apply -f neo4j/neo4j4-deployment.yaml
Check with
kubectl --namespace neo4j-namespace get all
This may take a while. To debug the startup of the database pod:
kubectl --namespace neo4j-namespace logs neo4j-database-0
or
kubectl --namespace neo4j-namespace describe pod neo4j-database-0
Use the default login for neo4j version 4 (neo4j:neo4j). Open up the files NodeCreation.cypher and Relationship.cypher and copy/paste the statements to the webfrontend and executed it there.
To figure out what is the URL to access the webfront end use
minikube --namespace neo4j-namespace service neo4j-service –url
Run this Cypher-statement in the neo4j-Webfrontend
WITH "export-neo4j4.graphml" AS filename
CALL apoc.export.graphml.all(filename, {useTypes:TRUE, storeNodeIds:FALSE})
YIELD file
RETURN file;
after that export the saved data to your file system.
Removing statefulset
kubectl --namespace neo4j-namespace delete statefulsets.apps neo4j-database
removing service
kubectl --namespace neo4j-namespace delete service neo4j-service
check if deleted
kubectl --namespace neo4j-namespace get all
kubectl apply -f neo4j5-on-kubernetes/neo4j/neo4j-secret.yaml
kubectl apply -f neo4j5-on-kubernetes/neo4j/neo4j5-deployment.yaml
Using this Cypher-statement
CALL apoc.import.graphml("export-neo4j4.graphml", {readLabels: true})
kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-secret-backup.yaml
kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-deployment-backup.yaml
by placing this curl statement into your terminal
curl -X POST http://192.168.49.2:30047/db/neo4j/tx/commit -H "Content-Type:application/json" -d "{\"statements\":[{\"statement\":\"match (n) return count(n)\"}]}" -H "Authorization: bmVvNGo6MTIzNDU2Nzg="
use this similar statement into your Cronjob
curl -d '{"statements": [ { "statement" : "WITH \"backup.graphml\" AS filename CALL apoc.export.graphml.all(filename, {useTypes:TRUE, storeNodeIds:FALSE}) YIELD file RETURN file;" } ]}' -H "Authorization: Basic bmVvNGo6MTIzNDU2Nzg=" -H "Content-Type: application/json" -X POST http://192.168.49.2:30047/db/neo4j/tx/commit
kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-backup-job.yaml
kubectl --namespace neo4j-backup create job --from=cronjob/neo4j-backup neo4j-backup-once
by accessing the database backend and navigating to the import folder
kubectl --namespace neo4j-backup exec -it neo4j-database-0 -- /bin/sh
minikube delete