From dc9e5a61fd3ea9b25461762372d308f0024712eb Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 23 Jul 2025 15:14:12 +0100 Subject: [PATCH] Fix the restore metadata paths (#2498) --- .../pages/authentication-authorization/manage-users.adoc | 6 +++--- modules/ROOT/pages/backup-restore/restore-backup.adoc | 6 +++--- modules/ROOT/pages/database-internals/store-formats.adoc | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/ROOT/pages/authentication-authorization/manage-users.adoc b/modules/ROOT/pages/authentication-authorization/manage-users.adoc index faf64d0d3..b673fccdb 100644 --- a/modules/ROOT/pages/authentication-authorization/manage-users.adoc +++ b/modules/ROOT/pages/authentication-authorization/manage-users.adoc @@ -786,7 +786,7 @@ The `'password'` can either be a string value or a string parameter with default The `PLAINTEXT` and `ENCRYPTED` keywords are optional and can be used to specify the format of the password, i.e. whether Neo4j needs to hash it or it has already been hashed. By default, all passwords are encrypted (hashed) when stored in the Neo4j `system` database. * The optional `PLAINTEXT` in `SET PLAINTEXT PASSWORD` has the same behavior as `SET PASSWORD`. -* The optional `ENCRYPTED` is used to recreate an existing user when the plaintext password is unknown, but the encrypted password is available in the _data/databases/databasename/tools/metadata_script.cypher_ file of a database backup. +* The optional `ENCRYPTED` is used to recreate an existing user when the plaintext password is unknown, but the encrypted password is available in the _/data/scripts/databasename/restore_metadata.cypher_ file of restored database backup. See xref:backup-restore/restore-backup#_restore_users_and_roles_metadata[Restore users and roles metadata]. + With `ENCRYPTED`, the password string is expected to be in the format of `,,`, where, for example: ** `0` is the first version and refers to the `SHA-256` cryptographic hash function with iterations `1`. @@ -855,7 +855,7 @@ SET AUTH 'native' {SET PASSWORD 'abcd1234' SET PASSWORD CHANGE REQUIRED} .Create user with an encrypted password ====== -Or you can create the user `Jake` in an active state, with an encrypted password (taken from the _data/databases/databasename/tools/metadata_script.cypher_ of a database backup), and the requirement to not change the password by running: +Or you can create the user `Jake` in an active state, with an encrypted password (taken from the _/data/scripts/databasename/restore_metadata.cypher_ of a restored database backup), and the requirement to not change the password by running: [source,cypher,role=noplay] ---- @@ -1014,7 +1014,7 @@ The `'password'` can either be a string value or a string parameter with default The `PLAINTEXT` and `ENCRYPTED` keywords are optional and can be used to specify the format of the password, i.e. whether Neo4j needs to hash it or it has already been hashed. By default, all passwords are encrypted (hashed) when stored in the Neo4j `system` database. * The optional `PLAINTEXT` in `SET PLAINTEXT PASSWORD` has the same behavior as `SET PASSWORD`. -* The optional `ENCRYPTED` is used to recreate an existing user when the plaintext password is unknown, but the encrypted password is available in the _data/databases/databasename/tools/metadata_script.cypher_ file of a database backup. +* The optional `ENCRYPTED` is used to recreate an existing user when the plaintext password is unknown, but the encrypted password is available in the _/data/scripts/databasename/restore_metadata.cypher_ file when you restore a database backup. See xref:backup-restore/restore-backup#_restore_users_and_roles_metadata[Restore users and roles metadata]. + With `ENCRYPTED`, the password string is expected to be in the format of `,,`, where, for example: ** `0` is the first version and refers to the `SHA-256` cryptographic hash function with iterations `1`. diff --git a/modules/ROOT/pages/backup-restore/restore-backup.adoc b/modules/ROOT/pages/backup-restore/restore-backup.adoc index c5a96914f..803d9721f 100644 --- a/modules/ROOT/pages/backup-restore/restore-backup.adoc +++ b/modules/ROOT/pages/backup-restore/restore-backup.adoc @@ -295,16 +295,16 @@ For more information, see xref:clustering/databases.adoc#cluster-seed[Designated If you have backed up a database with the option `--include-metadata`, you can manually restore the users and roles metadata. -From the __ directory, you run the Cypher script _data/databases/databasename/tools/metadata_script.cypher_, which the `neo4j-admin database restore` command outputs, using xref:tools/cypher-shell.adoc[Cypher Shell]: +From the __ directory, you run the Cypher script _/data/scripts/databasename/restore_metadata.cypher_, which the `neo4j-admin database restore` command outputs, using xref:tools/cypher-shell.adoc[]: *Using `cat` (UNIX)* [source, shell, role=nocopy noplay] ---- -cat data/databases/databasename/tools/metadata_script.cypher | bin/cypher-shell -u user -p password -a ip_address:port -d system --param "database => 'databasename'" +cat ../data/scripts/databasename/restore_metadata.cypher | bin/cypher-shell -u user -p password -a ip_address:port -d system --param "database => 'databasename'" ---- *Using `type` (Windows)* [source, shell, role=nocopy noplay] ---- -type data\databases\databasename\tools\metadata_script.cypher | bin\cypher-shell.bat -u user -p password -a ip_address:port -d system --param "database => 'databasename'" +type ..\data\scripts\databasename\restore_metadata.cypher | bin\cypher-shell.bat -u user -p password -a ip_address:port -d system --param "database => 'databasename'" ---- diff --git a/modules/ROOT/pages/database-internals/store-formats.adoc b/modules/ROOT/pages/database-internals/store-formats.adoc index 08c659a38..4528ab88c 100644 --- a/modules/ROOT/pages/database-internals/store-formats.adoc +++ b/modules/ROOT/pages/database-internals/store-formats.adoc @@ -200,14 +200,16 @@ For example: ---- @system> ALTER DATABASE mydb SET ACCESS READ ONLY; ---- -. In your command-line tool, back up that database using the xref:backup-restore/online-backup.adoc[`neo4j-admin database backup`] command. +. In your command-line tool, back up that database using the xref:backup-restore/online-backup.adoc[`neo4j-admin database backup`] command with the `--include-metadata=all` option to include all users and roles associated with it. For example: + [source,shell] ---- bin/neo4j-admin database backup mydb --to-path=/path/to/your-backup-folder --include-metadata=all ---- -. Back in Cypher Shell, drop the database to delete it and all users and roles associated with it: ++ +The command creates a backup archive that contains both the database and the metadata associated with it. +. In Cypher Shell, drop the database to delete it and all users and roles associated with it: + [source,cypher] ----