From c34402c6be2cdaef98fa535426bd2c05ace64649 Mon Sep 17 00:00:00 2001 From: J1e9n9n1y <144667442+J1e9n9n1y@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:38:46 +0200 Subject: [PATCH] Update README.md add more details to the instructions --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d3a531b..d3d9982 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The startup will take a short time. # To create the namespace ``` -kubectl apply -f git/neo4j5-on-kubernetes/minikube/minikube-namespace.yaml +kubectl apply -f minikube/minikube-namespace.yaml ``` Check with ``` @@ -22,7 +22,7 @@ kubectl get namespaces # To create the persistent volume ``` -kubectl apply -f git/neo4j5-on-kubernetes/minikube/minikube-persistentVolume.yaml +kubectl apply -f minikube/minikube-persistentVolume.yaml ``` Check with ``` @@ -30,7 +30,7 @@ kubectl get pv ``` # To create the persistent volume claims ``` -kubectl apply -f git/neo4j5-on-kubernetes/minikube/minikube-persistentVolumeClaim.yaml +kubectl apply -f minikube/minikube-persistentVolumeClaim.yaml ``` Check with ``` @@ -39,7 +39,7 @@ kubectl get pvc --namespace neo4j-namespace # Deploy neo4j version 4 ``` -kubectl apply -f git/neo4j5-on-kubernetes/neo4j/neo4j4-deployment.yaml +kubectl apply -f neo4j/neo4j4-deployment.yaml ``` Check with ``` @@ -59,8 +59,74 @@ 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 +``` + +# To export the data using graphml +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. + +# Delete the neo4j version 4 +``` +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 +``` +# Create secret for neo4j version 5 +``` +kubectl apply -f neo4j5-on-kubernetes/neo4j/neo4j-secret.yaml +``` +# Create neo4j version 5 database +``` +kubectl apply -f neo4j5-on-kubernetes/neo4j/neo4j5-deployment.yaml +``` +# Import the graphml data +Using this Cypher-statement +``` +CALL apoc.import.graphml("export-neo4j4.graphml", {readLabels: true}) +``` +# Deploy neo4j version 5 to the neo4j-backup namespace +``` +kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-secret-backup.yaml +kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-deployment-backup.yaml +``` +# Check the connection to the HTTP API +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 +``` + +# Deploy the Cronjob +``` +kubectl apply -f neo4j5-on-kubernetes/backup/neo4j5-backup-job.yaml +``` +# Derive a job from the Cronjob for immediate execution +``` +kubectl --namespace neo4j-backup create job --from=cronjob/neo4j-backup neo4j-backup-once +``` + +# Check for the availability of the created backup file +by accessing the database backend and navigating to the import folder +``` +kubectl --namespace neo4j-backup exec -it neo4j-database-0 -- /bin/sh +``` # To reset anything you did and start from scratch ```