Getting started¶
Part 1 runs backup, verify and restore on a laptop in about 15 minutes. Part 2 is the production checklist. Terms such as group and seed are in the glossary.
Part 1: local stack¶
Requirements: Docker with Docker Compose, just and Python 3.10 or newer.
The local stack runs Neo4j Enterprise, an S3 emulator and a runner with neo4j-admin.
One command runs the full loop:
git clone https://github.com/lex00/neo4j-backup && cd neo4j-backup
just try
It resets the local stack, installs the CLI and backs up the demo group: three databases behind aliases.
Then it deletes every Order in acme-orders, backs up again, and restores the group to the moment before the delete.
Step 6:
== 6/7 Restore the group to the moment before the delete
$ neo4j-backup restore-points demo
acme-orders restorable from 21:08:04 to 21:08:49 (2 backups)
$ neo4j-backup restore demo --until 2026-11-17T21:08:37.244Z --dry-run
acme-orders replay to 21:08:37, then swap the alias from acme-orders-20261117t210732
$ neo4j-backup restore demo --until 2026-11-17T21:08:37.244Z --confirm --ticket TRY-1 ...
acme-orders alias acme-orders-20261117t210732 -> acme-orders-20261117t210921
orders now: 2
just try-mcp runs step 6 through the MCP server, with the restore_request prompt's tool calls.
The operator approves before run_restore. Connect an agent sets up your own MCP client.
To run the same loop by hand, start the stack from policies/demo.yaml and install the CLI:
just fresh
python3 -m venv orchestrator/.venv
orchestrator/.venv/bin/pip install -e 'orchestrator[dev]'
set -a; . ./.env; set +a
export NEO4J_BOLT_URI=neo4j://localhost:7687 \
AWS_ENDPOINT_URL_S3=http://localhost:9000 \
NEO4J_BACKUP_POLICY=policies/demo.yaml \
BACKUP_UPLOAD=admin \
RUNNER_EXEC_PREFIX='["docker","compose","--env-file",".env","-f","docker/compose.yaml","exec","-T","runner"]'
alias neo4j-backup=orchestrator/.venv/bin/neo4j-backup
RUNNER_EXEC_PREFIX runs neo4j-admin inside the runner container. Then:
neo4j-backup targets # what the policy covers
neo4j-backup backup demo # back up every database in the group
neo4j-backup verify demo # prove the latest backups restore and are consistent
neo4j-backup restore demo --dry-run # which backup each database comes from
neo4j-backup restore demo --confirm # seed new databases and move the aliases
just demo-pitr # a full, a change, a diff, then restores either side of it
just down # stop everything and delete the volumes
Part 2: set up for production¶
One policy file says what to back up and when. A scheduler runs it, and a runner with neo4j-admin takes the backups.
Choose how it runs¶
| Front-end | Use it when |
|---|---|
| Dagster | you run Dagster; you get backup lanes, retries and run history |
| Airflow | you run Airflow; the same work as a set of DAGs |
| CLI with CI or cron | a few databases, run from cron or CI |
| An agent | an operator runs the workflows through an agent; pair it with a scheduler for backups |
All read the same policy and write the same backups, so you can switch later. On Kubernetes, see Deploying on Dagster or the Airflow page's Deploying in production.
Prepare your Neo4j servers¶
The demo's docker/compose.yaml sets the same things.
-
Open the backup port (localhost only by default):
server.backup.enabled=true server.backup.listen_address=0.0.0.0:6362The runner needs port 6362 on the servers you back up from. Workers need Bolt (7687) on every server.
-
Let every server read the bucket, since each fetches the seed itself. On AWS, give the servers an instance role or IRSA with
s3:GetObjectands3:ListBucket(pluskms:Decryptif encrypted), and setAWS_REGION. On S3-compatible storage also setAWS_ENDPOINT_URL_S3. For Azure (azb://), setAZURE_STORAGE_ACCOUNTand grant Storage Blob Data Reader. For GCS (gs://), setGOOGLE_APPLICATION_CREDENTIALSandGOOGLE_CLOUD_PROJECT, or use workload identity with Storage Object Viewer. -
Create a user with the
adminrole (or equivalent) for the tool. Put its password inNEO4J_PASSWORDor a secret reference.
Checklist¶
-
Put applications behind aliases.
neo4j-backup adoptdoes this for existing databases while they keep serving (Onboard a customer). -
Write the policy from
policies/example.yamland POLICY.md. Check it withneo4j-backup policy validate <file>. -
Set the environment (ENVIRONMENT.md). One cluster needs
NEO4J_BOLT_URIandNEO4J_BACKUP_SOURCE, or the policy'sclusters:block for several. All needNEO4J_PASSWORD,BACKUP_BUCKET,AWS_REGIONandNEO4J_BACKUP_POLICY. On real AWS leaveAWS_ENDPOINT_URL_S3unset. -
Place the runner (Choosing a runner mode). It needs
neo4j-adminat the cluster's version, port 6362, the bucket, and scratch for your largest full. -
Set concurrency. For Dagster, see the run limits in
deploy/helm-values.yamland theneo4jpool. For Airflow, create the pools. -
Try one test group first (Onboard a customer), watching scratch and runner memory.
-
Turn on the schedules. In Dagster, start the
reconcile_registrysensor and the schedules (or setschedules: running). In Airflow, unpause the DAGs. -
Set
NEO4J_BACKUP_ALERT_WEBHOOKfor failed runs and freshness alerts. Add a check that works when the scheduler is down (Check coverage).
Day-to-day work is in the operator workflows. Give your customers the Customer guide.