A backup is a directory that opens as a store. It holds the last commit before the backup started, and is written while queries and transactions keep running and committing (it reads a snapshot, copying pages a batch at a time without filling the page cache). Persistent databases back up as persistent stores (their pages and metadata); in-memory and hybrid ones as hybrid stores (a snapshot file).
graphbuff backup --data data --database social --to backups/social-monday
graphbuff restore --from backups/social-monday --data data --database social --overwrite
graphbuff check --data data --database social # exit code 1 if inconsistent
graphbuff check --store some/persistent/store
- Online: the commands above open the data directory, so the server must not be
running on it. A running server does the same over HTTP when started with
--backup-dir DIR(admins only):POST /db/{name}/backupwith{"backup": "monday"}writesDIR/monday,POST /db/{name}/restorewith{"backup": "monday", "overwrite": false}creates (or replaces) the database from it, andPOST /db/{name}/checkchecks a persistent database. - Restore copies the backup (it stays usable) and checks a persistent one before the database is created. An existing database is replaced only if it is empty or with overwrite, and stays as it was if the restore fails.
- Check (
graphbuff check, persistent storage only) reads every record and verifies adjacency lists in both directions (links, list ends, endpoints, relationship groups of dense nodes, degrees and self-loop counts), node, relationship, label and type counts, blob chains and free lists, every B+tree (page use, key order, leaf links) against the entries the records call for, index counts, and constraints. Lost space (blocks neither used nor free) is a warning. 200,000 nodes and 400,000 relationships: check 1.0 s, backup 0.4 s (102 MiB). - Safety: a backup goes into a new or empty directory only, and holds a
BACKUP_INCOMPLETEmarker until it is complete; stores refuse to open (and restore refuses to read) a directory that still has one. - From Rust:
Database::backup/Database::check,DatabaseManager::backup_database/restore_database/check_database, andGraphStore::backup/GraphStore::check(call them on a snapshot for an online run).
Try it on your machine: one command starts the server with the movies graph. Needs Docker.
$ docker run --rm -p 127.0.0.1:7475:7475 -p 127.0.0.1:7687:7687 ghcr.io/janvencl/graphbuff --demo moviesThen follow Getting started.