上传到 Neo4j Aura

neo4j-admin database upload 命令将本地 Neo4j 数据库转储或备份文件上传到 Neo4j Aura 实例。下表显示了您要上传的转储/备份版本与 Neo4j Aura 实例版本之间的兼容性。

转储/备份版本 Aura 版本

5.x

5.latest

4.4

4 和 5.latest

此操作是安全的,并经过端到端 TLS 加密。

先决条件

在使用 neo4j-admin database upload 命令之前,您必须满足以下先决条件:

  • 验证您的 Neo4j Aura 实例正在运行。

  • 验证您的 Neo4j Aura 实例可从运行 neo4j-admin 的机器访问。否则,上传将因 SSL 错误而失败。

语法

neo4j-admin database upload 命令具有以下语法:

neo4j-admin database upload [-h] [--expand-commands] [--verbose]
                            [--overwrite-destination[=true|false]]
                            [--additional-config=<file>] --from-path=<path> [--to=<destination>]
                            [--to-password=<password>] --to-uri=<uri> [--to-user=<username>] <database>

描述

将本地数据库推送到 Neo4j Aura 实例。目标位置是 Neo4j Aura Bolt URI。如果未通过命令选项或环境变量提供 Neo4j Cloud 用户名和密码,系统将以交互方式请求它们。

参数

表1. neo4j-admin database upload 参数
参数 描述

<database>

要上传的数据库名称。该名称用于选择一个文件,该文件预期命名为 <database>.dump 或 <database>.backup。

选项

neo4j-admin database upload 命令具有以下选项:

表2. neo4j-admin database upload 选项
选项 描述 默认值

--additional-config=<file>[1]

包含附加配置的配置文件。

--expand-commands

允许在配置值评估中进行命令扩展。

--from-path=<path>

/path/to/directory-containing-dump-or-backup 包含要上传的数据库转储或备份文件的目录路径。

-h, --help

显示此帮助消息并退出。

--overwrite-destination[=true|false]

覆盖目标数据库中的数据。

false

--to=<destination>

上传的目标。

aura

--to-password=<password>

要将此数据库推送到的目标数据库密码。如果未提供,将提示输入密码。

NEO4J_PASSWORD 环境变量的值。

--to-uri=<uri>

目标数据库的 neo4j://mydatabaseid.databases.neo4j.io Bolt URI。

--to-user=<username>

要将此数据库推送到的目标数据库用户名。如果未提供,将提示输入用户名。

NEO4J_USERNAME 环境变量的值。

--verbose

启用详细输出。

1. 有关详细信息,请参阅 Neo4j Admin 和 Neo4j CLI → 配置

输出

如果 upload 函数成功完成,它将以下日志行退出:

“Your data was successfully pushed to Aura and is now running”.

如果 upload 功能在任何时候遇到错误,您将获得如何重试或联系 Neo4j Aura 支持的说明。

此外,您可以使用 --verbose 选项启用详细输出。

示例

以下示例展示了如何使用 neo4j-admin database upload 命令将数据库转储上传到 Neo4j Aura 实例。您需要您的 Aura 实例 URI(neo4j+s://your-aura-instance-id.databases.neo4j.io),如 Aura 控制台中所示,以及您的 Aura 实例密码。

您应该使用 --overwrite-destination=true 选项来覆盖目标数据库。否则,命令将中止并抛出错误。

此命令目前不支持私有链接。如果您的公共流量已禁用且需要使用此命令,请提交支持工单

bin/neo4j-admin database upload <database> --from-path=<path-to-directory-with-database-dump> --to-uri=<neo4j+s://your-aura-instance-id.databases.neo4j.io> --overwrite-destination=true
Neo4j cloud database user name: neo4j
Neo4j cloud database password:
Upload
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%
We have received your export and it is currently being loaded into your Aura instance.
You can wait here, or abort this command and head over to the console to be notified of when your database is running.
Import progress
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%
Your data was successfully pushed to Aura and is now running.

在 Windows 上,文件路径中的反斜杠 \ 必须用另一个反斜杠进行转义。例如:

bin\neo4j-admin database upload dbname --from-path=c:\\db-dump-file\\ --to-uri=<neo4j+s:\\your-aura-instance-id.databases.neo4j.io> --overwrite-destination=true
© . All rights reserved.