neo4j-admin
Manage and administer Neo4j databases
TLDR
Start the DBMS
Stop the DBMS
Set the initial password of the default neo4j user (prerequisite for the first start of the DBMS)
Create an archive (dump) of an offline database to a file named database_name.dump
Load a database from an archive named database_name.dump
Load a database from a specified archive file through stdin
Display help
SYNOPSIS
neo4j-admin <command> [options]
PARAMETERS
backup
Creates a physical backup of a Neo4j database. Supports full and incremental backups. Key options include specifying the source/destination path (--from, --to), the database name (--database), and performing consistency checks (--check-consistency).
restore
Restores a Neo4j database from a physical backup. Important options include specifying the backup source (--from), the destination for the restored database (--to), the database name (--database), and the --force flag to overwrite existing data.
import
Imports data into a Neo4j database from CSV files or other formats. This command is highly optimized for large datasets. Key options include specifying the target database (--database), node/relationship import files (--nodes, --relationships), and various parsing options like --delimiter or --skip-bad-records.
dump
Dumps a Neo4j database into a single, portable file. This is often used for transferring databases between different Neo4j instances or for creating a logical backup. Options include specifying the database name (--database) and the output file path (--to).
load
Loads a Neo4j database from a file created by the dump command. Useful for restoring or importing a database from a previously dumped file. Options include specifying the source dump file (--from), the target database name (--database), and the --force flag to overwrite existing data.
check-consistency
Performs consistency checks on a Neo4j database store to ensure data integrity. Can check various components like indexes, labels, and properties. Options allow specifying the database (--database) and which specific checks to perform (e.g., --check-indexes).
compact
Reclaims unused disk space by compacting the database store files. This operation is typically performed offline. Options include specifying the database (--database) and the output directory (--to).
set-default-password
Sets the password for the default neo4j user. Requires specifying the database (--database) and the new password (--new-password).
help
Displays help information for neo4j-admin or a specific subcommand. To get help for a subcommand, use neo4j-admin help <command>.
DESCRIPTION
neo4j-admin is a powerful command-line tool for managing Neo4j database instances. It provides a wide range of functionalities essential for database administrators, including creating and managing backups, restoring databases, importing data from CSV or other formats, exporting data, performing consistency checks, migrating databases, and managing database users and roles.
It operates directly on the database files and is often used when the Neo4j database server is offline to ensure data integrity during operations like restore or import. Its capabilities extend to offline compaction, store migration, and data integrity validation.
CAVEATS
Most neo4j-admin operations (like backup, restore, import, check-consistency, compact) require the Neo4j database instance to be offline or stopped to ensure data integrity and prevent corruption. Using them on a running database can lead to unpredictable behavior or data loss.
Ensure the user running neo4j-admin has appropriate read/write permissions to the database directories.
Backups or dumps from one Neo4j version might not be directly compatible with much older or newer versions; always check the Neo4j documentation for specific migration paths.
OFFLINE OPERATIONS
A core design principle of many neo4j-admin commands is their requirement to operate on an offline database. This is critical for preventing data corruption and ensuring consistency during low-level database manipulations like schema migrations, data imports, or integrity checks. Always stop your Neo4j instance before running such commands.
DATABASE MANAGEMENT
Beyond common tasks like backups and imports, neo4j-admin facilitates various essential database management tasks, such as offline compaction (compact) to reclaim disk space, and integrity checks (check-consistency) to verify the health and structural integrity of the data store. It serves as the primary administrative interface for file-level database operations.
HISTORY
neo4j-admin evolved from earlier command-line tools and scripts provided with Neo4j. Its capabilities have expanded significantly over time, particularly with Neo4j 3.x introducing neo4j-admin import for large-scale data ingestion and Neo4j 4.x consolidating more operations under this single binary, including dump and load for portable database transfers. The emphasis has shifted towards robust, offline operations critical for production environments.
SEE ALSO
neo4j(1), cypher-shell(1), tar(1), rsync(1)