数据库其它

关注公众号 jb51net

关闭
首页 > 数据库 > 数据库其它 > Neo4j导出dump文件

Neo4j实现导出dump文件

作者:_向晚_

Neo4j导出dump文件指南,包括暂停服务、打开cmd、使用正确命令及注意事项,确保命令和数据库名正确无误 kukuk

Neo4j导出dump文件

1.首先需要暂停neo4j服务

才可以导出文件

neo4j stop

2.在neo4j安装目录下

的bin文件中打开cmd

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

网上基本上给的是4.0版本以下的,命令如下:

neo4j-admin dump --database=neo4j --to=D:/Backup_graphData/xxxx.db.dump

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

新版本的导出命令如下

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

--to-path 保存文件的路径

neo4j 数据库名字

可以查看命令的具体参数信息
neo4j-admin database dump [-h] [--expand-commands] [--verbose] [--overwrite-destination[=true|false]]
                          [--additional-config=<file>] [--to-path=<path> | --to-stdout] <database>

DESCRIPTION

Dump a database into a single-file archive. The archive can be used by the load command. <to-path> should be a
directory (in which case a file called <database>.dump will be created), or --to-stdout can be supplied to use standard
output. If neither --to-path or --to-stdout is supplied `server.directories.dumps.root` setting will be used as
destination. It is not possible to dump a database that is mounted in a running Neo4j server.

PARAMETERS

      <database>          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=<file>
                          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=<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 (<database>): Invalid database name 'neo4j '. (java.lang.IllegalArgumentException: Database name 'neo4j ' contains illegal characters. Use simple ascii characters, numbers, dots, question marks, asterisk and dashes.)

很莫名其妙的在数据库名后面加一个空格。

ps:

尽量还是看官方文档吧,网上的资料有些已经过时了

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文