I want to create a backup and restore files , My operator and instance is running in K8s with the help of helm files .I am able to access the database from CLI and UI both . as same I want backup and restore .yaml files , But I don't understand I to start

I deployee the operator and instance on argoCD application . But I want to create a backup and restore files .

To create backup and restore YAML files for your Neo4j database running on Kubernetes using Helm, follow these steps:

Backup Steps

  1. Create a Backup Job: You can create a Kubernetes job to perform the backup. Here’s a sample YAML for a backup job:

yaml

Copy code

apiVersion: batch/v1
kind: Job
metadata:
  name: neo4j-backup
spec:
  template:
    spec:
      containers:
        - name: neo4j-backup
          image: neo4j:latest
          command: ["neo4j-admin", "backup", "--backup-dir=/backup", "--to=/backup/backup.dump"]
          volumeMounts:
            - name: backup-storage
              mountPath: /backup
      restartPolicy: Never
      volumes:
        - name: backup-storage
          persistentVolumeClaim:
            claimName: your-pvc-name  # Replace with your PVC name
  1. Run the Backup Job: Deploy the backup job with the command:

bash

Copy code

kubectl apply -f backup-job.yaml

Restore Steps

  1. Create a Restore Job: To restore from a backup, create a job similar to the backup job. Here’s a sample YAML for restoring:

yaml

Copy code

apiVersion: batch/v1
kind: Job
metadata:
  name: neo4j-restore
spec:
  template:
    spec:
      containers:
        - name: neo4j-restore
          image: neo4j:latest
          command: ["neo4j-admin", "restore", "--from=/backup/backup.dump", "--force"]
          volumeMounts:
            - name: backup-storage
              mountPath: /backup
      restartPolicy: Never
      volumes:
        - name: backup-storage
          persistentVolumeClaim:
            claimName: your-pvc-name  # Replace with your PVC name
  1. Run the Restore Job: Deploy the restore job with the command:

bash

Copy code

kubectl apply -f restore-job.yaml

Additional Notes

  • Persistent Volumes: Ensure you have a Persistent Volume Claim (PVC) configured for backup storage.
  • Backup Directory: Adjust the backup directory path as needed.
  • Scheduling Backups: You may want to consider using CronJobs for regular backups.
  • Access Permissions: Ensure that your Kubernetes service account has the necessary permissions to create jobs and access the persistent volume.

By following these steps, you should be able to set up backup and restore processes for your Neo4j database on Kubernetes.

1 Like

Unmatched arguments from index 0: 'backup', '--backup-dir=/backup', '--to=/backup/backup.dump'

Did you mean: neo4j-admin database check or neo4j-admin database upload or neo4j-admin database?

@sweta.pandey

given

          image: neo4j:latest

presumably this is pulling a v5 Neo4j. and if so backup under v5 is neo4j-admin database backup. However is this is v4 then backup is via neo4j-admin backup

This is described here