一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Neo4j导出dump文件的方法详解

时间:2026-06-02 08:30:01 编辑:袖梨 来源:一聚教程网

本文将详细介绍Neo4j数据库导出dump文件的操作步骤,帮助用户快速掌握关键命令和注意事项。

Neo4j导出dump文件

1.首先需要暂停neo4j服务

在执行导出操作前,必须先停止数据库服务。

Neo4j实现导出dump文件

neo4j stop

2.在neo4j安装目录下

进入bin目录后启动命令行工具。

3.不同版本的导入命令不一样

针对4.0以下版本,使用以下命令格式:

neo4j-admin dump --database=neo4j --to=D:/Backup_graphData/xxxx.db.dump
  1. --database= 指定要导出的数据库名称
  2. --to= 设置文件保存路径

4.目前neo4j已经更新到5.0版本了

新版导出命令有所变化:

neo4j-admin database dump --to-path="D:/test/" neo4j

其中--to-path参数指定保存路径,最后参数为数据库名称。

可以查看命令的具体参数信息neo4j-admin database dump [-h] [--expand-commands] [--verbose] [--overwrite-destination[=true|false]]                          [--additional-config=] [--to-path= | --to-stdout] DESCRIPTIONDump a database into a single-file archive. The archive can be used by the load command.  should be adirectory (in which case a file called .dump will be created), or --to-stdout can be supplied to use standardoutput. If neither --to-path or --to-stdout is supplied `server.directories.dumps.root` setting will be used asdestination. It is not possible to dump a database that is mounted in a running Neo4j server.PARAMETERS                Name of the database to dump. Can contain * and ? for globbing. Note that * and ? have                            special meaning in some shells and might need to be escaped or used with quotes.OPTIONS      --additional-config=                          Configuration file with additional configuration.      --expand-commands   Allow command expansion in config value evaluation.  -h, --help              Show this help message and exit.      --overwrite-destination[=true|false]                          Overwrite any existing dump file in the destination folder.                            Default: false      --to-path=    Destination folder of database dump.      --to-stdout         Use standard output as destination for database dump.      --verbose           Enable verbose output.

5.注意点

必须以管理员权限运行cmd,否则会出现以下错误:

Invalid value for positional parameter at index 0 (): Invalid database name 'neo4j '. (java.lang.IllegalArgumentException: Database name 'neo4j ' contains illegal characters. Use simple ascii characters, numbers, dots, question marks, asterisk and dashes.)

错误提示会在数据库名后添加多余空格。

建议优先查阅官方文档,网络资料可能存在版本滞后问题。

总结

本文完整介绍了Neo4j数据库导出dump文件的操作流程,包含各版本命令差异和常见问题解决方案。

  1. Docker 安装 Neo4j 保姆级教程(最新整理)
  2. Spring Boot 整合 Neo4j的过程详解
  3. 使用Java操作Neo4j数据库的实现步骤
  4. Neo4j数据备份与恢复的多种方法
  5. 批量数据导入Neo4j的实现方式
  6. linux docker neo4j导出方式(windows导入)

热门栏目